/* Flash Pay design system — calm fintech.
   Accent #1F5BFF, navy #0B1B2B, soft grey #F5F7FA.
   Space Grotesk (headings), Inter (body). Fonts: SIL OFL 1.1, self-hosted. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/Inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/static/fonts/SpaceGrotesk-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --accent: #1F5BFF;
  --accent-ink: #1D4ED8;
  --accent-soft: #E8EEFF;
  --navy: #0B1B2B;
  --navy-2: #1C3350;
  --grey: #F5F7FA;
  --line: #EAECF0;
  --line-strong: #D0D5DD;
  --muted: #475467;
  --muted-2: #98A2B3;
  --ok: #067647;
  --ok-soft: #ECFDF3;
  --warn: #B54708;
  --warn-soft: #FFFAEB;
  --warn-line: #FEDF89;
  --warn-ink: #7A2E0E;
  --bad: #B42318;
  --bad-soft: #FEF3F2;
  --bad-line: #FECDCA;
  --bad-ink: #912018;
  --neutral-soft: #F2F4F7;
  --heading: "Space Grotesk", system-ui, -apple-system, "Segoe UI", "Noto Sans Sinhala", "Sinhala Sangam MN", "Iskoola Pota", "Noto Sans Tamil", sans-serif;
  --body: Inter, system-ui, -apple-system, "Segoe UI", "Noto Sans Sinhala", "Sinhala Sangam MN", "Iskoola Pota", "Noto Sans Tamil", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--grey); color: var(--navy); font-family: var(--body); font-size: 15px; line-height: 1.45; font-size-adjust: from-font; }
@supports not (font-size-adjust: from-font) {
  :lang(si) body { line-height: 1.65; }
}
:lang(si) body { line-height: 1.6; }
:lang(si) h1, :lang(si) h2, :lang(si) h3 { letter-spacing: 0; line-height: 1.3; }
a { color: var(--navy); }
h1, h2, h3 { margin: 0; }
h1 { font-family: var(--heading); font-size: 30px; letter-spacing: -0.02em; line-height: 1.15; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
[hidden] { display: none !important; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sr-only { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sr-only:focus { position: fixed; top: 12px; left: 12px; z-index: 100; width: auto; height: auto; padding: 10px 14px; border-radius: 8px; background: var(--navy); color: #fff; text-decoration: none; font-weight: 600; }

/* ---- brand mark ---- */
.brand { display: flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; }
.brand svg { flex: none; display: block; }
.wordmark { font-family: var(--heading); font-size: 19px; letter-spacing: -0.03em; }
.wordmark b { font-weight: 700; }
.wordmark span { font-weight: 400; }
.app-tag { margin-left: 8px; font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 8px; border-radius: 6px; }

/* ---- layout ---- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 12px 20px; }
.topbar-inner > .brand { flex: none; }
.topbar-who { flex: 1 1 auto; min-width: 0; display: flex; justify-content: flex-end; align-items: center; gap: 16px; font-size: 14px; color: var(--muted); }
.topbar-who span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-shop { color: var(--navy); font-weight: 600; }
.topbar-actions { flex: none; display: flex; align-items: center; gap: 14px; font-size: 14px; }
.tb-signout { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; white-space: nowrap; }
.tb-signout svg { display: none; }
@media (max-width: 760px) {
  .topbar-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand actions" "who who"; padding: 10px 16px; gap: 6px 10px; }
  .topbar-inner > .brand { grid-area: brand; min-width: 0; }
  .topbar-actions { grid-area: actions; gap: 8px; }
  .topbar-who { grid-area: who; justify-content: flex-start; gap: 0; font-size: 13px; }
  .topbar .wordmark { font-size: 17px; }
  .topbar .app-tag { margin-left: 4px; }
}
@media (max-width: 440px) {
  .tb-signout { width: 40px; height: 40px; justify-content: center; border: 1px solid var(--line-strong); border-radius: 10px; text-decoration: none; color: #344054; }
  .tb-signout span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tb-signout svg { display: block; }
}
.topbar-who a, .linklike { color: var(--muted); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.fp-lang { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px; font-size: 12px; background: #fff; }
.fp-lang button { border: 0; border-radius: 999px; padding: 4px 10px; min-height: 28px; background: transparent; color: #344054; font: inherit; font-weight: 600; cursor: pointer; }
.fp-lang button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.page { max-width: 1200px; margin: 0 auto; padding: 24px; display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.page-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.page-aside { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head .kicker { font-size: 13px; font-weight: 600; color: var(--accent-ink); }
.page-head p { font-size: 15px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ---- cards ---- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.card.tight { padding: 16px 20px; gap: 12px; }
.card.table-card { padding: 8px 12px; gap: 0; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-head p { font-size: 14px; color: var(--muted); margin-top: 4px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font-family: var(--heading); font-size: 28px; font-weight: 700; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.v-ok { color: var(--ok); } .v-warn { color: var(--warn); } .v-bad { color: var(--bad); }
.tile { background: var(--grey); border-radius: 10px; padding: 14px; font-size: 14px; }
.tile .label { color: var(--muted); font-size: 12px; }
.tile .value { font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 12px; }

/* ---- banners ---- */
.banner { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 14px; line-height: 1.5; background: #fff; }
.banner.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-ink); }
.banner.bad { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad-ink); }
.banner.ok { border-color: #ABEFC6; background: var(--ok-soft); color: #054F31; }
.banner.info { border-color: #C7D7FE; background: var(--accent-soft); color: #1E3A8A; }
.banner pre { white-space: pre-wrap; font: inherit; margin: 6px 0 0; }

/* ---- pills ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.bad { color: var(--bad); background: var(--bad-soft); }
.pill.info { color: var(--accent-ink); background: var(--accent-soft); }
.pill.neutral { color: var(--muted); background: var(--neutral-soft); }
.pill svg { flex: none; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- buttons ---- */
.btn { background: #fff; color: var(--navy); border: 1px solid var(--line-strong); padding: 12px 20px; min-height: 44px; border-radius: 10px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--grey); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: #1749d6; }
.btn.danger { color: var(--bad); border-color: var(--bad-line); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 4px; }

/* ---- forms ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label, .label-strong { font-size: 14px; font-weight: 600; }
.req { color: var(--bad); }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea { font: inherit; font-size: 15px; padding: 11px 12px; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 10px; width: 100%; background: #fff; color: var(--navy); min-width: 0; }
.field textarea { min-height: 76px; resize: vertical; }
.field .auto { background: #F5F8FF; border-color: #A4BCFD; }
.hint { font-size: 13px; color: var(--muted); }
.hint.ok { color: var(--ok); } .hint.bad { color: var(--bad); } .hint.auto { color: var(--accent-ink); }
.inline { display: flex; gap: 8px; align-items: center; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 10px; }
.choice { border: 1px solid var(--line-strong); background: #fff; border-radius: 12px; padding: 14px; text-align: left; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.choice strong { font-size: 16px; }
.choice span { font-size: 13px; color: var(--muted); }
.choice[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); padding: 13px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 8px; }

/* ---- scan tiles ---- */
.scans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 12px; }
.scan { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.scan.done { border-style: solid; border-color: #A6F4C5; }
.scan .thumb { aspect-ratio: 4 / 3; border-radius: 8px; background: var(--grey); display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted-2); font-size: 13px; }
.scan .thumb img { width: 100%; height: 100%; object-fit: cover; }
.scan .name { font-size: 14px; font-weight: 600; }
.scan .meta { font-size: 12px; color: var(--muted); min-height: 16px; }
.scan input[type=file] { display: none; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td.mono { white-space: nowrap; }
table.t td { padding: 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t .right { text-align: right; }
table.t tr.clickable { cursor: pointer; }
table.t tr.clickable:hover td { background: #FAFBFC; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---- stepper (POS wizard) ---- */
.steps { max-width: 1200px; margin: 0 auto; padding: 20px 24px 0; overflow-x: auto; }
.steps ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.steps li { flex: 1; min-width: 110px; display: flex; flex-direction: column; gap: 8px; }
:lang(si) .steps li { min-width: 132px; }
.steps .bar { height: 4px; border-radius: 999px; background: var(--line); }
.steps .lbl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.steps li.done .bar { background: var(--ok); }
.steps li.done .lbl { color: var(--ok); }
.steps li.current .bar { background: var(--accent); }
.steps li.current .lbl { color: var(--navy); font-weight: 700; }
.steps button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }

/* summary aside */
.summary-item { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.summary-item:first-of-type { border-top: 0; }
.dot { width: 18px; height: 18px; border-radius: 999px; border: 2px solid var(--line-strong); flex: none; display: inline-flex; align-items: center; justify-content: center; }
.dot.current { border-color: var(--accent); }
.dot.done { border-color: var(--ok); background: var(--ok); }
.summary-item .k { font-size: 12px; color: var(--muted); }
.summary-item .v { font-size: 14px; font-weight: 600; }
.summary-item .v.pending { color: var(--muted); font-weight: 400; }

/* key/value lists */
dl.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

/* money breakdown */
.money { display: flex; flex-direction: column; font-size: 14px; }
.money div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.money div:first-child { border-top: 0; }
.money .total { font-weight: 700; font-size: 15px; }
.big-number { font-family: var(--heading); font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }

/* progress list (pending / approved) */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline .t-title { font-weight: 600; font-size: 14px; }
.timeline .t-sub { font-size: 13px; color: var(--muted); }

/* signature pads */
.sigs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.sig { border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.sig canvas { width: 100%; height: 120px; background: #FAFBFC; border-radius: 8px; touch-action: none; display: block; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }

/* toast + modal */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(11,27,43,.2); }
.toast.bad { background: var(--bad); }
dialog.modal { border: 0; border-radius: 16px; padding: 0; max-width: min(960px, calc(100% - 24px)); width: 100%; }
dialog.modal::backdrop { background: rgba(11, 27, 43, .55); }
dialog.modal .modal-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
dialog.modal img { max-width: 100%; border-radius: 8px; }

/* ---- HQ shell ---- */
.hq-shell { display: flex; flex-wrap: wrap; align-items: stretch; min-height: 100vh; }
.hq-nav { flex: 1 1 220px; max-width: 100%; background: var(--navy); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; }
.hq-nav .wordmark { color: #fff; font-size: 18px; }
.hq-nav .app-tag { color: var(--navy); background: #fff; font-size: 11px; padding: 3px 7px; margin-left: 6px; }
.hq-bar .brand { padding: 0 8px 18px; }
.hq-burger { display: none; }
.hq-menu { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.hq-nav button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 44px; border-radius: 10px; border: 0; background: transparent; color: #C8D1DC; font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; text-align: left; width: 100%; }
.hq-nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.hq-nav button[aria-current="page"] { background: var(--navy-2); color: #fff; font-weight: 600; }
.hq-nav .count { margin-left: auto; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.hq-links { display: flex; flex-direction: column; gap: 6px; }
.hq-nav .who { margin-top: auto; padding: 18px 12px 0; font-size: 13px; color: var(--muted-2); display: flex; flex-direction: column; gap: 6px; }
.hq-nav .who button { min-height: 0; padding: 0; color: var(--muted-2); text-decoration: underline; font-size: 13px; width: auto; }
/* phones and small tablets: top bar + hamburger dropdown */
@media (max-width: 900px) {
  .hq-shell { display: block; }
  .hq-nav { position: sticky; top: 0; z-index: 30; display: block; padding: 0; box-shadow: 0 1px 0 rgba(255,255,255,.06); }
  .hq-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; min-height: 60px; }
  .hq-bar .brand { padding: 0; }
  .hq-nav .hq-burger { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; padding: 0; flex: none; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; color: #fff; }
  .hq-burger .count { position: absolute; top: -6px; right: -6px; margin: 0; padding: 1px 6px; font-size: 11px; border: 2px solid var(--navy); }
  .hq-burger .b-close, .hq-nav.open .hq-burger .b-open { display: none; }
  .hq-nav.open .hq-burger .b-close { display: inline; }
  .hq-nav.open .hq-burger .count { display: none; }
  .hq-menu { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--navy); padding: 8px 12px 16px; border-top: 1px solid rgba(255,255,255,.08); box-shadow: 0 16px 32px rgba(11, 27, 43, .35); max-height: calc(100vh - 60px); overflow-y: auto; }
  .hq-nav.open .hq-menu { display: flex; }
  .hq-links { gap: 2px; }
  .hq-nav .who { margin-top: 8px; padding: 14px 12px 0; border-top: 1px solid rgba(255,255,255,.08); flex-direction: row; justify-content: space-between; align-items: center; }
  .hq-nav .who-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hq-nav .who button { flex: none; min-height: 40px; color: #C8D1DC; font-size: 14px; }
}
.hq-main { flex: 999 1 640px; min-width: 0; padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.hq-main h1 { font-size: 28px; }
.hq-cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.hq-cols > .main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.hq-cols > .side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.compare { display: grid; grid-template-columns: minmax(160px, 240px) 1fr; gap: 16px; align-items: start; padding: 16px 0; border-top: 1px solid var(--line); }
.compare:first-of-type { border-top: 0; padding-top: 0; }
.compare .scan { border-style: solid; }
@media (max-width: 640px) {
  .compare { grid-template-columns: 1fr; }
  .page, .hq-main { padding: 16px; }
  h1 { font-size: 26px; }
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button { border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted); }
.filters button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border-color: #A4BCFD; }

/* print: agreement summaries */
@media print {
  .topbar, .steps, .page-aside, .actions, .hq-nav, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}
