/* Self-hosted faces (no external requests). Public Sans and Noto Sans Devanagari are variable fonts. */
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/static/app/fonts/public-sans-latin.woff2") format("woff2"); 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: "Public Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/static/app/fonts/public-sans-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap; src: url("/static/app/fonts/jetbrains-mono-latin.woff2") format("woff2"); 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: "JetBrains Mono"; font-style: normal; font-weight: 400 500; font-display: swap; src: url("/static/app/fonts/jetbrains-mono-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Noto Sans Devanagari"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/static/app/fonts/noto-sans-devanagari.woff2") format("woff2"); unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF; }

/* SIR Console — Operate mode. Lavender-aurora canvas, frosted work surfaces, deep indigo rail.
   Light is the default; dark is opt-in through the theme toggle (data-theme="dark"). */
:root {
  color-scheme: light;
  --bg:        light-dark(oklch(96.4% .014 285), oklch(16.5% .035 285));
  --glow-a:    light-dark(oklch(82% .13 292 / .72), oklch(40% .17 292 / .38));
  --glow-b:    light-dark(oklch(87% .09 220 / .72), oklch(42% .11 220 / .3));
  --surface:   light-dark(oklch(100% 0 0 / .9),  oklch(25% .045 285 / .84));
  --solid:     light-dark(oklch(100% 0 0),       oklch(25% .045 285));
  --surface-2: light-dark(oklch(96.6% .012 285), oklch(29% .05 285));
  --surface-3: light-dark(oklch(93.4% .022 285), oklch(33% .055 285));
  --line:      light-dark(oklch(90.5% .018 285), oklch(35% .045 285));
  --line-2:    light-dark(oklch(83.5% .028 285), oklch(43% .055 285));
  --ink:       light-dark(oklch(22% .055 285),   oklch(95% .01 285));
  --ink-2:     light-dark(oklch(41% .045 285),   oklch(78% .02 285));
  --ink-3:     light-dark(oklch(50% .04 285),    oklch(68% .025 285));
  --accent:    light-dark(oklch(49% .22 285),    oklch(76% .15 290));
  --accent-strong: light-dark(oklch(42% .22 285), oklch(82% .13 290));
  --accent-bg: light-dark(oklch(95% .035 288),   oklch(33% .1 288));
  --accent-2:  light-dark(oklch(58% .12 220),    oklch(78% .11 220));
  --on-accent: oklch(99% 0 0);
  --grad:      linear-gradient(135deg, oklch(54% .23 295), oklch(47% .2 268));
  --ok:        light-dark(oklch(43% .12 160),    oklch(80% .14 160));
  --ok-bg:     light-dark(oklch(94.5% .045 160), oklch(31% .06 160));
  --warn:      light-dark(oklch(46% .12 65),     oklch(82% .13 80));
  --warn-bg:   light-dark(oklch(95.5% .06 88),   oklch(33% .06 80));
  --bad:       light-dark(oklch(48% .2 25),      oklch(78% .15 25));
  --bad-bg:    light-dark(oklch(95.5% .035 25),  oklch(32% .08 25));
  --rail-bg:   light-dark(linear-gradient(185deg, oklch(25% .09 288) 0%, oklch(19% .075 272) 100%),
                          linear-gradient(185deg, oklch(18% .05 288) 0%, oklch(13.5% .045 275) 100%));
  --rail-ink:  oklch(88% .025 285);
  --rail-ink-2: oklch(72% .035 285);
  --shadow-sm: 0 1px 2px oklch(30% .1 285 / .07), 0 1px 1px oklch(30% .1 285 / .04);
  --shadow-md: 0 1px 2px oklch(30% .1 285 / .06), 0 8px 24px -8px oklch(34% .13 285 / .18);
  --shadow-lg: 0 2px 4px oklch(30% .1 285 / .08), 0 24px 64px -12px oklch(28% .14 285 / .35);
  --ring:      0 0 0 3px light-dark(oklch(60% .2 285 / .28), oklch(76% .15 290 / .4));
  --radius: 14px;
  --radius-sm: 10px;
  --ui: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", "Devanagari Sangam MN", "Kohinoor Devanagari", "Nirmala UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --rail: 248px;
}
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--ui); background: var(--bg); color: var(--ink); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
/* the aurora: two soft glows behind everything */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(900px 480px at 14% -6%, var(--glow-a), transparent 70%), radial-gradient(820px 440px at 96% -2%, var(--glow-b), transparent 70%); }
[hidden] { display: none !important; }
:lang(hi), .hi { font-size: 1.04em; line-height: 1.6; }
::selection { background: oklch(60% .2 285 / .25); color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, textarea { caret-color: var(--accent); }
a { color: var(--accent); text-underline-offset: .2em; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.75rem; font-weight: 680; letter-spacing: -.025em; }
h2 { font-size: 1rem; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: .9375rem; font-weight: 650; }
small, .muted { color: var(--ink-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .86em; letter-spacing: -.01em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--solid); color: var(--accent); padding: 8px 12px; border-radius: 8px; z-index: 100; box-shadow: var(--shadow-md); }
.skip:focus { left: 8px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------------------------------------------------------------- shell */
#app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px 16px; background: var(--rail-bg); color: var(--rail-ink); box-shadow: 1px 0 0 oklch(100% 0 0 / .06) inset, 8px 0 32px -16px oklch(25% .1 285 / .5); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 1px 0 oklch(100% 0 0 / .3) inset, 0 3px 8px -2px oklch(8% .04 285 / .55); flex: none; }
.brand-mark svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { display: grid; line-height: 1.15; }
.brand-name b { font-size: 15.5px; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.brand-name small { font-size: 12px; color: var(--rail-ink-2); }
#nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
#nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--rail-ink); text-decoration: none; font-weight: 520; transition: background-color .15s, color .15s; }
#nav a:hover { background: oklch(100% 0 0 / .08); color: #fff; }
#nav a[aria-current="page"] { background: oklch(100% 0 0 / .14); color: #fff; box-shadow: 0 0 0 1px oklch(100% 0 0 / .1) inset, 0 1px 0 oklch(100% 0 0 / .12) inset; }
#nav a[aria-current="page"] .ic { color: oklch(84% .13 295); }
#nav .nav-label { margin: 18px 12px 4px; font-size: 12px; font-weight: 600; color: var(--rail-ink-2); }
.rail-foot { margin-top: auto; display: grid; gap: 10px; }
.queue-chip { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: oklch(100% 0 0 / .09); box-shadow: 0 0 0 1px oklch(100% 0 0 / .1) inset; font-size: 12.5px; color: var(--rail-ink); }
.queue-chip b { color: #fff; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.queue-chip b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: oklch(80% .15 165); }
.queue-chip .meter { width: 100%; height: 5px; background: oklch(100% 0 0 / .14); }
.queue-chip .meter > i { background: oklch(82% .12 290); }
.who { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 12px; background: oklch(100% 0 0 / .07); box-shadow: 0 0 0 1px oklch(100% 0 0 / .08) inset; }
.who > div { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.who b, .who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who b { color: #fff; font-weight: 600; font-size: 13px; }
.who small { color: var(--rail-ink-2); font-size: 12px; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 650; font-size: 12.5px; flex: none; letter-spacing: 0; box-shadow: 0 0 0 2px oklch(100% 0 0 / .18); }
.rail .ghost { color: var(--rail-ink); }
.rail .ghost:hover, .rail .icon-btn:hover { background: oklch(100% 0 0 / .1); color: #fff; }
.rail .icon-btn { color: var(--rail-ink-2); }
#view { padding: 28px 36px 56px; min-width: 0; max-width: 1520px; width: 100%; }
#view:focus { outline: none; }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; color: var(--ink-2); max-width: 62ch; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; margin-bottom: 8px; }
.crumbs a { color: var(--ink-2); text-decoration: none; font-weight: 500; }
.crumbs a:hover { color: var(--accent); }
.crumbs .ic { width: 14px; height: 14px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.client-head { display: flex; align-items: center; gap: 16px; }
.client-head .mono-tile { width: 56px; height: 56px; font-size: 20px; border-radius: 16px; }
.client-head .meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; color: var(--ink-2); flex-wrap: wrap; }
.code-chip { font-family: var(--mono); font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-weight: 500; }
.mono-tile { --h: 285; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; color: #fff; font-weight: 700; letter-spacing: .02em; flex: none; font-size: 16px;
  background: linear-gradient(140deg, oklch(58% .2 var(--h)), oklch(46% .2 calc(var(--h) + 28))); box-shadow: 0 1px 0 oklch(100% 0 0 / .3) inset, 0 4px 10px -4px oklch(25% .08 var(--h) / .5); }

/* ---------------------------------------------------------------- buttons & fields */
.btn, button { font: inherit; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--solid); color: var(--ink); font-weight: 560; text-decoration: none; box-shadow: var(--shadow-sm); transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s var(--ease); }
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn.primary { background: var(--grad); border-color: oklch(40% .2 275); color: var(--on-accent); box-shadow: 0 1px 0 oklch(100% 0 0 / .3) inset, 0 4px 12px -4px oklch(28% .12 285 / .55); }
.btn.primary:hover { filter: brightness(1.08) saturate(1.05); }
.btn.danger { color: var(--bad); border-color: color-mix(in oklch, var(--bad) 40%, var(--line-2)); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled], button[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.ghost { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-weight: 500; }
.ghost:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
label { display: grid; gap: 6px; font-weight: 560; font-size: 13px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--solid); border: 1px solid var(--line-2); border-radius: var(--radius-sm); min-height: 40px; padding: 0 12px; width: 100%; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
select { padding-right: 8px; }
textarea { padding: 10px 12px; min-height: 80px; }
input:hover, select:hover { border-color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder { color: var(--ink-3); }
input[type="checkbox"] { accent-color: var(--accent); }
.field-help { font-weight: 400; color: var(--ink-2); font-size: 12.5px; }
.form-error { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bad-bg); color: var(--bad); font-weight: 560; font-size: 13px; }
.searchbox { position: relative; min-width: 260px; flex: 0 1 340px; }
.searchbox .ic { position: absolute; left: 12px; top: 11px; color: var(--ink-3); width: 17px; height: 17px; pointer-events: none; }
.searchbox input { padding-left: 38px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar select { width: auto; }

/* ---------------------------------------------------------------- tabs (segmented) */
.tabs { display: flex; width: max-content; max-width: 100%; gap: 2px; padding: 4px; margin-bottom: 22px; background: var(--surface-3); border-radius: 13px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: inline proximity; box-shadow: 0 1px 2px oklch(30% .1 285 / .06) inset; }
.tabs a { flex: none; scroll-snap-align: start; display: flex; align-items: center; gap: 8px; padding: 7px 16px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 560; white-space: nowrap; transition: background-color .15s, color .15s, box-shadow .2s; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--solid); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line) inset; }
.tabs a[aria-current="page"] .ic { color: var(--accent); }

/* ---------------------------------------------------------------- panels & tables */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 18px; }
.table-wrap { container-type: inline-size; overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-md); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
caption { text-align: left; padding: 14px 18px; font-weight: 650; color: var(--ink); font-size: 14px; border-bottom: 1px solid var(--line); }
thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; font-size: 12px; font-weight: 620; color: var(--ink-2); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th.num { text-align: right; }
tbody td, tbody th { padding: 10px 16px; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; vertical-align: middle; background: var(--solid); transition: background-color .12s; }
tbody th { font-weight: 560; }
tbody th .pill { margin-top: 4px; }
tbody td.num { text-align: right; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover > * { background: color-mix(in oklch, var(--accent-bg) 70%, var(--solid)); }
tr.row-link { cursor: pointer; }
.cell-trunc { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
td .sub, th .sub { display: block; color: var(--ink-2); font-size: 12.5px; font-weight: 400; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
td.num .sub { white-space: nowrap; }

/* status pills: leading dot + text, never colour alone */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--accent-bg); color: var(--accent-strong); }
.pill.busy::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.meter { width: 100%; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: block; margin-top: 6px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s var(--ease); }

/* ---------------------------------------------------------------- KPI + overview */
.kpis { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 18px; }
.kpis > .kpi { flex: 1 1 190px; }
.kpi { display: grid; gap: 4px; align-content: start; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.kpi-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-bg); color: var(--accent-strong); }
.kpi-ic .ic { width: 20px; height: 20px; }
.kpi-ic.t-cyan { background: light-dark(oklch(94.5% .04 215), oklch(32% .07 215)); color: light-dark(oklch(42% .12 220), oklch(82% .1 215)); }
.kpi-ic.t-amber { background: var(--warn-bg); color: var(--warn); }
.kpi-ic.t-green { background: var(--ok-bg); color: var(--ok); }
.kpi-ic.t-grey { background: var(--surface-3); color: var(--ink-2); }
.kpi dt { font-size: 12.5px; color: var(--ink-2); font-weight: 560; margin: 0; }
.kpi dd { margin: 0; font-size: 1.625rem; font-weight: 680; letter-spacing: -.025em; line-height: 1.15; display: flex; align-items: baseline; gap: 8px; }
.kpi dd small { font-size: .8125rem; font-weight: 500; letter-spacing: 0; }
.kpi.alert { border-color: color-mix(in oklch, var(--warn) 35%, var(--line)); background: color-mix(in oklch, var(--warn-bg) 55%, var(--solid)); }
.kpi.alert dd { color: var(--warn); }
.kpi .sub { font-size: 12.5px; color: var(--ink-2); font-weight: 400; }
.split-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-3); margin: 4px 0 14px; gap: 2px; }
.split-bar i { display: block; border-radius: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; background: var(--c); }
.legend b { color: var(--ink); font-weight: 620; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.bars { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.bars li { display: grid; grid-template-columns: 78px 1fr 48px; gap: 12px; align-items: center; font-size: 13px; }
.bars .track { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.bars .track i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }
.job-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.job-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.job-list li:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- client cards */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.client-card { position: relative; display: grid; gap: 16px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); color: inherit; text-decoration: none; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s; }
.client-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.client-card:focus-visible { outline: none; box-shadow: var(--ring), var(--shadow-md); }
.client-card .top { display: flex; align-items: center; gap: 13px; }
.client-card h2 { font-size: 1.0625rem; line-height: 1.25; }
.client-card .top > div:last-child { min-width: 0; flex: 1; }
.client-card .go { color: var(--ink-3); transition: transform .2s var(--ease), color .2s; }
.client-card:hover .go { color: var(--accent); transform: translateX(3px); }
.client-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line); }
.client-card .stats div { display: grid; gap: 1px; }
.client-card .stats dt { font-size: 12px; color: var(--ink-2); }
.client-card .stats dd { margin: 0; font-size: 1.25rem; font-weight: 660; letter-spacing: -.02em; }
.client-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }

/* ---------------------------------------------------------------- photos & clips */
.ph { width: 44px; height: 54px; border-radius: 9px; object-fit: cover; background: var(--surface-3); display: block; box-shadow: 0 0 0 1px var(--line-2), var(--shadow-sm); }
.ph.none { display: grid; place-items: center; align-content: center; gap: 1px; text-align: center; font-size: 11px; line-height: 1.1; color: var(--ink-3); font-weight: 600; padding: 3px; background: var(--surface-3); box-shadow: 0 0 0 1px var(--line-2) inset; }
.ph.none .ic { width: 16px; height: 16px; stroke-width: 1.6; }
.ph.lg { width: 148px; height: 180px; font-size: 13px; border-radius: 14px; }
.ph.lg.none .ic { width: 28px; height: 28px; }
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.clip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; text-align: left; padding: 0; color: inherit; display: block; width: 100%; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s; }
.clip:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-2); }
.clip:focus-visible { outline: none; box-shadow: var(--ring); }
.clip img { display: block; width: 100%; aspect-ratio: 2.4 / 1; object-fit: contain; background: #fff; border-bottom: 1px solid var(--line); }
.clip .cap { padding: 10px 14px; display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; color: var(--ink-2); font-size: 13px; }

/* ---------------------------------------------------------------- logs & filter search */
.log-view { height: min(52vh, 420px); overflow: auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-family: var(--mono); font-size: 12.5px; line-height: 1.7; }
.log-line { display: flex; gap: 10px; }
.log-line .mono { color: var(--ink-3); flex: none; }
.log-line.warn { color: var(--warn); }
.log-line.bad { color: var(--bad); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 14px; margin-bottom: 14px; }
.filter-grid label { font-size: 12.5px; }

/* one authored entrance per navigation; JS sets [data-settled] so polling redraws never replay it */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
#tabBody:not([data-settled]) .kpis > *, #tabBody:not([data-settled]) .grid-2 > *, #list:not([data-settled]) .client-grid > * { animation: rise .5s var(--ease) both; }
#tabBody:not([data-settled]) .kpis > :nth-child(2), #list:not([data-settled]) .client-grid > :nth-child(2) { animation-delay: 45ms; }
#tabBody:not([data-settled]) .kpis > :nth-child(3), #list:not([data-settled]) .client-grid > :nth-child(3) { animation-delay: 90ms; }
#tabBody:not([data-settled]) .kpis > :nth-child(4), #list:not([data-settled]) .client-grid > :nth-child(4) { animation-delay: 135ms; }
#tabBody:not([data-settled]) .kpis > :nth-child(5) { animation-delay: 180ms; }
#tabBody:not([data-settled]) .grid-2 > :nth-child(1) { animation-delay: 200ms; }
#tabBody:not([data-settled]) .grid-2 > :nth-child(2) { animation-delay: 250ms; }
#tabBody:not([data-settled]) .grid-2 > :nth-child(3) { animation-delay: 300ms; }
#tabBody:not([data-settled]) .grid-2 > :nth-child(4) { animation-delay: 350ms; }

/* ---------------------------------------------------------------- empty / loading */
.empty { display: grid; justify-items: start; gap: 8px; padding: 36px 28px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--surface); }
.empty p { margin: 0; color: var(--ink-2); max-width: 60ch; }
.skeleton { height: 16px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sheen 1.4s linear infinite; margin: 12px 0; }
@keyframes sheen { to { background-position: -200% 0; } }
.error-box { padding: 16px 18px; border-radius: var(--radius); background: var(--bad-bg); color: var(--bad); display: flex; gap: 12px; align-items: center; justify-content: space-between; font-weight: 560; }

/* ---------------------------------------------------------------- dialog */
dialog { border: 1px solid var(--line-2); border-radius: 18px; padding: 0; background: var(--solid); color: var(--ink); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); }
dialog.wide { width: min(940px, calc(100vw - 32px)); }
dialog::backdrop { background: oklch(22% .08 285 / .45); backdrop-filter: blur(5px); overflow: hidden; overscroll-behavior: contain; }
dialog:modal { overscroll-behavior: contain; }
dialog[open] { display: flex; flex-direction: column; animation: dlg-in .25s var(--ease); }
@starting-style { dialog[open] { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
dialog form { display: flex; flex-direction: column; min-height: 0; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 14px 22px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 1.0625rem; }
.dlg-body { padding: 20px 22px; overflow: auto; display: grid; gap: 16px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 168px; gap: 20px; align-items: start; }
.detail img.clipimg { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--ink-2); display: grid; gap: 8px; justify-items: center; background: var(--surface-2); transition: border-color .15s, background-color .15s; }
.dropzone b { color: var(--ink); }
.dropzone.over { border-color: var(--accent); background: var(--accent-bg); }
.file-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; max-height: 220px; overflow: auto; }
.file-list li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 13px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--solid); }

/* ---------------------------------------------------------------- toasts */
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 1000; pointer-events: none; }
.toast { pointer-events: auto; max-width: 400px; padding: 12px 16px; border-radius: 12px; background: oklch(24% .08 285); color: #fff; box-shadow: var(--shadow-lg); font-weight: 520; animation: toast-in .3s var(--ease); }
.toast.bad { background: oklch(44% .19 25); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- login */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-art { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: 48px 56px; color: #fff; overflow: hidden;
  background: radial-gradient(700px 420px at 15% 0%, oklch(52% .24 295 / .75), transparent 65%), radial-gradient(640px 420px at 100% 100%, oklch(55% .13 220 / .55), transparent 65%), linear-gradient(160deg, oklch(26% .1 290), oklch(18% .08 270)); }
.login-art .brand-name small { color: oklch(82% .04 285); }
.login-art h2 { font-size: clamp(1.9rem, 3vw, 2.6rem); line-height: 1.12; font-weight: 700; letter-spacing: -.03em; max-width: 15ch; color: #fff; }
.login-art p { margin: 14px 0 0; color: oklch(86% .03 285); font-size: 1.0625rem; max-width: 44ch; line-height: 1.55; }
.login-points { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.login-points li { display: flex; gap: 14px; align-items: flex-start; color: oklch(92% .02 285); }
.login-points .kpi-ic { width: 36px; height: 36px; border-radius: 10px; background: oklch(100% 0 0 / .12); color: #fff; box-shadow: 0 0 0 1px oklch(100% 0 0 / .14) inset; }
.login-points b { display: block; color: #fff; font-weight: 620; }
.login-points span { color: oklch(82% .03 285); font-size: 13.5px; }
.login-pane { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(400px, 100%); display: grid; gap: 16px; }
.login-card h1 { font-size: 1.75rem; }
.login-card .lede { margin: -8px 0 4px; color: var(--ink-2); }
.login-card .brand { display: none; padding: 0; }
.login-card .brand-name b { color: var(--ink); }
.login-card .btn { min-height: 44px; }

/* ---------------------------------------------------------------- narrow */
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-card .brand { display: flex; }
}
@media (max-width: 520px) { .tabs a { padding: 7px 12px; } .tabs a .ic { display: none; } }
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; gap: 10px; }
  .brand-name small { display: none; }
  #nav { flex-direction: row; flex-wrap: wrap; margin: 0; }
  #nav .nav-label { display: none; }
  .rail-foot { margin: 0 0 0 auto; display: flex; align-items: center; }
  .queue-chip { display: none; }
  .ghost span, .who > div { display: none; }
  .ghost { width: auto; }
  .who { padding: 4px; }
  #view { padding: 20px 16px 40px; }
  .detail { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .client-head .mono-tile { width: 46px; height: 46px; font-size: 17px; }
}
@container (max-width: 860px) {
  .stack-narrow tbody tr > :first-child, .stack-narrow tbody tr > :last-child:not([data-label]) { grid-column: 1 / -1; }
  .stack-narrow thead { display: none; }
  .stack-narrow tbody td.num { text-align: left; }
  .stack-narrow tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--solid); }
  .stack-narrow tbody td, .stack-narrow tbody th { border: 0; padding: 3px 0; background: none; }
  .stack-narrow tbody td::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .client-card:hover, .clip:hover { transform: none; }
}
@media (forced-colors: active) { .pill, .btn { border: 1px solid CanvasText; } }

/* ---- library, full data table, first-page ("section") details, settings ---- */
table.wide { width: max-content; min-width: 100%; }
table.wide tbody td, table.wide tbody th { white-space: nowrap; }
table.wide th.sect { background: color-mix(in oklch, var(--accent-bg) 55%, var(--surface-2)); color: var(--accent-strong); }
.clip-thumb { display: block; width: 190px; height: auto; max-height: 84px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.h-lg { font-size: 22px; font-weight: 680; letter-spacing: -.01em; }
.h-md { font-size: 17px; font-weight: 650; margin: 24px 0 12px; }
.pageimg { display: block; max-width: 100%; max-height: 74vh; margin-inline: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

.scan-panel .panel-body { display: grid; gap: 14px; }
.scan-panel h2 { margin: 0; font-size: 16px; }
.scan-state { display: flex; flex-wrap: wrap; gap: 8px; }

.sec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px 40px; }
.sec-strip { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; padding: 12px 16px; background: color-mix(in oklch, var(--accent-bg) 45%, var(--surface)); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.sec-strip dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 22px; margin: 0; flex: 1; }
.sec-strip dt { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.sec-strip dd { margin: 0; font-size: 13.5px; font-weight: 520; overflow-wrap: anywhere; }

.rec-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.rec-links a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--accent-bg); color: var(--accent-strong); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.rec-links a:hover { background: var(--surface-3); }
.rec-links .ic { width: 14px; height: 14px; }
.rec-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.rec-section h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 14px; }
.rec-section .kv { grid-template-columns: max-content minmax(0, 1fr); }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: min(360px, 90vw); max-height: 60vh; overflow: auto; display: grid; gap: 12px; padding: 14px; background: var(--solid); border: 1px solid var(--line-2); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.menu-panel fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.menu-panel legend { padding: 0; margin-bottom: 4px; font-size: 11.5px; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.menu-panel label { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; }
.menu-panel input[type=checkbox], .settings .check input { width: auto; min-height: 0; }

.settings .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 20px; }
.settings .wide-field { grid-column: 1 / -1; }
.settings .check { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 4px 10px; font-weight: 520; }
.settings .check .field-help { grid-column: 2; }
.panel-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.clip .cap .sub { display: block; color: var(--ink-2); font-size: 12.5px; font-weight: 400; }
.settings .form-grid label { align-content: start; }

/* ---- bulk upload ---- */
.up-opts { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: end; margin: 14px 0; }
.up-opts label { display: grid; gap: 4px; font-size: 13px; }
.up-opts select { width: auto; }
.up-opts .check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.up-opts .check input { width: auto; min-height: 0; }
.up-sum { display: grid; gap: 6px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.up-sum .meter.big { height: 10px; margin: 0; }
.bad-text { color: var(--bad); font-weight: 600; }
.up-list { list-style: none; margin: 0; padding: 0; max-height: min(40vh, 380px); overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--solid); }
.up-list li { display: grid; grid-template-columns: minmax(0, 1fr) 76px minmax(110px, 190px); gap: 2px 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.up-list li:last-child { border-bottom: 0; }
.up-list .n { max-width: none; }
.up-list .sz { color: var(--ink-3); text-align: right; }
.up-list .st { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-list .meter { grid-column: 1 / -1; height: 3px; margin: 0; }
.up-list li[data-state=done] .st { color: var(--ok); }
.up-list li[data-state=failed] .st { color: var(--bad); font-weight: 600; }
.up-list li[data-state=skipped] { opacity: .65; }
.up-list li[hidden] { display: none; }

/* the PDF being processed stands out at the top of the list */
tr.is-running > * { background: color-mix(in oklch, var(--accent, oklch(58% .2 285)) 9%, transparent); }

/* search + filter + sort bar above lists */
.view-ctl { flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.view-ctl .searchbox { flex: 1 1 220px; max-width: 320px; }
.view-ctl select { min-height: 36px; }
