/* FastTrack Pay. Counter-first: big targets, high contrast, dark like the other FastTrack apps. */
:root {
  --bg: #11151d; --panel: #191f29; --line: #313947; --ink: #f2f4f8; --muted: #aab3c2;
  --pay: #1fae6b; --pay-dark: #178c55; --pay-soft: #7de2b0;
  --warn: #f0b429; --bad: #ef5d5d; --info: #5aa9ff;
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Header */
.app-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-size: 14px; letter-spacing: .1em; color: var(--ink); text-decoration: none; }
.brand strong { display: block; font-size: 23px; letter-spacing: .04em; }
.mark { width: 44px; height: 44px; border-radius: 10px; background: var(--pay); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 22px; letter-spacing: 0; }
.status { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 14px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.ok { background: var(--pay); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.info { background: var(--info); }
.phase-banner { background: #2b2210; border-bottom: 1px solid #8a6512; color: #f6d27a; text-align: center; font-size: 13px; font-weight: 650; padding: 7px 16px; letter-spacing: .02em; }
.sample-banner { background: #12233a; border-bottom: 1px solid #2d5a8c; color: #b9d8ff; text-align: center; font-size: 13px; font-weight: 700; padding: 7px 16px; }
.offline { background: #3a1414; border-bottom: 1px solid #8a2c2c; text-align: center; padding: 8px 16px; font-weight: 650; }

main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 22px 24px; flex: 1; }
.screen { display: none; } .screen.on { display: block; }
h1 { font-size: 28px; margin: 4px 0 6px; } h2 { font-size: 19px; margin: 0 0 10px; }
.eyebrow { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.hint { color: var(--muted); font-size: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 18px; align-items: start; }

.btn { min-height: 52px; padding: 12px 22px; border-radius: 12px; border: 1px solid var(--line); background: #242c3a; font-size: 16px; font-weight: 700; }
.btn:hover { background: #334056; }
.btn.primary { background: var(--pay); border-color: var(--pay); color: #fff; }
.btn.primary:hover { background: var(--pay-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, input:focus-visible, .link-btn:focus-visible, .brand:focus-visible { outline: 3px solid var(--pay-soft); outline-offset: 3px; }

/* Home */
.lookup { max-width: 680px; margin: 36px auto 0; text-align: center; }
.lookup form { display: flex; gap: 10px; margin-top: 14px; }
.lookup input { flex: 1; min-width: 0; font-size: 32px; letter-spacing: .06em; text-align: center; padding: 16px; border-radius: 14px; border: 2px solid var(--line); background: #0c1017; color: var(--ink); text-transform: uppercase; font-family: inherit; }
.lookup .btn { min-width: 150px; font-size: 18px; }
.notice { margin: 18px auto 0; text-align: left; border-radius: 12px; padding: 14px 16px; background: #3a1414; border: 1px solid #8a2c2c; font-weight: 650; }
.notice small, .banner small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; font-size: 14px; }

.or-line { display: flex; align-items: center; gap: 14px; margin: 30px 0 16px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .12em; }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.lookup .btn.wide { width: 100%; }

/* Charge without an invoice */
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .04em; margin: 18px 0 6px; }
.field-label .opt { font-weight: 400; font-size: 12px; margin-left: 4px; }
.amount-box { display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 14px; background: #0c1017; padding: 0 16px; font-size: 32px; }
.amount-box:focus-within { outline: 3px solid var(--pay-soft); outline-offset: 3px; }
.amount-box span { color: var(--muted); }
.amount-box input { flex: 1; min-width: 0; border: none; outline: none; background: none; color: var(--ink); font: inherit; padding: 14px 0; font-variant-numeric: tabular-nums; }
.amount-box + .hint { margin: 6px 0 0; }
.choice { display: flex; gap: 10px; flex-wrap: wrap; }
.choice .btn { flex: 1; min-width: 160px; }
.choice .btn[aria-pressed="true"] { border-color: var(--pay); background: #123326; color: var(--pay-soft); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
input.text { width: 100%; font: inherit; font-size: 16px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: #0c1017; color: var(--ink); }
.btn.small { min-height: 34px; padding: 4px 14px; font-size: 13.5px; border-radius: 9px; }
.totals .fee-row { align-items: center; }
.totals .fee-row span:first-child { flex: 1; }
.totals .fee-row.waived span:first-child { color: var(--warn); }
.btn.small[aria-pressed="true"] { border-color: var(--warn); color: var(--warn); }
#manual-error { margin: 0 0 14px; }

/* Invoice */
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14.5px; margin: 10px 0 0; }
.meta dt { color: var(--muted); } .meta dd { margin: 0; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.totals { font-variant-numeric: tabular-nums; }
.totals .row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.totals .row:last-child { border-bottom: none; }
.totals .due { font-size: 19px; font-weight: 800; }
.totals .charge { font-size: 30px; font-weight: 800; color: var(--pay-soft); padding-top: 12px; }
.totals .sub { color: var(--muted); font-size: 13.5px; }
.banner { border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; font-weight: 650; display: flex; gap: 12px; align-items: flex-start; }
.banner .dot { margin-top: 7px; }
.banner.paid { background: #123326; border: 1px solid #1f6b48; }
.banner.bad { background: #3a1414; border: 1px solid #8a2c2c; }
.banner.warn { background: #33270e; border: 1px solid #8a6512; }
.banner.info { background: #12233a; border: 1px solid #2d5a8c; }
.reader-off { margin-top: 14px; border: 2px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; }
.reader-off h2 { margin: 0 0 4px; font-size: 19px; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* Pay screen: the reader box */
.reader-box { margin-top: 14px; border: 2px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; }
.reader-box h2 { margin: 0 0 4px; font-size: 19px; }
.reader-box.waiting { border-style: solid; border-color: var(--pay); background: #10241b; }
.reader-box.locked { border-style: solid; border-color: var(--bad); background: #3a1414; }
.reader-box.locked p { margin: 6px 0 0; }
.auth { max-width: 420px; margin: 36px auto 0; text-align: center; }
.auth form { display: grid; gap: 12px; margin-top: 16px; text-align: left; }
.auth label, .admin label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.auth input, .admin input, .admin select { font: inherit; font-size: 18px; padding: 12px; border-radius: 10px; border: 2px solid var(--line); background: #0c1017; color: var(--ink); min-width: 0; }
.auth input:focus, .admin input:focus, .admin select:focus { outline: none; border-color: var(--pay); }
.auth #auth-pin, .auth #auth-pin2 { font-size: 28px; letter-spacing: .3em; text-align: center; }
.auth .btn { font-size: 18px; margin-top: 4px; }
.auth .link-btn { margin-top: 14px; }
.admin table { width: 100%; margin: 14px 0; }
.admin .user-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 8px; }
.admin td .btn { margin: 2px; }
.admin .reset-row { display: flex; gap: 6px; align-items: center; }
.app-header .link-btn { font-size: 14px; }
.modal-reverse { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--line); }
.modal-reverse span { flex: 1 1 260px; font-size: 14px; }
.modal-reverse span.done { color: var(--bad); font-weight: 700; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.reader-box.typed { border-style: solid; border-color: var(--pay); padding: 14px; }
.reader-box.typed iframe { width: 100%; height: 560px; border: 0; border-radius: 10px; background: #fff; margin-top: 10px; }
.pulse { width: 16px; height: 16px; border-radius: 50%; background: var(--pay); margin: 0 auto 10px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.7); opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.mock-panel { margin-top: 16px; padding-top: 14px; border-top: 1px dashed #8a6512; }
.mock-panel .eyebrow { color: #f6d27a; }
.mock-panel .actions { margin-top: 10px; }

/* Done */
.done { max-width: 620px; margin: 28px auto 0; text-align: center; }
.tick { width: 96px; height: 96px; border-radius: 50%; background: var(--pay); color: #fff; font-size: 56px; font-weight: 800; display: grid; place-items: center; margin: 0 auto 14px; }
.done h1 { font-size: 40px; }
.done-total { font-size: 30px; font-weight: 800; color: var(--pay-soft); margin: 6px 0; font-variant-numeric: tabular-nums; }
.done .actions { margin-top: 22px; }
.done .btn { min-width: 170px; font-size: 18px; }

/* Today at this counter */
.today { max-width: 980px; margin: 34px auto 0; }
.today table { margin-top: 8px; }
.today td { vertical-align: middle; }

.today.attention { border-color: var(--bad); }
.today.attention .eyebrow { color: #ffb3b3; }

/* Overlays */
.overlay { position: fixed; inset: 0; background: rgba(5, 8, 12, .72); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 18px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px; max-width: 520px; width: 100%; text-align: center; }
.spinner { width: 58px; height: 58px; border-radius: 50%; border: 6px solid var(--line); border-top-color: var(--pay); margin: 6px auto 16px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; max-width: 760px; width: 100%; max-height: 92vh; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-actions .btn { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.modal-note { margin: 0; padding: 10px 18px; background: #12233a; border-bottom: 1px solid #2d5a8c; font-size: 14px; }
.modal-body { overflow: auto; padding: 22px; background: #2a313d; display: flex; justify-content: center; border-radius: 0 0 16px 16px; }

/* Thermal receipt: 80 mm roll, 72 mm printable. Black on white only. */
.thermal { width: 80mm; background: #fff; color: #000; font: 12px/1.4 "Segoe UI", Arial, sans-serif; padding: 4mm 4mm 6mm; box-shadow: 0 10px 40px rgba(0, 0, 0, .45); }
.thermal .tlogo { display: block; margin: 0 auto 6px; max-width: 100%; image-rendering: pixelated; }
.thermal .c { text-align: center; }
.thermal .big-t { font-weight: 800; font-size: 15px; letter-spacing: .08em; margin: 8px 0 2px; }
.thermal .stamp { border: 2px solid #000; text-align: center; font-weight: 800; font-size: 11.5px; letter-spacing: .04em; padding: 3px 4px; margin: 4px 0 6px; }
.thermal .rule { border-top: 1px dashed #000; margin: 7px 0; }
.thermal .lr { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }
.thermal .lr span:last-child { white-space: nowrap; }
.thermal .item { margin-top: 3px; }
.thermal .item b { font-weight: 700; }
.thermal .total { font-weight: 800; font-size: 14px; border-top: 2px solid #000; margin-top: 4px; padding-top: 4px; }
.thermal .fine-t { font-size: 10.5px; }
.thermal .bars { display: block; width: 62mm; height: 12mm; margin: 8px auto 2px; }
.thermal .bars-text { text-align: center; font-size: 11px; letter-spacing: .12em; }

/* Footer */
.app-footer { display: flex; gap: 16px; justify-content: center; align-items: center; flex-wrap: wrap; padding: 14px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.link-btn { background: none; border: none; color: var(--pay-soft); text-decoration: underline; font-size: 13px; padding: 4px; }

#print-root { display: none; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .lookup form { flex-direction: column; }
  .two { grid-template-columns: 1fr; }
  main { padding: 16px; }
}

/* Printing prints the receipt and nothing else. Kiosk printing (no dialog) is set up at rollout. */
@media print {
  @page { margin: 0; }
  /* Never print the dark screen background: on a direct-thermal roll it would come out black. */
  :root, html, body { background: #fff !important; color: #000; color-scheme: light; }
  * { print-color-adjust: economy; -webkit-print-color-adjust: economy; }
  body { display: block; min-height: 0; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  #print-root .thermal { width: 72mm; padding: 0 0 8mm; box-shadow: none; font-size: 9pt; }
  #print-root .thermal .big-t { font-size: 11pt; }
  #print-root .thermal .total { font-size: 10.5pt; }
  #print-root .thermal .fine-t, #print-root .thermal .stamp { font-size: 8pt; }
}
