/* ==========================================================================
   Bahi — the operating ledger for Chartered Accountant firms
   Design system. One rule above all others:
     HUE says WHO holds the ball  ·  RED / AMBER / GREEN say HOW LATE / HEALTHY.
   Agent = peacock teal · Client = sky blue · Human gate = stamp violet ·
   Portal & code = graphite. Red, amber, green are never used for actors.
   ========================================================================== */

:root {
  /* surfaces — paper & ink */
  --paper: #F2F1EC;
  --paper-2: #E8E6DF;
  --card: #FCFBF8;
  --card-2: #F7F6F2;
  --glass: rgba(252, 251, 248, 0.8);
  --ink: #1B2130;
  --ink-2: #485164;
  --ink-3: #7C8496;
  --line: #E2DFD7;
  --line-2: #D2CEC3;
  --rule: rgba(46, 111, 214, 0.07);

  /* chrome — the bahi cover */
  --spine: #14171D;
  --spine-2: #1A1E26;
  --spine-ink: #E8E6E1;
  --spine-dim: #959AA4;
  --gold: #BFA472;

  /* ACTORS — who holds the ball */
  --agent: #0E7C86;     --agent-bg: #DDF1F2;   --agent-ink: #075A62;
  --client: #2F6FD6;    --client-bg: #E1EBFB;  --client-ink: #1D4F9F;
  --gate: #7140B8;      --gate-bg: #EDE4F8;    --gate-ink: #52288F;
  --code: #5A6172;      --code-bg: #E8E9ED;    --code-ink: #3D4352;

  /* HEALTH — how late / how healthy */
  --ok: #2E8B4E;        --ok-bg: #DFF1E4;      --ok-ink: #1E6738;
  --warn: #C98A00;      --warn-bg: #FBF0D2;    --warn-ink: #8A5E00;
  --bad: #C62A2A;       --bad-bg: #FBE1DF;     --bad-ink: #951B1B;

  --shadow-sm: 0 1px 0 rgba(27, 33, 48, .04), 0 1px 3px rgba(27, 33, 48, .06);
  --shadow: 0 1px 0 rgba(27, 33, 48, .03), 0 8px 24px -12px rgba(27, 33, 48, .22);
  --shadow-lg: 0 24px 60px -16px rgba(27, 33, 48, .38);
  --r-sm: 6px; --r: 10px; --r-lg: 16px;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Instrument Sans', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --spring: cubic-bezier(.32, 1.25, .5, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --sidebar-w: 240px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --_dark: 1; }
}
:root[data-theme="dark"], :root:not([data-theme="light"]) { }

/* Dark palette — applied by media query unless forced light, or when forced dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12151B; --paper-2: #181C24; --card: #1B2029; --card-2: #20262F;
    --glass: rgba(27, 32, 41, .78);
    --ink: #EFE9DE; --ink-2: #B9B4AA; --ink-3: #868A93; --line: #2A303B; --line-2: #343B48;
    --rule: rgba(120, 160, 230, .05);
    --spine: #0D0F13; --spine-2: #12151B;
    --agent: #34B3BC; --agent-bg: rgba(52, 179, 188, .14); --agent-ink: #7FD6DC;
    --client: #6A9BF0; --client-bg: rgba(106, 155, 240, .15); --client-ink: #A7C4F7;
    --gate: #A27BE0; --gate-bg: rgba(162, 123, 224, .16); --gate-ink: #C9AEF2;
    --code: #8E95A5; --code-bg: rgba(142, 149, 165, .15); --code-ink: #C2C7D2;
    --ok: #4FBF73; --ok-bg: rgba(79, 191, 115, .14); --ok-ink: #8EDDA8;
    --warn: #E5AE2E; --warn-bg: rgba(229, 174, 46, .14); --warn-ink: #F2CD74;
    --bad: #EF5B5B; --bad-bg: rgba(239, 91, 91, .14); --bad-ink: #F79A9A;
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 12px 30px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #12151B; --paper-2: #181C24; --card: #1B2029; --card-2: #20262F;
  --glass: rgba(27, 32, 41, .78);
  --ink: #EFE9DE; --ink-2: #B9B4AA; --ink-3: #868A93; --line: #2A303B; --line-2: #343B48;
  --rule: rgba(120, 160, 230, .05);
  --spine: #0D0F13; --spine-2: #12151B;
  --agent: #34B3BC; --agent-bg: rgba(52, 179, 188, .14); --agent-ink: #7FD6DC;
  --client: #6A9BF0; --client-bg: rgba(106, 155, 240, .15); --client-ink: #A7C4F7;
  --gate: #A27BE0; --gate-bg: rgba(162, 123, 224, .16); --gate-ink: #C9AEF2;
  --code: #8E95A5; --code-bg: rgba(142, 149, 165, .15); --code-ink: #C2C7D2;
  --ok: #4FBF73; --ok-bg: rgba(79, 191, 115, .14); --ok-ink: #8EDDA8;
  --warn: #E5AE2E; --warn-bg: rgba(229, 174, 46, .14); --warn-ink: #F2CD74;
  --bad: #EF5B5B; --bad-bg: rgba(239, 91, 91, .14); --bad-ink: #F79A9A;
  --shadow: 0 1px 0 rgba(0,0,0,.2), 0 12px 30px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.8);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::selection { background: var(--gate-bg); }
.mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; letter-spacing: -.01em; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-2); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; letter-spacing: .02em; }
.upper { text-transform: uppercase; letter-spacing: .09em; font-size: 11px; font-weight: 600; }
.serif { font-family: var(--font-display); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2.5px solid var(--client); outline-offset: 2px; border-radius: 6px; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; height: 100dvh; overflow-y: auto;
  background:
    linear-gradient(180deg, var(--spine-2), var(--spine));
  color: var(--spine-ink);
  padding: 12px 10px 18px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent;
}
/* the hand stitching down the spine */
.sidebar::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px;
  background: rgba(255,255,255,.07); pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 6px 12px; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-name { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.brand-sub { font-size: 10px; color: var(--spine-dim); letter-spacing: .12em; text-transform: uppercase; margin-top: 3px; }
.firm-chip {
  margin: 0 2px 10px; padding: 7px 9px; border-radius: 9px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.07);
  font-size: 11.5px; line-height: 1.3;
}
.firm-chip b { display: block; font-size: 12.5px; color: #fff; font-weight: 600; }
.nav-group { margin: 10px 0 2px; padding: 0 8px; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--spine-dim); opacity: .75; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 5px 8px; margin: 1px 0;
  border-radius: 7px; text-decoration: none; color: var(--spine-ink); font-size: 13px;
  transition: background .2s var(--ease), transform .2s var(--ease);
  position: relative;
}
.nav a svg { width: 16px; height: 16px; opacity: .78; flex: none; }
.nav a:hover { background: rgba(255,255,255,.07); }
.nav a:active { transform: scale(.98); }
.nav a.active { background: rgba(243,230,211,.14); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--gold); }
.nav a.active svg { opacity: 1; }
.nav .count {
  margin-left: auto; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 700; font-family: var(--font-mono);
  background: rgba(255,255,255,.1); color: var(--spine-ink);
}
.nav .count.gate { background: #6F58B8; color: #fff; }
.nav .count.bad { background: #C94A4A; color: #fff; }
.nav a.locked { opacity: .42; }
.sidebar-foot { margin: 14px 4px 0; padding-top: 10px; border-top: 1px dashed rgba(255,255,255,.14); font-size: 11px; color: var(--spine-dim); line-height: 1.4; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* frosted top bar */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 18px; min-height: 50px;
  background: var(--glass);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--line);
}
.icon-btn.menu-btn { display: none; }
.search {
  flex: 1; max-width: 440px; display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 9px; background: var(--paper-2); border: 1px solid transparent;
  color: var(--ink-3); cursor: text; font-size: 13px; transition: border-color .2s; white-space: nowrap; overflow: hidden; min-width: 0;
}
.search .ph { overflow: hidden; text-overflow: ellipsis; }
.search svg { width: 16px; height: 16px; flex: none; }
.search:hover { border-color: var(--line-2); }
.search kbd { margin-left: auto; }
kbd {
  font: 600 10.5px var(--font-mono); padding: 1.5px 5px; border-radius: 5px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2);
}
.topbar .spacer { flex: 1; }
.pulse-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line); background: var(--card);
}
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot.live { background: var(--agent); box-shadow: 0 0 0 0 var(--agent); animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(14,124,134,.55); } 80%,100% { box-shadow: 0 0 0 9px rgba(14,124,134,0); } }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; cursor: pointer; position: relative; color: var(--ink-2);
  transition: transform .15s var(--ease), background .2s;
}
.icon-btn:hover { background: var(--card-2); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .badge-dot { position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--card); }
.persona {
  display: flex; align-items: center; gap: 8px; padding: 2px 10px 2px 2px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; transition: background .2s;
}
.persona:hover { background: var(--card-2); }
.persona .who { line-height: 1.15; font-size: 12px; }
.persona .who small { display: block; color: var(--ink-3); font-size: 10.5px; }

.view { padding: 14px 18px 48px; max-width: 1680px; width: 100%; animation: viewIn .45s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- page head with ledger ruling ---------- */
.page-head {
  position: relative; margin: -14px -18px 12px; padding: 14px 18px 12px;
  background-image:
    linear-gradient(90deg, transparent 22px, var(--line-2) 22px, var(--line-2) 23px, transparent 23px, transparent 26px, var(--line-2) 26px, var(--line-2) 27px, transparent 27px),
    repeating-linear-gradient(180deg, transparent 0 27px, var(--rule) 27px 28px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
}
.page-head .eyebrow { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 3px; padding-left: 14px; }
.page-head h1 { margin: 0; font: 600 25px/1.1 var(--font-display); letter-spacing: -.02em; padding-left: 14px; }
.page-head h1 em { font-style: italic; font-weight: 400; color: var(--ink-2); }
.page-head p.lede { margin: 4px 0 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.4; max-width: 760px; padding-left: 14px; }
.page-head .actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 35px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: 13px; cursor: pointer;
  transition: transform .15s var(--ease), background .2s, box-shadow .2s, border-color .2s; white-space: nowrap; text-decoration: none;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--card-2); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.gate { background: var(--gate); border-color: var(--gate); color: #fff; }
.btn.agent { background: var(--agent); border-color: var(--agent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--paper-2); box-shadow: none; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; gap: 4px; }
.btn.xs { height: 23px; padding: 0 7px; font-size: 11px; border-radius: 6px; gap: 3px; }
.btn.xs svg { width: 13px; height: 13px; }
.btn[disabled], .btn.is-locked { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }

/* segmented control */
.seg { display: inline-flex; padding: 2.5px; border-radius: 10px; background: var(--paper-2); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 4px 10px; border-radius: 7px; font-size: 12px; font-weight: 600;
  color: var(--ink-2); cursor: pointer; transition: all .25s var(--spring); white-space: nowrap;
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button .n { font-family: var(--font-mono); font-size: 10.5px; opacity: .7; margin-left: 3px; }

/* ---------- cards & grid ---------- */
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.span2 { grid-column: span 2; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-sm); min-width: 0;
}
.card.pad { padding: 12px 14px; }
.card-h { display: flex; align-items: center; gap: 8px; padding: 9px 14px 7px; border-bottom: 1px solid var(--line); }
.card-h h3 { margin: 0; font: 600 14.5px/1.2 var(--font-body); letter-spacing: -.01em; }
.card-h h3 small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }
.card-h .right { margin-left: auto; display: flex; gap: 5px; align-items: center; }
.card-b { padding: 11px 14px; }
.card-b.flush { padding: 0; }
.card.hoverable { transition: transform .25s var(--spring), box-shadow .25s; cursor: pointer; }
.card.hoverable:hover { transform: translateY(-1.5px); box-shadow: var(--shadow); }

/* KPI tiles */
.kpi { padding: 11px 13px; position: relative; overflow: hidden; }
.kpi .label { font-size: 11.5px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .value { font: 600 24px/1.1 var(--font-display); letter-spacing: -.02em; margin-top: 4px; }
.kpi .value small { font: 500 12.5px var(--font-body); color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }
.kpi .foot { font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.kpi .spark { position: absolute; right: 10px; bottom: 8px; opacity: .85; }
.kpi.accent-agent { border-top: 3px solid var(--agent); }
.kpi.accent-gate { border-top: 3px solid var(--gate); }
.kpi.accent-client { border-top: 3px solid var(--client); }
.kpi.accent-ok { border-top: 3px solid var(--ok); }
.kpi.accent-warn { border-top: 3px solid var(--warn); }
.kpi.accent-bad { border-top: 3px solid var(--bad); }
.kpi.accent-code { border-top: 3px solid var(--code); }
.kpi.accent-ink { border-top: 3px solid var(--ink); }

/* ---------- chips, tags, the colour language ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--paper-2); color: var(--ink-2); border: 1px solid transparent;
}
.chip svg { width: 13px; height: 13px; }
.chip.agent { background: var(--agent-bg); color: var(--agent-ink); }
.chip.client { background: var(--client-bg); color: var(--client-ink); }
.chip.gate { background: var(--gate-bg); color: var(--gate-ink); }
.chip.code { background: var(--code-bg); color: var(--code-ink); }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
.chip.bad { background: var(--bad-bg); color: var(--bad-ink); }
.chip.outline { background: transparent; border-color: var(--line-2); }
.chip .dot { width: 6px; height: 6px; }

/* actor glyphs — shape AND colour, so the code survives colour-blindness */
.glyph { display: inline-grid; place-items: center; flex: none; font: 700 9.5px/1 var(--font-mono); letter-spacing: -.02em; color: #fff; }
.glyph.agent { width: 34px; height: 30px; background: var(--agent); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.glyph.gate {
  width: 32px; height: 32px; border-radius: 50%; background: var(--gate);
  box-shadow: inset 0 0 0 2px var(--card), inset 0 0 0 3.5px color-mix(in srgb, var(--gate) 60%, white);
}
.glyph.client { width: 30px; height: 30px; border-radius: 50%; background: var(--client); }
.glyph.code { width: 28px; height: 28px; border-radius: 7px; background: var(--code); }
.glyph.sm { transform: scale(.78); }

/* rubber stamp */
.stamp {
  display: inline-block; padding: 3px 10px; border: 2px solid currentColor; border-radius: 6px;
  font: 700 11px/1.2 var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
  transform: rotate(-4deg); opacity: .9; mix-blend-mode: multiply;
}
[data-theme="dark"] .stamp { mix-blend-mode: normal; }
.stamp.gate { color: var(--gate); } .stamp.ok { color: var(--ok); } .stamp.bad { color: var(--bad); } .stamp.agent { color: var(--agent); }
.stamp.big { font-size: 15px; padding: 6px 14px; border-width: 3px; }

/* avatars */
.av {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font: 700 12px var(--font-body); color: #fff; letter-spacing: .02em;
}
.av.lg { width: 44px; height: 44px; font-size: 15px; }
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.av-stack { display: inline-flex; } .av-stack .av { border: 2px solid var(--card); margin-left: -8px; } .av-stack .av:first-child { margin-left: 0; }

/* meter */
.meter { height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; position: relative; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--agent); transition: width .8s var(--ease); }
.meter.ok > i { background: var(--ok); } .meter.ink > i { background: var(--ink-3); } .meter.warn > i { background: var(--warn); } .meter.bad > i { background: var(--bad); } .meter.gate > i { background: var(--gate); } .meter.client > i { background: var(--client); }
.meter.thick { height: 12px; }
.meter .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3); padding: 7px 11px; border-bottom: 1px solid var(--line); background: var(--card-2); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.t td { padding: 7.5px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .15s; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr:hover { background: var(--card-2); }
table.t td.r, table.t th.r { text-align: right; }
table.t .sub { display: block; font-size: 11.5px; color: var(--ink-3); }
table.t tr.sel { background: var(--gate-bg); }

/* list rows (iOS-ish grouped list) */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 10px; padding: 7.5px 14px; border-bottom: 1px solid var(--line);
  transition: background .15s; min-height: 44px;
}
.row:last-child { border-bottom: 0; }
.row.click { cursor: pointer; }
.row.click:hover { background: var(--card-2); }
.row .grow { flex: 1; min-width: 0; }
.row .t1 { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .t2 { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .chev { color: var(--ink-3); width: 15px; height: 15px; flex: none; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
  height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--card);
  outline: none; transition: border-color .2s, box-shadow .2s; width: 100%; font-size: 13px;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 64px; }
.input:focus { border-color: var(--client); box-shadow: 0 0 0 3px var(--client-bg); }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, background .2s; font-size: 13px; }
.check:hover { border-color: var(--line-2); }
.check input { accent-color: var(--gate); width: 16px; height: 16px; margin-top: 1px; flex: none; }
.check.on { border-color: var(--gate); background: var(--gate-bg); }

/* iOS-style switch, our own colours */
.switch { position: relative; width: 42px; height: 25px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background .25s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.22); transition: transform .35s var(--spring); }
.switch input:checked + span { background: var(--agent); }
.switch input:checked + span::after { transform: translateX(17px); }
.switch.gate input:checked + span { background: var(--gate); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 7px 12px 9px; font-weight: 600; font-size: 13px; color: var(--ink-3);
  cursor: pointer; position: relative; white-space: nowrap;
}
.tabs button.on { color: var(--ink); }
.tabs button.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2.5px; border-radius: 3px 3px 0 0; background: var(--ink); }

/* ---------- kanban: the line ---------- */
.lanes { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.lane { background: var(--paper-2); border-radius: var(--r); border: 1px solid var(--line); min-height: 180px; display: flex; flex-direction: column; max-height: calc(100vh - 195px); }
.lane-h { padding: 8px 10px 7px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.lane-h b { font-size: 12.5px; }
.lane-h .n { margin-left: auto; font: 600 11.5px var(--font-mono); color: var(--ink-3); }
.lane-h .holder { font-size: 10.5px; color: var(--ink-3); display: block; font-weight: 500; }
.lane-body { padding: 7px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; }
.lane.drop-ok { outline: 2px dashed var(--agent); outline-offset: -3px; }
.lane.drop-no { outline: 2px dashed var(--bad); outline-offset: -3px; }
.ob-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; cursor: grab;
  box-shadow: var(--shadow-sm); transition: transform .2s var(--spring), box-shadow .2s; position: relative; border-left: 3.5px solid var(--code);
}
.ob-card:hover { transform: translateY(-1.5px); box-shadow: var(--shadow); }
.ob-card.dragging { opacity: .5; transform: rotate(2deg); }
.ob-card .f { font-weight: 700; font-size: 13px; display: flex; gap: 5px; align-items: center; }
.ob-card .nm { font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.ob-card .c { font-size: 12px; color: var(--ink-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-card .m { display: flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 11px; color: var(--ink-3); }
.ob-card .m .due { margin-left: auto; font-family: var(--font-mono); font-weight: 600; }
.ob-card.h-agent { border-left-color: var(--agent); }
.ob-card.h-client { border-left-color: var(--client); }
.ob-card.h-gate { border-left-color: var(--gate); }
.ob-card.h-ok { border-left-color: var(--ok); }
.ob-card.late { box-shadow: 0 0 0 1.5px var(--bad), var(--shadow-sm); }
.ob-card.soon { box-shadow: 0 0 0 1.5px var(--warn), var(--shadow-sm); }
.due.bad { color: var(--bad); } .due.warn { color: var(--warn-ink); } .due.ok { color: var(--ok-ink); }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; }
.cal .dow { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase; padding: 0 4px 2px; }
.cal .day {
  min-height: 84px; border-radius: 9px; background: var(--card); border: 1px solid var(--line); padding: 5px 6px;
  display: flex; flex-direction: column; gap: 3px; cursor: pointer; transition: transform .2s var(--spring), box-shadow .2s; position: relative; overflow: hidden;
}
.cal .day:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.cal .day.out { opacity: .38; }
.cal .day .dn { font: 600 12px var(--font-mono); display: flex; justify-content: space-between; align-items: center; }
.cal .day.today { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.cal .day.today .dn b { background: var(--ink); color: var(--paper); border-radius: 5px; padding: 0 5px; }
.cal .day.peak::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2.5px; background: repeating-linear-gradient(90deg, var(--bad) 0 6px, transparent 6px 10px); }
.cal .pill { font-size: 10.5px; font-weight: 600; padding: 1.5px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--paper-2); color: var(--ink-2); }
.cal .pill.agent { background: var(--agent-bg); color: var(--agent-ink); }
.cal .pill.client { background: var(--client-bg); color: var(--client-ink); }
.cal .pill.gate { background: var(--gate-bg); color: var(--gate-ink); }
.cal .pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.cal .pill.bad { background: var(--bad-bg); color: var(--bad-ink); }
.cal .more { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }
.heat { display: flex; gap: 3px; }

/* ---------- sheets (iOS-like but ours) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(18, 14, 10, .38); backdrop-filter: blur(3px); z-index: 60; opacity: 0; transition: opacity .3s; }
.scrim.show { opacity: 1; }
.sheet {
  position: fixed; z-index: 61; top: 10px; right: 10px; bottom: 10px; width: min(620px, calc(100vw - 20px));
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  display: flex; flex-direction: column; transform: translateX(110%); transition: transform .45s var(--spring);
}
.sheet.show { transform: none; }
.sheet.wide { width: min(880px, calc(100vw - 20px)); }
.sheet-h { padding: 14px 18px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.sheet-h h2 { margin: 0; font: 600 20px/1.15 var(--font-display); letter-spacing: -.02em; }
.sheet-h .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 3px; }
.sheet-h .x { margin-left: auto; }
.sheet-b { padding: 14px 18px; overflow-y: auto; flex: 1; }
.sheet-f { padding: 10px 18px; border-top: 1px solid var(--line); display: flex; gap: 6px; justify-content: flex-end; align-items: center; background: var(--card-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.grabber { display: none; }

.modal {
  position: fixed; z-index: 70; left: 50%; top: 50%; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto;
  transform: translate(-50%, -46%) scale(.96); opacity: 0; transition: transform .45s var(--spring), opacity .25s;
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--line);
}
.modal.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.sheet.show ~ .modal.show { box-shadow: 0 0 0 100vmax rgba(18, 14, 10, .32), var(--shadow-lg); }
.modal.wide { width: min(760px, calc(100vw - 32px)); }
.modal-b { padding: 18px 20px; }
.modal h2 { margin: 0 0 4px; font: 600 20px/1.2 var(--font-display); letter-spacing: -.02em; }

/* command palette */
.palette { top: 12vh; transform: translate(-50%, 0) scale(.97); width: min(640px, calc(100vw - 32px)); }
.palette.show { transform: translate(-50%, 0) scale(1); }
.palette input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 17px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.palette .results { max-height: 52vh; overflow-y: auto; padding: 4px; }
.palette .res { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.palette .res.on, .palette .res:hover { background: var(--paper-2); }
.palette .res .k { margin-left: auto; font-size: 11px; color: var(--ink-3); }
.palette .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); padding: 8px 10px 3px; font-weight: 700; }

/* toasts */
.toasts { position: fixed; z-index: 90; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 11px 16px 11px 12px; border-radius: 16px;
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lg); font-size: 14px; max-width: min(560px, calc(100vw - 32px));
  animation: toastIn .5s var(--spring);
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .ti { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.toast .ti svg { width: 16px; height: 16px; color: #fff; }
@keyframes toastIn { from { transform: translateY(30px) scale(.9); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(20px) scale(.95); opacity: 0; } }

/* live feed */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 11px; padding: 10px 18px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.feed-item.new { animation: feedIn .7s var(--spring); background: linear-gradient(90deg, var(--agent-bg), transparent 70%); }
@keyframes feedIn { from { opacity: 0; transform: translateY(-10px); } }
.feed-item .body { flex: 1; min-width: 0; font-size: 13.5px; }
.feed-item .body b { font-weight: 600; }
.feed-item .time { font: 500 11.5px var(--font-mono); color: var(--ink-3); white-space: nowrap; }

/* steps / timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 0 0 16px; }
.tl::before { content: ""; position: absolute; left: -19px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2.5px solid var(--code); }
.tl.agent::before { border-color: var(--agent); } .tl.gate::before { border-color: var(--gate); background: var(--gate); }
.tl.client::before { border-color: var(--client); } .tl.ok::before { border-color: var(--ok); background: var(--ok); }
.tl.bad::before { border-color: var(--bad); }
.tl .tt { font-size: 13.5px; font-weight: 600; }
.tl .td { font-size: 12.5px; color: var(--ink-3); }

/* stepper (state machine) */
.stepper { display: flex; gap: 4px; margin: 6px 0 4px; }
.stepper i { flex: 1; height: 6px; border-radius: 4px; background: var(--paper-2); }
.stepper i.done { background: var(--ok); } .stepper i.cur-agent { background: var(--agent); } .stepper i.cur-gate { background: var(--gate); } .stepper i.cur-client { background: var(--client); } .stepper i.cur-code { background: var(--code); }

/* callouts */
.callout { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); font-size: 13px; align-items: flex-start; }
.callout svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.callout.gate { background: var(--gate-bg); border-color: color-mix(in srgb, var(--gate) 30%, transparent); color: var(--gate-ink); }
.callout.agent { background: var(--agent-bg); border-color: color-mix(in srgb, var(--agent) 30%, transparent); color: var(--agent-ink); }
.callout.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad-ink); }
.callout.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn-ink); }
.callout.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok-ink); }
.callout.client { background: var(--client-bg); border-color: color-mix(in srgb, var(--client) 30%, transparent); color: var(--client-ink); }
.callout b { color: inherit; }

/* hero (Today) */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r); padding: 14px 18px; color: #F2F0EB;
  background:
    radial-gradient(80% 120% at 100% 0%, rgba(217,164,65,.28), transparent 55%),
    radial-gradient(60% 90% at 0% 100%, rgba(14,124,134,.35), transparent 60%),
    linear-gradient(135deg, #1D222B, #161A21 55%, #111318);
  box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, transparent 0 27px, rgba(255,255,255,.035) 27px 28px); pointer-events: none; }
.hero h2 { margin: 0; font: 500 22px/1.15 var(--font-display); letter-spacing: -.02em; }
.hero h2 em { color: var(--gold); font-style: italic; }
.hero p { margin: 4px 0 0; color: #C9CCD2; font-size: 13px; line-height: 1.4; max-width: 660px; }
.hero .hero-stats { display: flex; gap: 18px; margin-top: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero .hs b { display: block; font: 600 22px/1 var(--font-display); color: #fff; }
.hero .hs span { font-size: 11px; color: #A3A8B1; letter-spacing: .03em; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; }
.hero > .hero-copy { grid-column: 1; grid-row: 1; }
.hero .clock { position: relative; grid-column: 2; grid-row: 1; text-align: right; z-index: 1; white-space: nowrap; }
.hero .hero-stats { grid-column: 1 / -1; }
@media (max-width: 1100px) { .hero { grid-template-columns: 1fr; } .hero .clock { grid-column: 1; grid-row: 2; text-align: left; margin-top: 10px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; } .hero .clock div { font-size: 24px; } }
.hero .clock b { font: 600 11.5px var(--font-mono); color: var(--gold); letter-spacing: .08em; }
.hero .clock div { font: 500 28px/1 var(--font-display); color: #fff; }

/* day strip */
.daystrip { display: grid; grid-template-columns: repeat(31, minmax(0, 1fr)); gap: 2.5px; align-items: end; height: 56px; }
.daystrip i { display: block; border-radius: 2px 2px 1px 1px; background: var(--line-2); min-height: 3px; position: relative; }
.daystrip i.peak { background: var(--bad); } .daystrip i.today { background: var(--ink); } .daystrip i.past { opacity: .45; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11.5px; color: var(--ink-2); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* drop zone */
.drop {
  border: 2px dashed var(--line-2); border-radius: var(--r-lg); padding: 18px; text-align: center; transition: all .25s var(--ease);
  background: repeating-linear-gradient(-45deg, transparent 0 12px, rgba(14,124,134,.03) 12px 24px);
}
.drop.over { border-color: var(--agent); background: var(--agent-bg); transform: scale(1.01); }
.drop svg { width: 28px; height: 28px; color: var(--agent); }

/* pipeline progress */
.pipe { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.pipe .ps { font-size: 11px; font-weight: 600; padding: 2.5px 7px; border-radius: 6px; background: var(--paper-2); color: var(--ink-3); transition: all .3s; }
.pipe .ps.done { background: var(--agent-bg); color: var(--agent-ink); }
.pipe .ps.run { background: var(--agent); color: #fff; animation: breathe 1s infinite; }
.pipe .ps.gate { background: var(--gate); color: #fff; }
@keyframes breathe { 50% { opacity: .65; } }

/* PIN pad */
.shake { animation: shake .45s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

/* signature seal animation */

/* matrix */
.matrix td.cell { text-align: center; }
.mx { width: 24px; height: 24px; border-radius: 7px; display: inline-grid; place-items: center; cursor: pointer; border: 1px solid var(--line-2); background: var(--card); transition: all .2s var(--spring); }
.mx svg { width: 14px; height: 14px; }
.mx.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.mx.gate { background: var(--gate); border-color: var(--gate); color: #fff; }
.mx.never { background: var(--bad-bg); border-color: transparent; color: var(--bad); cursor: not-allowed; }
.mx.lock { cursor: not-allowed; }

/* bars chart */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 8px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bars .b i { width: 100%; max-width: 40px; border-radius: 6px 6px 2px 2px; display: block; transition: height .8s var(--ease); }
.bars .b span { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.bars .b em { font: 600 11px var(--font-mono); font-style: normal; color: var(--ink-2); }

/* catalogue */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.cat-item { padding: 11px 13px; display: flex; flex-direction: column; gap: 6px; }
.cat-item .form { font: 700 12.5px var(--font-mono); color: var(--ink); }
.cat-item .nm { font-size: 13px; font-weight: 600; line-height: 1.3; }
.cat-item .meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }

/* misc */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; font-weight: 500; }
.hr { height: 1px; background: var(--line); margin: 10px 0; border: 0; }
.flex { display: flex; gap: 8px; align-items: center; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .col { flex-direction: column; align-items: stretch; }
.mt8 { margin-top: 6px; } .mt12 { margin-top: 9px; } .mt16 { margin-top: 12px; } .mt24 { margin-top: 16px; } .mb8 { margin-bottom: 6px; } .mb16 { margin-bottom: 12px; }
.empty { padding: 24px 16px; text-align: center; color: var(--ink-3); }
.empty svg { width: 34px; height: 34px; opacity: .5; }
.bubble { max-width: 78%; padding: 7px 11px; border-radius: 14px; font-size: 13px; line-height: 1.4; }
.bubble.in { background: var(--paper-2); border-bottom-left-radius: 4px; align-self: flex-start; }
.bubble.out { background: var(--agent); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.bubble.staff { background: var(--client); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.bubble.route { background: var(--gate-bg); color: var(--gate-ink); align-self: center; font-size: 11.5px; border-radius: 8px; text-align: center; }
.chat { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.hash { font: 500 10.5px var(--font-mono); color: var(--ink-3); }
.blur { filter: blur(5px); user-select: none; }
.ring { --p: 60; --c: var(--agent); width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--paper-2) 0); position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--card); }
.ring b { position: relative; font: 600 21px var(--font-display); }
.ring.sm { width: 56px; height: 56px; } .ring.sm::before { inset: 6px; } .ring.sm b { font-size: 14px; }
.watermark { position: fixed; bottom: 6px; right: 10px; font: 500 10px var(--font-mono); color: var(--ink-3); opacity: .7; pointer-events: none; z-index: 5; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) { #peak-pill { display: none; } }
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; padding-top: calc(18px + env(safe-area-inset-top, 0px)); z-index: 80; width: 280px; transform: translateX(-100%); transition: transform .45s var(--spring); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .icon-btn.menu-btn { display: grid; }
  .g3 { grid-template-columns: 1fr 1fr; }
  .persona .who { display: none; }
  .pulse-pill.hide-sm { display: none; }
}
@media (max-width: 680px) {
  .topbar { padding: 8px 16px; gap: 8px; }
  .view { padding: 20px 16px 80px; }
  .page-head { margin: -20px -16px 18px; padding: 22px 16px 18px; }
  .page-head h1 { font-size: 27px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .search span.ph { display: none; } .search kbd { display: none; } .search { flex: 0 0 auto; padding: 9px 11px; }
  .hero .clock { position: static; text-align: left; margin-bottom: 10px; }
  .hero h2 { font-size: 24px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv dd { margin-bottom: 8px; }
  /* sheets become bottom sheets on phones */
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 92vh; border-radius: 22px 22px 0 0; transform: translateY(105%); }
  .sheet.wide { width: 100%; }
  .sheet-f { flex-wrap: wrap; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); } .sheet-f > span.small, .sheet-f > label.small { display: none; }
  .grabber { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; }
  .cal .day { min-height: 64px; } .cal .pill { display: none; } .cal .day .heat { display: flex; }
  .lanes { grid-auto-columns: 84%; scroll-snap-type: x mandatory; } .lane { scroll-snap-align: start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- client app preview (phone) ---------- */
.phone { width: 300px; max-width: 100%; margin: 0 auto; border-radius: 42px; padding: 11px; background: linear-gradient(160deg, #2a2d35, #0f1115); box-shadow: var(--shadow-lg), inset 0 0 0 1.5px rgba(255,255,255,.08); position: relative; }
.phone-notch { position: absolute; top: 17px; left: 50%; transform: translateX(-50%); width: 92px; height: 24px; border-radius: 14px; background: #0b0c0f; z-index: 2; }
.phone-screen { background: var(--paper); border-radius: 32px; padding: 46px 14px 18px; height: 590px; overflow-y: auto; scrollbar-width: none; }
.phone-screen::-webkit-scrollbar { display: none; }
.phone-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 11px 13px; margin-top: 8px; gap: 8px; }


.desk-grid { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
@media (max-width: 900px) { .desk-grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Textures & the third coding channel (added in review 2)
   Hue = who holds it · red/amber/green = how late · TEXTURE = which law.
   Background textures come from the subject: paper grain, the woven bahi
   cover, stamp-paper guilloche, inked rubber stamps, the agents' honeycomb.
   ========================================================================== */
:root {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .30  0 0 0 0 .22  0 0 0 0 .12  0 0 0 .9 -.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.38'/%3E%3C/svg%3E");
  --hexes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='48'%3E%3Cpath d='M14 0l14 8v16l-14 8l-14-8V8zM14 32v16' fill='none' stroke='rgba(14,124,134,.13)' stroke-width='1'/%3E%3C/svg%3E");
  --speckle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='1' stitchTiles='stitch'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='1 1 1 1 1 0 1 1 1 1 0 1'/%3E%3C/feComponentTransfer%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
  --guilloche: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='48'%3E%3Cpath d='M0 24 C20 4 60 4 80 24 S140 44 160 24 M0 -24 C20 -44 60 -44 80 -24 S140 -4 160 -24 M0 72 C20 52 60 52 80 72 S140 92 160 72 M0 24 C20 44 60 44 80 24 S140 4 160 24 M0 -24 C20 -4 60 -4 80 -24 S140 -44 160 -24 M0 72 C20 92 60 92 80 72 S140 52 160 72 M0 32 C20 12 60 12 80 32 S140 52 160 32 M0 -16 C20 -36 60 -36 80 -16 S140 4 160 -16 M0 80 C20 60 60 60 80 80 S140 100 160 80 M0 32 C20 52 60 52 80 32 S140 12 160 32 M0 -16 C20 4 60 4 80 -16 S140 -36 160 -16 M0 80 C20 100 60 100 80 80 S140 60 160 80 M0 40 C20 20 60 20 80 40 S140 60 160 40 M0 -8 C20 -28 60 -28 80 -8 S140 12 160 -8 M0 88 C20 68 60 68 80 88 S140 108 160 88 M0 40 C20 60 60 60 80 40 S140 20 160 40 M0 -8 C20 12 60 12 80 -8 S140 -28 160 -8 M0 88 C20 108 60 108 80 88 S140 68 160 88 M0 48 C20 28 60 28 80 48 S140 68 160 48 M0 0 C20 -20 60 -20 80 0 S140 20 160 0 M0 96 C20 76 60 76 80 96 S140 116 160 96 M0 48 C20 68 60 68 80 48 S140 28 160 48 M0 0 C20 20 60 20 80 0 S140 -20 160 0 M0 96 C20 116 60 116 80 96 S140 76 160 96 M0 56 C20 36 60 36 80 56 S140 76 160 56 M0 8 C20 -12 60 -12 80 8 S140 28 160 8 M0 104 C20 84 60 84 80 104 S140 124 160 104 M0 56 C20 76 60 76 80 56 S140 36 160 56 M0 8 C20 28 60 28 80 8 S140 -12 160 8 M0 104 C20 124 60 124 80 104 S140 84 160 104 M0 64 C20 44 60 44 80 64 S140 84 160 64 M0 16 C20 -4 60 -4 80 16 S140 36 160 16 M0 112 C20 92 60 92 80 112 S140 132 160 112 M0 64 C20 84 60 84 80 64 S140 44 160 64 M0 16 C20 36 60 36 80 16 S140 -4 160 16 M0 112 C20 132 60 132 80 112 S140 92 160 112' fill='none' stroke='%23BFA472' stroke-opacity='.3' stroke-width='.55'/%3E%3C/svg%3E");
  --guilloche-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='48'%3E%3Cpath d='M0 24 C20 4 60 4 80 24 S140 44 160 24 M0 -24 C20 -44 60 -44 80 -24 S140 -4 160 -24 M0 72 C20 52 60 52 80 72 S140 92 160 72 M0 24 C20 44 60 44 80 24 S140 4 160 24 M0 -24 C20 -4 60 -4 80 -24 S140 -44 160 -24 M0 72 C20 92 60 92 80 72 S140 52 160 72 M0 32 C20 12 60 12 80 32 S140 52 160 32 M0 -16 C20 -36 60 -36 80 -16 S140 4 160 -16 M0 80 C20 60 60 60 80 80 S140 100 160 80 M0 32 C20 52 60 52 80 32 S140 12 160 32 M0 -16 C20 4 60 4 80 -16 S140 -36 160 -16 M0 80 C20 100 60 100 80 80 S140 60 160 80 M0 40 C20 20 60 20 80 40 S140 60 160 40 M0 -8 C20 -28 60 -28 80 -8 S140 12 160 -8 M0 88 C20 68 60 68 80 88 S140 108 160 88 M0 40 C20 60 60 60 80 40 S140 20 160 40 M0 -8 C20 12 60 12 80 -8 S140 -28 160 -8 M0 88 C20 108 60 108 80 88 S140 68 160 88 M0 48 C20 28 60 28 80 48 S140 68 160 48 M0 0 C20 -20 60 -20 80 0 S140 20 160 0 M0 96 C20 76 60 76 80 96 S140 116 160 96 M0 48 C20 68 60 68 80 48 S140 28 160 48 M0 0 C20 20 60 20 80 0 S140 -20 160 0 M0 96 C20 116 60 116 80 96 S140 76 160 96 M0 56 C20 36 60 36 80 56 S140 76 160 56 M0 8 C20 -12 60 -12 80 8 S140 28 160 8 M0 104 C20 84 60 84 80 104 S140 124 160 104 M0 56 C20 76 60 76 80 56 S140 36 160 56 M0 8 C20 28 60 28 80 8 S140 -12 160 8 M0 104 C20 124 60 124 80 104 S140 84 160 104 M0 64 C20 44 60 44 80 64 S140 84 160 64 M0 16 C20 -4 60 -4 80 16 S140 36 160 16 M0 112 C20 92 60 92 80 112 S140 132 160 112 M0 64 C20 84 60 84 80 64 S140 44 160 64 M0 16 C20 36 60 36 80 16 S140 -4 160 16 M0 112 C20 132 60 132 80 112 S140 92 160 112' fill='none' stroke='%237C5A2E' stroke-opacity='.22' stroke-width='.55'/%3E%3C/svg%3E");
  --rosette: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400' viewBox='0 0 400 400'%3E%3Cg fill='none' stroke='%23BFA472' stroke-opacity='.26' stroke-width='.7'%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(0.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(7.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(15.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(22.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(30.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(37.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(45.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(52.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(60.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(67.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(75.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(82.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(90.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(97.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(105.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(112.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(120.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(127.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(135.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(142.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(150.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(157.5 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(165.0 200 200)'/%3E%3Cellipse cx='200' cy='200' rx='188' ry='62' transform='rotate(172.5 200 200)'/%3E%3Ccircle cx='200' cy='200' r='40'/%3E%3Ccircle cx='200' cy='200' r='52'/%3E%3Ccircle cx='200' cy='200' r='64'/%3E%3Ccircle cx='200' cy='200' r='196'/%3E%3C/g%3E%3C/svg%3E");
  --tx-ink: rgba(27, 33, 48, .5);
  --cloth: repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(0,0,0,.10) 0 1px, transparent 1px 3px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 .96  0 0 0 0 .9  0 0 0 .9 -.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
    --hexes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='48'%3E%3Cpath d='M14 0l14 8v16l-14 8l-14-8V8zM14 32v16' fill='none' stroke='rgba(52,179,188,.12)' stroke-width='1'/%3E%3C/svg%3E");
    --guilloche-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='48'%3E%3Cpath d='M0 24 C20 4 60 4 80 24 S140 44 160 24 M0 -24 C20 -44 60 -44 80 -24 S140 -4 160 -24 M0 72 C20 52 60 52 80 72 S140 92 160 72 M0 24 C20 44 60 44 80 24 S140 4 160 24 M0 -24 C20 -4 60 -4 80 -24 S140 -44 160 -24 M0 72 C20 92 60 92 80 72 S140 52 160 72 M0 32 C20 12 60 12 80 32 S140 52 160 32 M0 -16 C20 -36 60 -36 80 -16 S140 4 160 -16 M0 80 C20 60 60 60 80 80 S140 100 160 80 M0 32 C20 52 60 52 80 32 S140 12 160 32 M0 -16 C20 4 60 4 80 -16 S140 -36 160 -16 M0 80 C20 100 60 100 80 80 S140 60 160 80 M0 40 C20 20 60 20 80 40 S140 60 160 40 M0 -8 C20 -28 60 -28 80 -8 S140 12 160 -8 M0 88 C20 68 60 68 80 88 S140 108 160 88 M0 40 C20 60 60 60 80 40 S140 20 160 40 M0 -8 C20 12 60 12 80 -8 S140 -28 160 -8 M0 88 C20 108 60 108 80 88 S140 68 160 88 M0 48 C20 28 60 28 80 48 S140 68 160 48 M0 0 C20 -20 60 -20 80 0 S140 20 160 0 M0 96 C20 76 60 76 80 96 S140 116 160 96 M0 48 C20 68 60 68 80 48 S140 28 160 48 M0 0 C20 20 60 20 80 0 S140 -20 160 0 M0 96 C20 116 60 116 80 96 S140 76 160 96 M0 56 C20 36 60 36 80 56 S140 76 160 56 M0 8 C20 -12 60 -12 80 8 S140 28 160 8 M0 104 C20 84 60 84 80 104 S140 124 160 104 M0 56 C20 76 60 76 80 56 S140 36 160 56 M0 8 C20 28 60 28 80 8 S140 -12 160 8 M0 104 C20 124 60 124 80 104 S140 84 160 104 M0 64 C20 44 60 44 80 64 S140 84 160 64 M0 16 C20 -4 60 -4 80 16 S140 36 160 16 M0 112 C20 92 60 92 80 112 S140 132 160 112 M0 64 C20 84 60 84 80 64 S140 44 160 64 M0 16 C20 36 60 36 80 16 S140 -4 160 16 M0 112 C20 132 60 132 80 112 S140 92 160 112' fill='none' stroke='%23BFA472' stroke-opacity='.14' stroke-width='.55'/%3E%3C/svg%3E");
    --tx-ink: rgba(239, 233, 222, .5);
  }
}
:root[data-theme="dark"] {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 .96  0 0 0 0 .9  0 0 0 .9 -.3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  --hexes: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='48'%3E%3Cpath d='M14 0l14 8v16l-14 8l-14-8V8zM14 32v16' fill='none' stroke='rgba(52,179,188,.12)' stroke-width='1'/%3E%3C/svg%3E");
  --guilloche-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='48'%3E%3Cpath d='M0 24 C20 4 60 4 80 24 S140 44 160 24 M0 -24 C20 -44 60 -44 80 -24 S140 -4 160 -24 M0 72 C20 52 60 52 80 72 S140 92 160 72 M0 24 C20 44 60 44 80 24 S140 4 160 24 M0 -24 C20 -4 60 -4 80 -24 S140 -44 160 -24 M0 72 C20 92 60 92 80 72 S140 52 160 72 M0 32 C20 12 60 12 80 32 S140 52 160 32 M0 -16 C20 -36 60 -36 80 -16 S140 4 160 -16 M0 80 C20 60 60 60 80 80 S140 100 160 80 M0 32 C20 52 60 52 80 32 S140 12 160 32 M0 -16 C20 4 60 4 80 -16 S140 -36 160 -16 M0 80 C20 100 60 100 80 80 S140 60 160 80 M0 40 C20 20 60 20 80 40 S140 60 160 40 M0 -8 C20 -28 60 -28 80 -8 S140 12 160 -8 M0 88 C20 68 60 68 80 88 S140 108 160 88 M0 40 C20 60 60 60 80 40 S140 20 160 40 M0 -8 C20 12 60 12 80 -8 S140 -28 160 -8 M0 88 C20 108 60 108 80 88 S140 68 160 88 M0 48 C20 28 60 28 80 48 S140 68 160 48 M0 0 C20 -20 60 -20 80 0 S140 20 160 0 M0 96 C20 76 60 76 80 96 S140 116 160 96 M0 48 C20 68 60 68 80 48 S140 28 160 48 M0 0 C20 20 60 20 80 0 S140 -20 160 0 M0 96 C20 116 60 116 80 96 S140 76 160 96 M0 56 C20 36 60 36 80 56 S140 76 160 56 M0 8 C20 -12 60 -12 80 8 S140 28 160 8 M0 104 C20 84 60 84 80 104 S140 124 160 104 M0 56 C20 76 60 76 80 56 S140 36 160 56 M0 8 C20 28 60 28 80 8 S140 -12 160 8 M0 104 C20 124 60 124 80 104 S140 84 160 104 M0 64 C20 44 60 44 80 64 S140 84 160 64 M0 16 C20 -4 60 -4 80 16 S140 36 160 16 M0 112 C20 92 60 92 80 112 S140 132 160 112 M0 64 C20 84 60 84 80 64 S140 44 160 64 M0 16 C20 36 60 36 80 16 S140 -4 160 16 M0 112 C20 132 60 132 80 112 S140 92 160 112' fill='none' stroke='%23BFA472' stroke-opacity='.14' stroke-width='.55'/%3E%3C/svg%3E");
  --tx-ink: rgba(239, 233, 222, .5);
}

/* ---------- grounds: paper, cloth, stamp paper, ink ---------- */
body { background-color: var(--paper); background-image: var(--grain); }
.sidebar { background-image: var(--cloth), linear-gradient(180deg, var(--spine-2), var(--spine)); }
.hero { background-image: var(--rosette), radial-gradient(70% 120% at 100% 0%, rgba(191,164,114,.10), transparent 60%), linear-gradient(135deg, #1D222B, #161A21 55%, #111318); background-repeat: no-repeat; background-position: right -90px center, 0 0, 0 0; background-size: 420px 420px, 100% 100%, 100% 100%; color: #F2F0EB; }
.hero::before { content: ""; position: absolute; inset: 0; background: var(--guilloche); opacity: .5; -webkit-mask-image: linear-gradient(100deg, transparent 35%, #000 80%); mask-image: linear-gradient(100deg, transparent 35%, #000 80%); pointer-events: none; }
.stamp { -webkit-mask-image: var(--speckle); mask-image: var(--speckle); -webkit-mask-size: 110px; mask-size: 110px; }
.callout.agent, .kpi.accent-agent { background-image: var(--hexes); }
.empty { background-image: repeating-linear-gradient(180deg, transparent 0 27px, var(--rule) 27px 28px); border-radius: var(--r); }
.page-head { background-color: transparent; }

/* ---------- lanes: the header tint says who holds every card below it ---------- */
.lane[data-h="client"] .lane-h { background: var(--client-bg); }
.lane[data-h="agent"] .lane-h { background: var(--agent-bg); }
.lane[data-h="gate"] .lane-h { background: var(--gate-bg); }
.lane[data-h="code"] .lane-h { background: var(--code-bg); }
.lane[data-h="ok"] .lane-h { background: var(--ok-bg); }
.lane .lane-h { border-radius: var(--r) var(--r) 0 0; }
.lane[data-h="agent"] .lane-body { background-image: var(--hexes); }

/* ---------- actor stripes on every activity line ---------- */
.feed-item { border-left: 3px solid transparent; }
.feed-item.k-agent { border-left-color: var(--agent); }
.feed-item.k-client { border-left-color: var(--client); }
.feed-item.k-code { border-left-color: var(--code); }
.feed-item.k-human { border-left-color: var(--line-2); }
table.t tr.k-agent td:first-child { box-shadow: inset 3px 0 var(--agent); }
table.t tr.k-client td:first-child { box-shadow: inset 3px 0 var(--client); }
table.t tr.k-code td:first-child { box-shadow: inset 3px 0 var(--code); }
table.t tr.k-human td:first-child { box-shadow: inset 3px 0 var(--line-2); }

/* ---------- texture = which law (the third channel, never a colour) ---------- */
.tx-gst { --tx: repeating-linear-gradient(45deg, var(--tx-ink) 0 1.4px, transparent 1.4px 5px); }
.tx-dt { --tx: radial-gradient(circle, var(--tx-ink) 1.1px, transparent 1.5px) 0 0 / 5px 5px; }
.tx-corp { --tx: linear-gradient(var(--tx-ink) 1px, transparent 1px) 0 0 / 5px 5px, linear-gradient(90deg, var(--tx-ink) 1px, transparent 1px) 0 0 / 5px 5px; }
.tx-lab { --tx: repeating-linear-gradient(45deg, var(--tx-ink) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, var(--tx-ink) 0 1px, transparent 1px 5px); }
.tx-books { --tx: repeating-linear-gradient(0deg, var(--tx-ink) 0 1.2px, transparent 1.2px 4.5px); }
.tx-assure { --tx: repeating-radial-gradient(circle at 50% 50%, var(--tx-ink) 0 1px, transparent 1px 3.5px); }
.tx-cross { --tx: linear-gradient(135deg, var(--tx-ink) 25%, transparent 25%) -2.5px 0 / 5px 5px, linear-gradient(225deg, var(--tx-ink) 25%, transparent 25%) -2.5px 0 / 5px 5px; }
.tx-misc { --tx: repeating-linear-gradient(90deg, var(--tx-ink) 0 1.2px, transparent 1.2px 4.5px); }
.dom { display: inline-flex; align-items: stretch; height: 22px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--card); overflow: hidden; flex: none; white-space: nowrap; vertical-align: middle; }
.dom i { width: 15px; background: var(--tx); border-right: 1px solid var(--line-2); }
.dom b { display: grid; place-items: center; padding: 0 7px; font: 700 10.5px/1 var(--font-mono); color: var(--ink-2); letter-spacing: .02em; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: var(--tx); border: 1px solid var(--line-2); vertical-align: -2px; margin-right: 6px; flex: none; }
.swatch.lg { width: 34px; height: 22px; border-radius: 6px; }
.ob-card .ftab { position: absolute; top: -1px; right: 14px; width: 34px; height: 8px; border-radius: 0 0 5px 5px; border: 1px solid var(--line-2); border-top: 0; background: var(--tx), var(--card-2); }
.cal .pill { position: relative; padding-left: 12px; }
.cal .pill::before { content: ""; position: absolute; left: 3px; top: 3px; bottom: 3px; width: 5px; border-radius: 2px; background: var(--tx, transparent); }
.cat-item.has-tx { position: relative; padding-top: 18px; }
.cat-item.has-tx::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 7px; border-radius: var(--r) var(--r) 0 0; background: var(--tx); border-bottom: 1px solid var(--line); }

/* ---------- command centre pieces ---------- */
.stack { display: flex; height: 8px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--paper-2); }
.stack i { display: block; min-width: 3px; }
.stack-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 7px; font-size: 11.5px; color: var(--ink-3); }
.stack-legend span { display: inline-flex; align-items: center; gap: 5px; } .stack-legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; } .stack-legend b { color: var(--ink); font-family: var(--font-mono); }
.linkbtn { border: 0; background: none; padding: 0; font: 600 13px var(--font-body); color: var(--client-ink); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.alert { border-radius: 14px; padding: 13px 15px; border: 1px solid var(--line); background: var(--card-2); display: grid; gap: 5px; }
.alert b { font-size: 14.5px; line-height: 1.3; } .alert p { margin: 0 0 4px; font-size: 13px; color: var(--ink-2); }
.alert-tag { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--ink-3); }
.alert-tag svg { width: 14px; height: 14px; }
.alert.a-gate { background: var(--gate-bg); border-color: color-mix(in srgb, var(--gate) 30%, transparent); } .alert.a-gate .alert-tag { color: var(--gate-ink); }
.alert.a-ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); } .alert.a-ok .alert-tag { color: var(--ok-ink); }
.alert.a-warn { border-left: 4px solid var(--warn); } .alert.a-warn .alert-tag { color: var(--warn-ink); }
.alert.a-bad { border-left: 4px solid var(--bad); } .alert.a-bad .alert-tag { color: var(--bad-ink); }
.alert.a-client { border-left: 4px solid var(--client); } .alert.a-client .alert-tag { color: var(--client-ink); }
.rw { display: grid; grid-template-columns: repeat(30, minmax(20px, 1fr)); gap: 3px; align-items: end; min-width: 680px; padding-top: 8px; }
.rw-col { border: 0; background: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative; font: inherit; color: inherit; }
.rw-col em { font: 600 11px var(--font-mono); font-style: normal; color: var(--ink-2); min-height: 12px; }
.rw-bar { display: block; width: 70%; max-width: 26px; border-radius: 5px 5px 2px 2px; transition: height .8s var(--ease), filter .2s; }
.rw-col:hover .rw-bar { filter: brightness(1.12); }
.rw-bar.soon { background: var(--warn); } .rw-bar.later { background: var(--ink-3); } .rw-bar.done { background: var(--ok); } .rw-bar.none { background: var(--line-2); }
.rw-d { font: 600 12px var(--font-mono); width: 24px; height: 22px; display: grid; place-items: center; border-radius: 6px; }
.rw-d.today { background: var(--ink); color: var(--paper); } .rw-d.peak { box-shadow: inset 0 -2px 0 var(--bad); }
.rw-w { font: 500 10px var(--font-mono); color: var(--ink-3); }
.rw-m { position: absolute; top: -14px; font: 700 9.5px var(--font-mono); color: var(--ink-3); letter-spacing: .08em; }
.dl-cards { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 240px); gap: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.dl-card { text-align: left; padding: 10px 12px; cursor: pointer; font: inherit; color: inherit; scroll-snap-align: start; transition: transform .25s var(--spring), box-shadow .25s; }
.dl-card:hover { transform: translateY(-1.5px); box-shadow: var(--shadow); }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 7px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); font: 600 12px var(--font-body); color: var(--ink-2); cursor: pointer; transition: all .2s var(--ease); white-space: nowrap; }
.fchip .mono { font-size: 11px; color: var(--ink-3); }
.fchip.on { background: var(--ink); border-color: var(--ink); color: var(--paper); } .fchip.on .mono { color: var(--paper); opacity: .7; }
.fchip svg { width: 14px; height: 14px; }
.fchip .swatch { margin-right: 0; }
.hide-md { } @media (max-width: 1100px) { .hide-md { display: none !important; } }
.icon-btn .bcount { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font: 700 10px var(--font-mono); display: grid; place-items: center; border: 1.5px solid var(--card); }

/* ---------- calendar ---------- */
.watch { border-radius: var(--r); padding: 12px 14px; border: 1px solid var(--line); background-color: var(--card); background-image: radial-gradient(var(--line-2) 1px, transparent 1.2px); background-size: 14px 14px; }
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.cal-side { position: sticky; top: 64px; max-height: calc(100vh - 84px); overflow-y: auto; }
.side-form { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card-2); }
.cal .day.sel { box-shadow: inset 0 0 0 2px var(--client); }
.cal .pill { display: flex; align-items: center; gap: 5px; }
.cal .pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.cal .pill b { font: 700 10px var(--font-mono); opacity: .8; }
.cal .pill.done { background: var(--ok-bg); color: var(--ok-ink); } .cal .pill.done span { text-decoration: line-through; opacity: .75; }
.cal .pill.cut { background: transparent; border: 1.5px dashed var(--ink-3); color: var(--ink-2); padding-left: 5px; } .cal .pill.cut::before { display: none; }
.cal .pill.firm { border-color: var(--client); color: var(--client-ink); }
@media (max-width: 1100px) { .cal-wrap { grid-template-columns: 1fr; } .cal-side { position: static; max-height: none; } }

/* ---------- board cards ---------- */
.ob-card .cname { font-weight: 700; font-size: 13px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-card .note { margin-top: 6px; padding: 5px 7px; border-radius: 7px; background: var(--warn-bg); color: var(--warn-ink); font-size: 11.5px; line-height: 1.3; }
.ob-card .m { padding-top: 6px; border-top: 1px solid var(--line); }
.ob-card .chip { height: 20px; font-size: 11px; padding: 0 7px; }

/* ---------- client portal: sign-in ---------- */
.portal-mode .sidebar, .portal-mode .topbar, .portal-mode .watermark, .portal-mode #refresh-pill { display: none !important; }
.portal-mode .app { grid-template-columns: 1fr; }
.portal-mode .view { padding: 0; max-width: none; }
.login { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.login-cover { position: relative; overflow: hidden; color: #F2F0EB; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background-image: var(--rosette), var(--guilloche), var(--cloth), radial-gradient(90% 70% at 100% 0%, rgba(191,164,114,.10), transparent 60%), linear-gradient(160deg, #1E232C, #15181E 60%, #0F1115);
  background-repeat: no-repeat, repeat, repeat, repeat, no-repeat, no-repeat; background-position: right -150px bottom -150px, 0 0, 0 0, 0 0, 0 0, 0 0; background-size: 580px 580px, auto, auto, auto, 100% 100%, 100% 100%; }
.login-cover::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.08); }
.lc-top { display: flex; gap: 12px; align-items: center; position: relative; }
.lc-top svg { width: 44px; height: 44px; }
.lc-top b { font: 600 21px var(--font-display); display: block; } .lc-top span { font-size: 12.5px; color: #A3A8B1; }
.lc-mid { position: relative; max-width: 520px; }
.lc-mid h1 { font: 500 clamp(36px, 4.4vw, 58px)/1.03 var(--font-display); letter-spacing: -.03em; margin: 12px 0 22px; text-wrap: balance; }
.lc-mid h1 em { color: var(--gold); }
.lc-mid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 11px; }
.lc-mid li { display: flex; gap: 11px; align-items: flex-start; color: #D3D6DB; }
.lc-mid li::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--gold); flex: none; margin-top: 2px; background: radial-gradient(circle, var(--gold) 3px, transparent 3.5px); }
.lc-foot { font-size: 12px; color: #8F949D; position: relative; }
.login-panel { display: grid; place-items: center; padding: 36px 24px; background-image: var(--guilloche-ink); }
.login-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 26px; box-shadow: var(--shadow); }
.login-card h2 { font: 600 28px/1.12 var(--font-display); letter-spacing: -.02em; margin: 14px 0 6px; text-wrap: balance; }
.phone-in { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 13px; overflow: hidden; background: var(--card); transition: border-color .2s, box-shadow .2s; }
.phone-in span { display: grid; place-items: center; padding: 0 13px; background: var(--paper-2); font: 600 15px var(--font-mono); color: var(--ink-2); border-right: 1px solid var(--line-2); }
.phone-in input { border: 0; outline: 0; flex: 1; height: 50px; padding: 0 14px; font: 500 18px var(--font-mono); letter-spacing: .06em; background: transparent; min-width: 0; }
.phone-in:focus-within { border-color: var(--client); box-shadow: 0 0 0 4px var(--client-bg); }
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 14px 0 10px; }
.otp input { height: 56px; text-align: center; font: 600 24px var(--font-mono); border: 1px solid var(--line-2); border-radius: 13px; background: var(--card); outline: none; min-width: 0; width: 100%; }
.otp input:focus { border-color: var(--client); box-shadow: 0 0 0 4px var(--client-bg); }
.demo-acc { display: grid; gap: 8px; }
.demo-acc button { display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 13px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font: inherit; color: inherit; transition: border-color .2s, background .2s; }
.demo-acc button:hover { border-color: var(--line-2); } .demo-acc button.on { border-color: var(--client); background: var(--client-bg); }
.btn.client { background: var(--client); border-color: var(--client); color: #fff; }
.btn.lg { height: 52px; font-size: 15.5px; border-radius: 14px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-cover { padding: 24px 20px 26px; gap: 18px; background-size: 360px 360px, auto, auto, auto, 100% 100%, 100% 100%; } .lc-mid h1 { font-size: 34px; margin-bottom: 10px; } .lc-mid ul, .lc-foot { display: none; } .login-panel { padding: 20px 16px 40px; } .login-card { padding: 20px; } }

/* ---------- client portal: the app ---------- */
.portal { min-height: 100vh; display: flex; flex-direction: column; }
.p-top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; display: flex; align-items: center; gap: 8px; padding: 7px 18px; background: var(--glass); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); border-bottom: 1px solid var(--line); }
.p-brand { display: flex; gap: 8px; align-items: center; min-width: 0; } .p-brand svg { width: 28px; height: 28px; flex: none; }
.p-brand b { font: 600 15px/1.1 var(--font-display); display: block; white-space: nowrap; } .p-brand span { font-size: 11px; color: var(--ink-3); }
.p-tabs { display: flex; gap: 3px; padding: 8px 18px 0; max-width: 1400px; margin: 0 auto; width: 100%; overflow-x: auto; }
.p-tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; font: 600 13px var(--font-body); color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; cursor: pointer; transition: background .2s; }
.p-tabs button:hover { background: var(--paper-2); }
.p-tabs button svg { width: 15px; height: 15px; }
.p-tabs button.on { background: var(--ink); color: var(--paper); }
.p-tabs .n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--client); color: #fff; font: 700 10.5px var(--font-mono); display: grid; place-items: center; }
.p-main { max-width: 1400px; margin: 0 auto; width: 100%; padding: 14px 18px 70px; }
.p-h { font: 600 24px/1.1 var(--font-display); letter-spacing: -.02em; margin: 4px 0 12px; }
.p-cover { position: relative; overflow: hidden; border-radius: 16px; padding: 18px 20px 16px; color: #F2F0EB; box-shadow: var(--shadow);
  background-image: var(--rosette), var(--guilloche), var(--cloth), linear-gradient(135deg, #1E232C, #161A21 60%, #111318);
  background-repeat: no-repeat, repeat, repeat, repeat, no-repeat; background-position: right -130px center, 0 0, 0 0, 0 0, 0 0; background-size: 360px 360px, auto, auto, auto, 100% 100%; }
.p-cover h1 { font: 500 clamp(22px, 2.6vw, 28px)/1.12 var(--font-display); letter-spacing: -.02em; margin: 6px 0 0; max-width: 720px; text-wrap: balance; }
.p-cover h1 em { color: var(--gold); }
.p-act { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 10px; text-align: left; padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; border-top: 3px solid var(--client); transition: transform .25s var(--spring), box-shadow .25s; }
.p-act:hover { transform: translateY(-1.5px); box-shadow: var(--shadow); }
.p-act .p-ic { grid-row: span 3; width: 38px; height: 38px; border-radius: 11px; background: var(--client-bg); color: var(--client-ink); display: grid; place-items: center; }
.p-act .p-ic svg { width: 19px; height: 19px; }
.p-act .p-n { font: 600 24px/1 var(--font-display); }
.p-act b { font-size: 13.5px; } .p-act .tiny { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-bottom { display: none; }
.ack-doc { background-color: var(--card); background-image: var(--guilloche-ink); border: 1px solid var(--line-2); border-radius: 12px; padding: 14px; }
.qr { width: 160px; height: 160px; display: grid; grid-template-columns: repeat(21, 1fr); padding: 8px; background: #fff; border-radius: 12px; box-shadow: var(--shadow-sm); }
.qr i { background: #14161B; } .qr i.o { background: transparent; }
@media (max-width: 760px) {
  .p-tabs { display: none; }
  .p-top { padding: 6px 12px; } .p-top .hide-sm { display: none; } .p-brand div { display: none; } .p-top select.input { max-width: 132px !important; }
  .p-main { padding: 10px 12px 90px; }
  .p-cover { padding: 14px 14px; background-size: 240px 240px, auto, auto, auto, 100% 100%; }
  .p-bottom { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 5px 4px calc(5px + env(safe-area-inset-bottom, 0px)); background: var(--glass); backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5); border-top: 1px solid var(--line); }
  .p-bottom button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 1px; font: 600 10px var(--font-body); color: var(--ink-3); position: relative; cursor: pointer; }
  .p-bottom button svg { width: 20px; height: 20px; }
  .p-bottom button.on { color: var(--client-ink); }
  .p-bottom button b { position: absolute; top: 3px; right: calc(50% - 14px); width: 7px; height: 7px; border-radius: 50%; background: var(--client); }
}
.pipeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; background-image: radial-gradient(var(--line-2) 1px, transparent 1.2px); background-size: 14px 14px; border-radius: 0 0 var(--r) var(--r); }
.pipe-stage { display: grid; gap: 6px; align-content: start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.pipe-step { padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--card-2); display: grid; gap: 2px; border-left: 3.5px solid var(--code); }
.pipe-step b { font-size: 13px; } .pipe-step span { font-size: 11.5px; color: var(--ink-2); line-height: 1.3; }
.pipe-step.s-agent { border-left-color: var(--agent); background-image: var(--hexes); }
.pipe-step.s-gate { background: var(--gate); border-color: var(--gate); color: #fff; } .pipe-step.s-gate span { color: rgba(255,255,255,.85); }
.pipe-step.s-ok { border-left-color: var(--ok); }
@media (max-width: 1100px) { .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .pipeline { grid-template-columns: 1fr; } }

/* text on accent fills: white in light mode, deep ink in dark mode (accents get lighter there) */
:root { --on-accent: #FFFFFF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --on-accent: #10141B; } }
:root[data-theme="dark"] { --on-accent: #10141B; }
.btn.gate, .btn.agent, .btn.ok, .btn.client, .p-tabs .n, .pipe-step.s-gate, .pipe-step.s-gate span, .bubble.out, .bubble.staff { color: var(--on-accent); }
.glyph { color: var(--on-accent); }
.pipe-step.s-gate span { opacity: .85; }
.door { display: flex; align-items: center; gap: 14px; text-decoration: none; border-color: color-mix(in srgb, var(--client) 40%, var(--line)); transition: transform .25s var(--spring), box-shadow .25s; }
.door:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.door b { font-size: 15px; }
.door .chev { width: 18px; height: 18px; flex: none; color: var(--ink-3); }
.door .glyph { flex: none; }

/* ---------- each client's records ---------- */
.yr { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; overflow-x: auto; }
.yr-m { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 8px 7px; display: grid; gap: 6px; cursor: pointer; font: inherit; color: inherit; text-align: left; min-width: 64px; transition: border-color .2s, box-shadow .2s; }
.yr-m b { font-size: 13px; } .yr-m:hover { border-color: var(--line-2); }
.yr-m.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.yr-m.now b::after { content: " ·"; color: var(--client); }
.cc-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.cc-wrap > .card:last-child { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.cal.cc .day { min-height: 96px; cursor: default; }
.cal.cc .day:hover { transform: none; }
.cal .pill { border: 0; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; text-align: left; width: 100%; }
.cal .pill.rp-filed { background: var(--ok-bg); color: var(--ok-ink); }
.cal .pill.rp-bad { background: var(--bad-bg); color: var(--bad-ink); }
.cal .pill.rp-client { background: var(--client-bg); color: var(--client-ink); }
.cal .pill.rp-agent { background: var(--agent-bg); color: var(--agent-ink); }
.cal .pill.rp-gate { background: var(--gate-bg); color: var(--gate-ink); }
.cal .pill.rp-code { background: var(--code-bg); color: var(--code-ink); }
.cal .pill.rp-sched { background: var(--paper-2); color: var(--ink-2); }
.rd-filed { background: var(--ok) !important; } .rd-bad { background: var(--bad) !important; } .rd-client { background: var(--client) !important; } .rd-agent { background: var(--agent) !important; } .rd-gate { background: var(--gate) !important; } .rd-code { background: var(--code) !important; } .rd-sched { background: var(--line-2) !important; }
.rrow { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; color: inherit; text-align: left; align-items: flex-start; }
.cc-date { width: 40px; flex: none; text-align: center; display: grid; } .cc-date b { font: 600 20px/1 var(--font-display); } .cc-date span { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
@media (max-width: 1100px) { .cc-wrap { grid-template-columns: 1fr; } .cc-wrap > .card:last-child { position: static; max-height: none; } }
@media (max-width: 680px) { .yr { grid-template-columns: repeat(6, minmax(0, 1fr)); } .cal.cc .day { min-height: 58px; } }
@media (max-width: 760px) { .p-bottom { grid-template-columns: repeat(6, 1fr) !important; } .p-bottom button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }


/* --- Production Backend API Bridge Indicator --- */
.api-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--bg-card, #1A1D24);
  border: 1px solid var(--border, #2E333D);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--text, #E5E7EB);
  cursor: pointer;
  margin-right: 8px;
}
.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.badge-dot.online {
  background: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}
.badge-dot.syncing {
  background: #3B82F6;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.6);
  animation: pulse-sync 1s infinite alternate;
}
.badge-dot.offline {
  background: #F59E0B;
}
@keyframes pulse-sync {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* --- Refined High-Density UX Enhancements --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.28); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); }

/* Table sticky headers & clear row focus */
.table-wrap {
  scrollbar-width: thin;
  position: relative;
}
table.t tbody tr:focus-within, table.t tbody tr:focus {
  outline: 2px solid var(--client);
  outline-offset: -2px;
}
.card-h h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.card-h h3 small {
  margin-top: 0;
  display: inline;
}
