/* WTF Bills · Payables — "platform board".
   Dark: the station departures board (amber LED numerals on a near-black ground, rail-signal lamps).
   Light: the printed reservation chart (ink on warm chart paper). One system, two lights. */
@font-face { font-family: 'Departure'; src: url('/ap/assets/departure-mono.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Plex'; font-weight: 400; src: url('/ap/assets/plex-400.woff2') format('woff2'); font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex'; font-weight: 500; src: url('/ap/assets/plex-500.woff2') format('woff2'); font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex'; font-weight: 600; src: url('/ap/assets/plex-600.woff2') format('woff2'); font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex'; font-weight: 400; src: url('/ap/assets/plex-ext-400.woff2') format('woff2'); font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Plex'; font-weight: 500; src: url('/ap/assets/plex-ext-500.woff2') format('woff2'); font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Plex'; font-weight: 600; src: url('/ap/assets/plex-ext-600.woff2') format('woff2'); font-display: swap; unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ui: 'Plex', 'IBM Plex Sans', ui-sans-serif, sans-serif;
  --led: 'Departure', 'Plex', ui-monospace, monospace;
  /* light: reservation chart */
  --ground: #efebe0; --paper: #fbf9f3; --paper-2: #f5f2ea; --rule: #d8d1c0; --rule-2: #e7e1d3;
  --ink: #17191c; --ink-2: #4a4f57; --ink-3: #6b707a;
  --lamp: #9a4f00; --lamp-ink: #fff8ea; --lamp-soft: rgba(154, 79, 0, .10); --cursor: rgba(154, 79, 0, .09);
  --go: #1d7444; --go-soft: rgba(29, 116, 68, .11);
  --stop: #b8332a; --stop-soft: rgba(184, 51, 42, .10);
  --caution: #8a5a00; --caution-soft: rgba(196, 135, 0, .16);
  --info: #1f5aa6; --info-soft: rgba(31, 90, 166, .10);
  --idle: #6b707a; --idle-soft: rgba(107, 112, 122, .12);
  --heat: 154, 79, 0;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 8px 24px -12px rgba(40, 30, 10, .18);
  --shadow-lg: 0 2px 6px rgba(40, 30, 10, .08), 0 24px 64px -16px rgba(40, 30, 10, .35);
  --scrim: rgba(23, 25, 28, .42);
  --r: 6px; --r-lg: 10px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ground: #08090b; --paper: #0f1216; --paper-2: #13171c; --rule: #232a33; --rule-2: #1a2028;
  --ink: #ece6d6; --ink-2: #b3ad9f; --ink-3: #868c96;
  --lamp: #ffb21a; --lamp-ink: #1a1200; --lamp-soft: rgba(255, 178, 26, .12); --cursor: rgba(255, 178, 26, .07);
  --go: #46d17f; --go-soft: rgba(70, 209, 127, .12);
  --stop: #ff6a5c; --stop-soft: rgba(255, 106, 92, .13);
  --caution: #ffc94d; --caution-soft: rgba(255, 201, 77, .13);
  --info: #6fb6ff; --info-soft: rgba(111, 182, 255, .12);
  --idle: #8a909a; --idle-soft: rgba(138, 144, 154, .14);
  --heat: 255, 178, 26;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px -12px rgba(0, 0, 0, .7);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, .6), 0 28px 70px -18px rgba(0, 0, 0, .85);
  --scrim: rgba(0, 0, 0, .62);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #08090b; --paper: #0f1216; --paper-2: #13171c; --rule: #232a33; --rule-2: #1a2028;
    --ink: #ece6d6; --ink-2: #b3ad9f; --ink-3: #868c96;
    --lamp: #ffb21a; --lamp-ink: #1a1200; --lamp-soft: rgba(255, 178, 26, .12); --cursor: rgba(255, 178, 26, .07);
    --go: #46d17f; --go-soft: rgba(70, 209, 127, .12);
    --stop: #ff6a5c; --stop-soft: rgba(255, 106, 92, .13);
    --caution: #ffc94d; --caution-soft: rgba(255, 201, 77, .13);
    --info: #6fb6ff; --info-soft: rgba(111, 182, 255, .12);
    --idle: #8a909a; --idle-soft: rgba(138, 144, 154, .14);
    --heat: 255, 178, 26;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px -12px rgba(0, 0, 0, .7);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, .6), 0 28px 70px -18px rgba(0, 0, 0, .85);
    --scrim: rgba(0, 0, 0, .62);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 14px/1.45 var(--ui); font-feature-settings: 'tnum' 1; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--lamp); color: var(--lamp-ink); }
.led { font-family: var(--led); letter-spacing: .01em; font-feature-settings: normal; }
.faint { color: var(--ink-3); }
.muted { color: var(--ink-2); }
.boot { padding: 80px 24px; text-align: center; color: var(--ink-3); font-family: var(--led); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; background: var(--paper); border-right: 1px solid var(--rule); display: flex; flex-direction: column; padding: 14px 10px 12px; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand img { width: 26px; height: 26px; border-radius: 6px; }
.brand b { display: block; font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--ink-3); font-size: 12px; }
.rail-label { font-size: 11px; color: var(--ink-3); padding: 14px 10px 6px; letter-spacing: .06em; text-transform: uppercase; }
.rail a { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r); text-decoration: none; color: var(--ink-2); }
.rail a:hover { background: var(--paper-2); color: var(--ink); }
.rail a.on { background: var(--lamp-soft); color: var(--ink); }
.rail a.on .n { color: var(--lamp); }
.rail .n { font-family: var(--led); font-size: 13px; color: var(--ink-3); min-width: 2ch; text-align: right; }
.rail .lampdot { width: 8px; height: 8px; border-radius: 50%; margin-left: 5px; background: var(--idle); }
.rail-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--rule-2); display: grid; gap: 8px; font-size: 12px; color: var(--ink-3); }
.rail-foot .who b { color: var(--ink); font-weight: 500; display: block; font-size: 13px; }
.rail-foot .row { display: flex; gap: 6px; flex-wrap: wrap; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: color-mix(in srgb, var(--ground) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--rule-2); }
.top h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.top .sub { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .spacer { flex: 1; }
.clock { font-family: var(--led); font-size: 13px; color: var(--lamp); padding: 3px 8px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); white-space: nowrap; }
.content { padding: 18px 24px 120px; max-width: 1480px; width: 100%; }

/* ---------- buttons, fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--r); border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font-weight: 500; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink); }
.btn-primary:hover { border-color: var(--lamp); filter: brightness(1.06); }
.btn-danger { color: var(--stop); border-color: color-mix(in srgb, var(--stop) 45%, var(--rule)); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper-2); border-color: transparent; color: var(--ink); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.icon-btn { width: 34px; padding: 0; }
.kbd { font-family: var(--led); font-size: 11px; line-height: 1; padding: 3px 5px 2px; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; color: var(--ink-2); background: var(--paper); }
.btn-primary .kbd { border-color: color-mix(in srgb, var(--lamp-ink) 35%, transparent); color: var(--lamp-ink); background: transparent; }
input[type=search], input[type=text], input[type=email], input[type=password], input:not([type]), select { height: 34px; border-radius: var(--r); border: 1px solid var(--rule); background: var(--paper); padding: 0 11px; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--lamp); box-shadow: 0 0 0 3px var(--lamp-soft); }
input::placeholder { color: var(--ink-3); }
.field { display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.field input { font-size: 15px; color: var(--ink); }

/* ---------- board header: platform tallies ---------- */
.tallies { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper); overflow: hidden; box-shadow: var(--shadow); }
.tally { position: relative; text-align: left; border: 0; border-right: 1px solid var(--rule-2); background: transparent; padding: 12px 16px 13px; cursor: pointer; display: grid; gap: 2px; transition: background .15s; }
.tally:last-child { border-right: 0; }
.tally:hover { background: var(--paper-2); }
.tally .k { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.tally .c { font-family: var(--led); font-size: 30px; line-height: 1.1; color: var(--ink); }
.tally .t { font-family: var(--led); font-size: 13px; color: var(--ink-3); }
.tally.on { background: var(--lamp-soft); }
.tally.on .c { color: var(--lamp); }
.tally.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--lamp); }
.tally .key { position: absolute; top: 10px; right: 12px; }
.flip { display: inline-block; animation: flip .32s cubic-bezier(.16, 1, .3, 1); }
@keyframes flip { 0% { clip-path: inset(0 0 100% 0); transform: translateY(-35%); filter: blur(1px); } 100% { clip-path: inset(0 0 0 0); transform: none; filter: none; } }

.lamp { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--idle); box-shadow: 0 0 0 3px var(--idle-soft); }
.t-go .lamp, .lamp.go { background: var(--go); box-shadow: 0 0 0 3px var(--go-soft); }
.t-stop .lamp, .lamp.stop { background: var(--stop); box-shadow: 0 0 0 3px var(--stop-soft); }
.t-caution .lamp, .lamp.caution { background: var(--caution); box-shadow: 0 0 0 3px var(--caution-soft); }
.t-info .lamp, .lamp.info { background: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.lamp.live { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px transparent; opacity: .55; } }

.hint { margin: 12px 2px 14px; color: var(--ink-2); font-size: 13px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.search { position: relative; flex: 1 1 320px; max-width: 520px; }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--ink-3); }
.search input { width: 100%; padding-left: 32px; padding-right: 34px; }
.search .kbd { position: absolute; right: 8px; top: 8px; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; background: var(--paper); }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 11px; cursor: pointer; color: var(--ink-2); font-size: 13px; }
.seg button.on { background: var(--lamp-soft); color: var(--ink); }

/* ---------- chips (signal lamps) ---------- */
.chips { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 7px; border-radius: 11px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--idle-soft); color: var(--ink-2); }
.chip .lamp { width: 6px; height: 6px; box-shadow: none; }
.chip.t-go { background: var(--go-soft); color: var(--go); }
.chip.t-stop { background: var(--stop-soft); color: var(--stop); }
.chip.t-caution { background: var(--caution-soft); color: var(--caution); }
.chip.t-info { background: var(--info-soft); color: var(--info); }
.chip.t-ref { background: transparent; border: 1px solid var(--rule); color: var(--ink-2); font-family: var(--led); font-weight: 400; font-size: 11.5px; }

/* ---------- departures table ---------- */
.board { border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow); overflow: clip; }
.board table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.board th { position: sticky; top: 57px; z-index: 5; background: var(--paper-2); text-align: left; font-size: 11.5px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--rule); }
.board td { padding: 10px 12px; border-bottom: 1px solid var(--rule-2); vertical-align: middle; }
.board tr:last-child td { border-bottom: 0; }
.board tbody tr { cursor: pointer; transition: background .12s; }
.board tbody tr:hover { background: var(--paper-2); }
.board tbody tr.cur { background: var(--cursor); }
.board tbody tr.cur td:first-child { box-shadow: inset 2px 0 0 var(--lamp); }
.board tbody tr.sel { background: var(--lamp-soft); }
.board .c-sel { width: 44px; padding-right: 0; }
.board .c-date { width: 104px; font-family: var(--led); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.board .c-date small { display: block; font-size: 11.5px; color: var(--ink-3); }
.board .c-who { width: auto; }
.board .c-acct { width: 220px; font-size: 12.5px; color: var(--ink-2); }
.board .c-sig { width: 300px; }
.board .c-amt { width: 196px; text-align: right; font-family: var(--led); font-size: 15px; white-space: nowrap; }
.board.plain .c-amt { width: 19%; font-size: 13.5px; }
.board.plain .c-date { width: 90px; }
.board .c-amt small { display: block; font-size: 11.5px; color: var(--ink-3); }
.board th.c-amt { font-family: var(--ui); font-size: 11.5px; }
.vname { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vsub { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vsub .led { color: var(--ink-2); font-size: 12px; }
.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.check { appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--ink-3); border-radius: 4px; display: grid; place-content: center; cursor: pointer; background: var(--paper); margin: 0; }
.check:checked { background: var(--lamp); border-color: var(--lamp); }
.check:checked::after { content: ''; width: 9px; height: 5px; border: 2px solid var(--lamp-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.group-row td { background: var(--paper-2); font-size: 12.5px; color: var(--ink-2); padding: 7px 12px; }
.group-row b { color: var(--ink); font-weight: 600; }
.empty { padding: 48px 24px; text-align: center; color: var(--ink-2); display: grid; gap: 6px; justify-items: center; }
.empty b { color: var(--ink); font-size: 15px; font-weight: 600; }
.empty p { margin: 0; max-width: 52ch; }
.more { padding: 12px; text-align: center; border-top: 1px solid var(--rule-2); }

/* bulk bar */
.bulk { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px 10px 10px 18px; border-radius: 12px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lg); animation: rise .22s cubic-bezier(.16, 1, .3, 1); max-width: calc(100vw - 24px); }
.bulk .sum { font-size: 13.5px; white-space: nowrap; }
.bulk .sum b { font-family: var(--led); font-size: 16px; font-weight: 400; color: var(--lamp); }
:root[data-theme="dark"] .bulk { background: #1c222a; color: var(--ink); border: 1px solid var(--rule); }
.bulk .btn-ghost { color: inherit; opacity: .8; }
@keyframes rise { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes rise-phone { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- detail: facts | document ---------- */
.detail { display: grid; grid-template-columns: minmax(380px, 5fr) minmax(0, 6fr); gap: 16px; align-items: start; }
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.pad { padding: 18px 20px; }
.dhead { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.dhead h2 { margin: 0 0 3px; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.damt { font-family: var(--led); font-size: 34px; line-height: 1.15; margin: 14px 0 2px; color: var(--ink); }
.dmeta { color: var(--ink-2); font-size: 13px; }
.dactions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.nav-pn { display: flex; gap: 4px; align-items: center; }
.section { border-top: 1px solid var(--rule-2); padding: 15px 20px; }
.section h3 { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.section h3 .grow { flex: 1; }
.kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 7px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.alert-row { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline; padding: 4px 0; font-size: 13px; color: var(--ink-2); }
.notice { border-radius: var(--r); padding: 10px 12px; background: var(--paper-2); border: 1px solid var(--rule-2); color: var(--ink-2); font-size: 13px; margin-top: 12px; }
.notice.err { background: var(--stop-soft); border-color: color-mix(in srgb, var(--stop) 30%, transparent); color: var(--stop); }
.notice.ok { background: var(--go-soft); border-color: color-mix(in srgb, var(--go) 30%, transparent); color: var(--go); }
.notice.warn { background: var(--caution-soft); border-color: color-mix(in srgb, var(--caution) 30%, transparent); color: var(--ink); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 13px 22px; font-size: 13.5px; }
.timeline li::before { content: ''; position: absolute; left: 0; top: 5px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--rule); background: var(--paper); }
.timeline li::after { content: ''; position: absolute; left: 5.5px; top: 17px; bottom: 1px; width: 1px; background: var(--rule); }
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--go); border-color: var(--go); }
.timeline li.now::before { background: var(--lamp); border-color: var(--lamp); }
.timeline li.bad::before { background: var(--stop); border-color: var(--stop); }
.timeline .when { font-family: var(--led); font-size: 11.5px; color: var(--ink-3); }

.viewer { position: sticky; top: 70px; height: calc(100vh - 88px); height: calc(100dvh - 88px); display: flex; flex-direction: column; overflow: hidden; }
.viewer-tabs { display: flex; gap: 4px; align-items: center; padding: 8px; border-bottom: 1px solid var(--rule-2); overflow-x: auto; }
.viewer-tabs button { border: 1px solid transparent; background: transparent; border-radius: var(--r); padding: 5px 10px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-tabs button.on { background: var(--paper-2); border-color: var(--rule); color: var(--ink); }
.viewer-tabs .open { margin-left: auto; }
.viewer-body { flex: 1; background: var(--paper-2); display: grid; place-items: center; min-height: 0; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- accounting panel ---------- */
.acct { display: grid; gap: 2px; }
.acct-row { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 6px 0; font-size: 13.5px; border-bottom: 1px dashed var(--rule-2); }
.acct-row:last-child { border-bottom: 0; }
.acct-row .k { color: var(--ink-3); }
.acct-row .v { min-width: 0; overflow-wrap: anywhere; }
.acct-row .v.none { color: var(--ink-3); font-style: italic; }
.acct-row .a { font-family: var(--led); font-size: 13px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.src { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 4px; margin-left: 6px; white-space: nowrap; }
.src-suggested { background: var(--info-soft); color: var(--info); }
.src-confirmed { background: var(--go-soft); color: var(--go); }
.src-tally { background: var(--lamp-soft); color: var(--lamp); }
.src-none { background: var(--idle-soft); color: var(--ink-3); }
.edit-grid { display: grid; gap: 10px; margin-top: 10px; }
.combo { position: relative; display: grid; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.combo input { width: 100%; font-size: 14px; color: var(--ink); }
.combo ul { position: absolute; z-index: 40; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none; max-height: 240px; overflow-y: auto; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow-lg); }
.combo li { padding: 7px 9px; border-radius: 4px; cursor: pointer; font-size: 13.5px; color: var(--ink); display: flex; justify-content: space-between; gap: 10px; }
.combo li small { color: var(--ink-3); white-space: nowrap; }
.combo li[aria-selected="true"], .combo li:hover { background: var(--lamp-soft); }
.combo .warn-line { color: var(--caution); font-size: 12px; }

/* ---------- matrix (cost centres) ---------- */
.matrix-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper); box-shadow: var(--shadow); }
.matrix { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; }
.matrix th, .matrix td { padding: 8px 12px; border-bottom: 1px solid var(--rule-2); white-space: nowrap; }
.matrix thead th { position: sticky; top: 0; background: var(--paper-2); font-weight: 500; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); text-align: right; z-index: 2; }
.matrix thead th:first-child { text-align: left; }
.matrix th.rowh { position: sticky; left: 0; z-index: 1; background: var(--paper); text-align: left; font-weight: 500; max-width: 280px; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--rule-2); }
.matrix thead th:first-child { left: 0; z-index: 3; }
.matrix td { text-align: right; font-family: var(--led); font-size: 12.5px; cursor: pointer; }
.matrix td.zero { color: var(--ink-3); cursor: default; }
.matrix td:not(.zero):hover { outline: 1px solid var(--lamp); outline-offset: -1px; }
.matrix td.tot, .matrix th.tot { font-weight: 600; color: var(--ink); background: var(--paper-2); }
.matrix tr.sub th.rowh { padding-left: 30px; font-weight: 400; color: var(--ink-2); font-size: 12.5px; }
.matrix tr.sub td { font-size: 12px; }
.matrix tr.foot td, .matrix tr.foot th { background: var(--paper-2); border-bottom: 0; border-top: 1px solid var(--rule); }
.caret { display: inline-block; width: 14px; color: var(--ink-3); transition: transform .15s; }
.caret.open { transform: rotate(90deg); }

/* ---------- recon ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--paper); overflow: hidden; margin-bottom: 14px; box-shadow: var(--shadow); }
.kpis > div { padding: 12px 16px; border-right: 1px solid var(--rule-2); }
.kpis > div:last-child { border-right: 0; }
.kpis .k { font-size: 12.5px; color: var(--ink-2); }
.kpis .v { font-family: var(--led); font-size: 22px; }
.kpis .v.bad { color: var(--stop); }
.kpis .v.good { color: var(--go); }
.diff-pos { color: var(--caution); }
.diff-neg, td.neg { color: var(--stop); }
.sel select { height: 34px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--paper); color: var(--ink); padding: 0 10px; font: inherit; font-size: 13px; }
.toolbar .tick { margin-top: 0; align-items: center;}
.section-card .card-h { margin: 0 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.grid-2 .board .vname { white-space: normal; overflow: visible; }
.grid-2 .board .c-who { width: auto; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--rule-2); font-size: 13px; }
.list li:last-child { border-bottom: 0; }
.panel h3.ph { margin: 0; padding: 12px 16px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--rule-2); font-weight: 600; }

/* ---------- overlays: dialog, palette, drawer, toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: grid; place-items: start center; padding: 9vh 16px 16px; animation: fade .16s ease-out; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: min(600px, 100%); background: var(--paper); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.16, 1, .3, 1); overflow: hidden; }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } }
.dialog header { padding: 16px 20px 6px; }
.dialog header h2 { margin: 0; font-size: 17px; font-weight: 600; }
.dialog .body { padding: 8px 20px 4px; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }
.payees { border: 1px solid var(--rule-2); border-radius: var(--r); max-height: 280px; overflow-y: auto; }
.payees > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--rule-2); font-size: 13px; }
.payees > div:last-child { border-bottom: 0; }
.payees .to { font-family: var(--led); font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.payees .to { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 3px 0 2px; }
.payees .to .acct { color: var(--ink); font-size: 13.5px; letter-spacing: 0.04em; }
.payees .to .ifsc { color: var(--ink-2); }
.payees .to .trust { font-family: var(--ui); font-size: 11.5px; color: var(--ink-3); }
.payees .num { font-family: var(--led); font-size: 14px; }
.grand { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 2px 4px; }
.grand .led { font-size: 28px; color: var(--lamp); }
.typed { font-family: var(--led); font-size: 20px !important; height: 46px !important; letter-spacing: .04em; }
.typed.match { border-color: var(--go) !important; box-shadow: 0 0 0 3px var(--go-soft) !important; }
.bankcard { border: 1px solid var(--rule); border-radius: var(--r); padding: 14px; background: var(--paper-2); display: grid; gap: 8px; }
.bankcard .acno { font-family: var(--led); font-size: 24px; letter-spacing: .06em; }
.tick { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; margin-top: 12px; cursor: pointer; }

.palette { width: min(640px, 100%); background: var(--paper); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .18s cubic-bezier(.16, 1, .3, 1); }
.palette .pin { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--rule-2); }
.palette .pin input { flex: 1; border: 0; background: transparent; height: 52px; font-size: 16px; padding: 0; box-shadow: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 56vh; overflow-y: auto; }
.palette li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.palette li .d { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette li .r { font-family: var(--led); font-size: 12.5px; color: var(--ink-2); }
.palette li[aria-selected="true"] { background: var(--lamp-soft); }
.palette .grp { padding: 10px 10px 4px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); cursor: default; display: block; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; align-items: center; }
.keys > span:nth-child(odd) { display: flex; gap: 4px; justify-content: flex-end; }

.drawer { position: fixed; z-index: 55; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--paper); border-left: 1px solid var(--rule); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .22s cubic-bezier(.16, 1, .3, 1); }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer header { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--rule-2); }
.drawer header h2 { margin: 0; font-size: 16px; flex: 1; }
.drawer .scroll { overflow-y: auto; flex: 1; }

#toast { position: fixed; z-index: 80; left: 50%; top: 14px; transform: translate(-50%, -140%); max-width: min(560px, calc(100vw - 24px)); padding: 11px 16px; border-radius: 10px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lg); font-size: 13.5px; transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
#toast.show { transform: translate(-50%, 0); }
#toast.toast-err { background: var(--stop); color: #fff; }
#toast.toast-ok { background: var(--go); color: #fff; }
:root[data-theme="dark"] #toast.toast-ok, :root[data-theme="dark"] #toast.toast-err { color: #08090b; }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); }
.login .board-side { background: #08090b; color: #ece6d6; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.login .board-side .rows { display: grid; gap: 10px; font-family: var(--led); font-size: 15px; color: #ffb21a; }
.login .board-side .rows div { display: grid; grid-template-columns: 70px 1fr auto; gap: 16px; padding-bottom: 10px; border-bottom: 1px solid #1d232b; }
.login .board-side .rows span:last-child { color: #46d17f; }
.login .board-side h2 { font-family: var(--led); font-size: 44px; line-height: 1.05; margin: 0; color: #ffb21a; font-weight: 400; }
.login .board-side p { color: #868c96; max-width: 44ch; }
.login form { align-self: center; justify-self: center; width: min(380px, calc(100vw - 32px)); display: grid; gap: 14px; padding: 32px 0; }
.login form h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.login form p { margin: 0 0 6px; color: var(--ink-2); }
.login .btn { height: 42px; font-size: 15px; }

/* ---------- phone ---------- */
.tabbar { display: none; }
.phone-only { display: none !important; }
.i.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 1180px) {
  .board .c-acct { display: none; }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .viewer { position: static; height: 78vh; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .top { padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .content { padding: 12px 16px calc(150px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--rule); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--ink-3); text-decoration: none; padding: 4px 0; position: relative; }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.on { color: var(--lamp); }
  .tabbar .badge { position: absolute; top: 0; left: calc(50% + 6px); font-family: var(--led); font-size: 10px; background: var(--lamp); color: var(--lamp-ink); border-radius: 8px; padding: 1px 5px; }
  .bulk { bottom: calc(72px + env(safe-area-inset-bottom)); gap: 8px; padding-left: 14px; }
  .clock, .top .sub, .hide-phone { display: none !important; }
  .phone-only { display: inline-flex !important; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login .board-side { padding: 28px 20px; gap: 22px; }
  .login .board-side h2 { font-size: 30px; }
  .login .board-side .rows div:nth-child(n+4) { display: none; }
}
@media (max-width: 720px) {
  .tallies { grid-template-columns: repeat(5, minmax(108px, 1fr)); overflow-x: auto; scroll-snap-type: x mandatory; }
  .tally { scroll-snap-align: start; padding: 10px 12px; }
  .tally .c { font-size: 24px; }
  .tally .key { display: none; }
  .search { flex-basis: 100%; max-width: none; }
  .search .kbd { display: none; }
  .board th, .board thead { display: none; }
  .bulk { left: 12px; right: 12px; transform: none; max-width: none; justify-content: space-between; animation-name: rise-phone; }
  .bulk .kbd { display: none; }
  .bulk { gap: 6px; padding: 8px 8px 8px 12px; }
  .bulk .sum { font-size: 12.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .bulk .sum b { font-size: 14px; }
  .exc li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .exc li > :first-child { justify-self: start; }
  .board.plain { overflow-x: auto; }
  .board.plain table { display: table; min-width: 100%; }
  .board.plain thead { display: table-header-group; }
  .board.plain tbody { display: table-row-group; }
  .board.plain tbody tr { display: table-row; padding: 0; }
  .board.plain th, .board.plain td { display: table-cell; padding: 9px 10px; border-bottom: 1px solid var(--rule-2); white-space: nowrap; }
  .board.plain th { position: static; }
  .board.plain table { table-layout: auto; }
  .board.plain td.c-who, .board.plain th.c-who { white-space: normal; padding-left: 12px; }
  .board.plain td.c-amt, .board.plain th.c-amt { width: auto !important; padding: 9px 8px 9px 4px; font-size: 12px; }
  .board.plain .vname { white-space: normal; }
  .matrix .rowh .faint { display: none; }
  .board table, .board tbody { display: block; }
  .board tbody tr { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "sel who amt" "sel date date" "sel sig sig"; column-gap: 8px; row-gap: 3px; padding: 11px 12px; border-bottom: 1px solid var(--rule-2); }
  .board tbody tr.nosel { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who amt" "date date" "sig sig"; }
  .board td { display: block; padding: 0; border: 0; width: auto !important; }
  .board .c-sel { grid-area: sel; padding-top: 2px; }
  .board .c-who { grid-area: who; }
  .board .c-amt { grid-area: amt; font-size: 14.5px; }
  .board .c-amt small { display: none; }
  .board .c-date { grid-area: date; font-size: 12px; display: flex; gap: 8px; }
  .board .c-date small { display: inline; }
  .board .c-sig { grid-area: sig; padding-top: 4px; }
  .board tbody tr.cur td:first-child { box-shadow: none; }
  .group-row { display: block !important; }
  .group-row td { display: block; }
  .kv, .acct-row { grid-template-columns: 104px minmax(0, 1fr); }
  .acct-row .a { grid-column: 2; text-align: left; }
  .damt { font-size: 28px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > div:nth-child(2) { border-right: 0; }
  .kpis > div:nth-child(-n+2) { border-bottom: 1px solid var(--rule-2); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .dialog footer { flex-direction: column-reverse; }
  .dialog footer .btn { width: 100%; height: 42px; }
  .overlay { padding-top: 4vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

.acct.plan { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--rule-2); }
.acct.plan .head .k { font-weight: 600; color: var(--ink); }
.acct.plan .head .v { font-family: var(--led); font-size: 12px; color: var(--ink-2); }
