@font-face {
  font-family: Montserrat;
  src: url("/fonts/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
}
@font-face {
  font-family: Montserrat;
  src: url("/fonts/Montserrat-Bold.ttf") format("truetype");
  font-weight: 700;
}
:root {
  --navy: #021942;
  --pink: #E2005A;
  --mid: #294384;
  --grey: #F2F2F2;
  --body: #333333;
  --muted: #4A4F57;
  --line: #D5D8DE;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Montserrat, "Segoe UI", sans-serif;
  color: var(--body);
  background: var(--grey);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--mid); }
header.top {
  background: var(--navy);
  color: white;
  padding: 14px 24px 0;
}
header.top .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
header.top img { height: 32px; width: auto; }
header.top .who { color: #D5D8DE; font-size: 13px; }
header.top .who button {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,.4);
  margin-left: 8px;
}
.menu-toggle { display: none; }
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 12px 0 10px;
}
nav a { color: white; text-decoration: none; font-size: 14px; }
nav a.on { color: var(--pink); font-weight: 700; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 64px; }
h1 { color: var(--navy); font-size: 28px; margin: 0 0 8px; }
h2 { color: var(--navy); font-size: 18px; margin: 28px 0 8px; }
.lead { color: var(--muted); margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.card, .panel, form.stack, table {
  background: white;
  border: 1px solid var(--line);
}
.card { padding: 16px 18px; }
.card .label { color: var(--muted); font-size: 13px; }
.card .value { color: var(--navy); font-size: 26px; font-weight: 700; }
.panel { padding: 16px 18px; margin: 12px 0; }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  margin: 0 8px 8px 0;
}
.badge.ok { background: #e7f6ee; color: #0d6b3d; }
.badge.bad { background: #fff6f8; color: var(--pink); }
.badge.idle { background: white; color: var(--muted); border: 1px solid var(--line); }
.badge.pending { background: #fff6df; color: #8a5a00; }
.lead .badge, td .badge { margin: 0 0 0 6px; vertical-align: 1px; }
.notice {
  background: white;
  border-left: 4px solid var(--pink);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.warn {
  background: #fff6f8;
  border: 1px solid var(--pink);
  padding: 10px 12px;
  margin: 8px 0;
}
.staging-banner {
  margin: 0;
  background: #c40000;
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 40px;
  letter-spacing: 0.2em;
  line-height: 1;
  padding: 18px 12px;
}
pre.summary {
  white-space: pre-wrap;
  font-family: inherit;
}
button, .button {
  background: var(--pink);
  color: white;
  border: 0;
  padding: 8px 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.secondary, a.secondary {
  background: var(--mid);
}
button.quiet {
  background: white;
  color: var(--navy);
  border: 1px solid var(--line);
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { background: var(--grey); color: var(--navy); }
label { display: block; font-size: 13px; color: var(--muted); margin: 0; }
label.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: var(--body);
  font-size: 15px;
}
input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; margin: 0; flex: 0 0 auto; }
input, select, textarea {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: white;
  color: var(--body);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.3;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--mid);
  outline-offset: 1px;
  border-color: var(--mid);
}
textarea { min-height: 96px; height: 96px; resize: vertical; }
select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23021942' d='M0 0h12L6 8z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Edit forms: label above the control, equal columns, aligned to the control. */
form.panel,
form.stack {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 16px;
  row-gap: 16px;
  align-items: end;
}
form.stack { grid-template-columns: minmax(0, 1fr); max-width: 420px; }
form.panel > :not(label),
form.stack > :not(label) { grid-column: 1 / -1; }
form.panel > p,
form.stack > p,
form.panel > h2,
form.stack > h2 { margin: 0; }
form.panel label,
form.stack label,
form.inline label,
form.filters label {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  margin: 0;
  min-width: 0;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}
form.panel label:has(textarea),
form.panel label:has(input[type="file"]),
form.stack label:has(textarea),
form.stack label:has(input[type="file"]),
form.panel label:has(input[type="checkbox"]),
form.stack label:has(input[type="checkbox"]),
form.inline label:has(input[type="checkbox"]) {
  grid-column: 1 / -1;
}
form.panel label:has(input[type="checkbox"]),
form.stack label:has(input[type="checkbox"]),
form.inline label:has(input[type="checkbox"]) {
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400;
  color: var(--body);
}
form.panel input:not([type="checkbox"]):not([type="hidden"]),
form.panel select,
form.stack input:not([type="checkbox"]):not([type="hidden"]),
form.stack select,
form.inline input:not([type="checkbox"]):not([type="hidden"]),
form.inline select,
form.filters input:not([type="checkbox"]):not([type="hidden"]),
form.filters select {
  height: 40px;
  min-height: 40px;
}
form.panel input[type="file"],
form.stack input[type="file"],
form.inline input[type="file"] {
  height: auto;
  min-height: 40px;
  padding: 8px 10px;
}
form.panel button,
form.stack button,
form.inline button,
form.filters button { height: 40px; padding: 0 16px; }

form.inline,
form.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: end;
}
form.inline label,
form.filters label { flex: 1 1 180px; }
form.inline > p,
form.inline label:has(input[type="checkbox"]) { flex: 1 1 100%; }
form.inline > input:not([type="hidden"]),
form.inline > select {
  flex: 1 1 160px;
  width: auto;
  min-width: 0;
  height: 40px;
}
form.filters { margin-bottom: 12px; }
.split form.panel { grid-template-columns: 1fr; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
pre.report {
  background: white;
  border: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
}
.account-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
}
form.inline label:has(.account-pick),
form.panel label:has(.account-pick) { flex: 2 1 280px; }
.date-source {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.customers .account-no { white-space: nowrap; width: 1%; }
table.customers .account-name { min-width: 10rem; }
table.customers th button {
  display: flex;
  align-items: center;
  width: 100%;
  background: transparent;
  color: var(--navy);
  border: 0;
  padding: 0 1.1rem 0 0;
  min-height: 32px;
  height: auto;
  font-weight: 700;
  text-align: left;
}
table.customers th[aria-sort="ascending"] button::after { content: " \2191"; }
table.customers th[aria-sort="descending"] button::after { content: " \2193"; }

@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; }
  header.top { padding: 12px 12px 0; }
  form.panel:not(.inline) { grid-template-columns: 1fr; }
  form.stack { max-width: none; }
}

@media (max-width: 768px) {
  .staging-banner {
    font-size: 32px;
    letter-spacing: 0.16em;
    padding: 16px 12px;
  }
  header.top { padding: 8px 12px 0; }
  header.top .row { flex-wrap: wrap; align-items: center; }
  header.top img { height: 28px; }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    margin-left: auto;
    padding: 0 14px;
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,.45);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
  }
  header.top .who {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0 8px;
  }
  header.top .who button {
    min-width: 44px;
    min-height: 44px;
    margin-left: 0;
    padding: 0 12px;
  }
  nav {
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0 0 8px;
  }
  header.top.menu-open nav { display: flex; }
  nav a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 8px;
    font-size: 16px;
  }
  table.customers th,
  table.customers td { padding: 4px 8px; }
  table.customers th button {
    display: flex;
    align-items: center;
    min-height: 44px;
    width: 100%;
  }
  table.customers a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  table.customers .account-name {
    min-width: 8.5rem;
    white-space: normal;
  }
  main { padding: 16px 12px 48px; }
  table.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack td { display: block; width: 100%; }
  table.stack tr {
    margin: 0 0 10px;
    border-bottom: 1px solid var(--line);
  }
  table.stack td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
  }
  table.stack td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--navy);
    text-align: left;
  }
  h1 { font-size: 24px; }
  form.inline,
  form.filters {
    flex-direction: column;
    align-items: stretch;
  }
  form.inline label,
  form.filters label,
  form.inline > input:not([type="hidden"]),
  form.inline > select,
  form.inline button,
  form.filters button,
  form.panel button,
  form.stack button {
    flex: 1 1 auto;
    width: 100%;
    min-height: 44px;
  }
  form.panel input:not([type="checkbox"]):not([type="hidden"]):not([type="file"]),
  form.panel select,
  form.stack input:not([type="checkbox"]):not([type="hidden"]):not([type="file"]),
  form.stack select,
  form.inline input:not([type="checkbox"]):not([type="hidden"]):not([type="file"]),
  form.inline select,
  form.filters input:not([type="checkbox"]):not([type="hidden"]):not([type="file"]),
  form.filters select {
    height: 44px;
    min-height: 44px;
  }
}
.qr { background: #fff; display: inline-block; padding: 8px; border: 1px solid var(--line); }
.qr svg { display: block; width: 180px; height: 180px; }
.secret-key { font-family: ui-monospace, monospace; font-size: 18px; letter-spacing: 0.06em; word-break: break-all; }
.backup-codes { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; max-width: 420px; }
.backup-codes code { font-family: ui-monospace, monospace; font-size: 16px; }
@media (max-width: 768px) {
  .backup-codes { grid-template-columns: 1fr; }
}
