/* Call Analyzer — dashboard design system.
   No frameworks, no CDN: the app is served from a private host and must render
   with zero outbound requests. Everything below is tokens + components.

   Colour is assigned by the job it does, not by taste:
     · sentiment  = DIVERGING (blue pole / gray midpoint / red pole) — validated
                    CVD-safe (worst pair ΔE 9.1 deutan). Never red/green: that pair
                    measures ΔE 4.1 and is invisible to deuteranopes.
     · severity   = STATUS heat (warning / serious / critical), always shipped with
                    a text label, never colour alone.
     · UI accent  = ink (near-black). Blue stays reserved for data + focus.
*/

/* ============================================================ 1. TOKENS */
:root {
  color-scheme: light;

  /* planes & surfaces */
  --plane:         #f9f9f7;
  --surface:       #fcfcfb;
  --surface-2:     #f2f2ef;
  --surface-3:     #e9e9e4;
  --border:        rgba(11, 11, 11, .10);
  --border-strong: rgba(11, 11, 11, .18);
  --shadow-sm:     0 1px 2px rgba(11, 11, 11, .05);
  --shadow-md:     0 1px 2px rgba(11, 11, 11, .04), 0 6px 16px rgba(11, 11, 11, .06);
  --shadow-lg:     0 16px 48px rgba(11, 11, 11, .16);

  /* ink */
  --ink:        #0b0b0b;
  --ink-2:      #52514e;
  --ink-muted:  #6a6862;      /* >= 4.5:1 on all three surfaces. The palette's muted
                                 step (#898781) reaches only 3.5 in light mode, so the
                                 accessibility pass darkens it for UI text. */
  --ink-invert: #fcfcfb;

  /* Text that sits on a tinted chip. The chip's dot keeps the true data colour;
     these are the readable text steps of the same hue (all >= 4.5:1 on the tint). */
  --on-pos: #1c5cab;
  --on-neg: #b83232;
  --on-med: #a1481f;
  --on-low: #8a6000;

  /* chart chrome */
  --grid: #e1e0d9;
  --axis: #c3c2b7;

  /* data — diverging sentiment scale */
  --accent:      #2a78d6;
  --accent-wash: rgba(42, 120, 214, .10);
  --accent-trak: #cde2fb;
  --pos: #2a78d6;
  --neu: #898781;
  --neg: #d03b3b;

  /* data — status heat (fixed, never themed) */
  --sev-high: #d03b3b;
  --sev-med:  #ec835a;
  --sev-low:  #fab219;
  --good:     #0ca30c;
  --good-ink: #006300;

  /* geometry */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --rail: 244px;
  --topbar: 60px;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .6, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane:         #0d0d0d;
    --surface:       #1a1a19;
    --surface-2:     #232320;
    --surface-3:     #2c2c2a;
    --border:        rgba(255, 255, 255, .10);
    --border-strong: rgba(255, 255, 255, .20);
    --shadow-sm:     0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md:     0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .35);
    --shadow-lg:     0 16px 48px rgba(0, 0, 0, .55);
    --ink:        #ffffff;
    --ink-2:      #c3c2b7;
    --ink-muted:  #95938b;      /* lifted off #898781 for the same reason: AA on the
                                   inset washes as well as the card surface */
    --ink-invert: #0d0d0d;
    --on-pos: #6da7ec;
    --on-neg: #e66767;
    --on-med: #ec835a;
    --on-low: #fab219;
    --grid: #2c2c2a;
    --axis: #383835;
    --accent:      #3987e5;
    --accent-wash: rgba(57, 135, 229, .14);
    --accent-trak: #184f95;
    --pos: #3987e5;
    --good-ink: #0ca30c;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:         #0d0d0d;
  --surface:       #1a1a19;
  --surface-2:     #232320;
  --surface-3:     #2c2c2a;
  --border:        rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .20);
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md:     0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .35);
  --shadow-lg:     0 16px 48px rgba(0, 0, 0, .55);
  --ink:        #ffffff;
  --ink-2:      #c3c2b7;
  --ink-muted:  #95938b;
  --ink-invert: #0d0d0d;
  --on-pos: #6da7ec;
  --on-neg: #e66767;
  --on-med: #ec835a;
  --on-low: #fab219;
  --grid: #2c2c2a;
  --axis: #383835;
  --accent:      #3987e5;
  --accent-wash: rgba(57, 135, 229, .14);
  --accent-trak: #184f95;
  --pos: #3987e5;
  --good-ink: #0ca30c;
}

/* ============================================================ 2. BASE */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--ink);
  font: 400 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
svg { display: block; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--accent-wash); }

/* scrollbars — thin and recessive */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--axis); background-clip: content-box; }

/* ============================================================ 3. TYPE HELPERS */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.muted { color: var(--ink-muted); }
.dim   { color: var(--ink-2); }
.num   { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================ 4. APP SHELL */
.app {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

/* --- rail ------------------------------------------------------------- */
.rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.brand-mark {
  width: 30px; height: 30px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: var(--ink-invert);
}
.brand-name { font-size: 14px; font-weight: 650; letter-spacing: -.01em; line-height: 1.15; }
.brand-sub  { font-size: 11px; color: var(--ink-muted); line-height: 1.2; }

.nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.nav-label { padding: 12px 10px 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  width: 100%;
  background: none;
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-item svg { flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-count {
  margin-left: auto;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 7px;
}
.nav-item.active .nav-count { background: var(--surface); }

.rail-foot {
  flex: none;
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.who { min-width: 0; line-height: 1.25; }
.who b { display: block; font-size: 12.5px; font-weight: 600; }
.who span { font-size: 11px; color: var(--ink-muted); }

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

.topbar {
  flex: none;
  height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.stamp { font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.topbar .sub { font-size: 12px; color: var(--ink-muted); margin-top: 1px; }
.topbar .spacer { flex: 1 1 auto; }

.scroll { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
.view { padding: 20px; max-width: 1560px; margin: 0 auto; }

/* refetch: hold the frame, never a skeleton flash */
.view.busy { opacity: .55; transition: opacity .12s var(--ease); pointer-events: none; }

/* ============================================================ 5. CONTROLS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease);
}
.btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--border-strong); }
.btn:active { transform: translateY(.5px); }
.btn-primary {
  background: var(--ink); border-color: var(--ink); color: var(--ink-invert);
}
.btn-primary:hover { background: var(--ink); color: var(--ink-invert); opacity: .88; }
.btn-ghost { border-color: transparent; background: none; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-icon { width: 32px; padding: 0; justify-content: center; }

/* segmented control — the date range */
.seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.seg button {
  border: 0;
  background: none;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--ink-muted);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.field {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}
.field:hover { border-color: var(--border-strong); }
select.field {
  appearance: none;
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
                    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.search { position: relative; display: inline-flex; align-items: center; }
.search svg { position: absolute; left: 9px; color: var(--ink-muted); pointer-events: none; }
.search input { padding-left: 30px; width: 230px; }
.search input::placeholder { color: var(--ink-muted); }
.search kbd {
  position: absolute; right: 8px;
  font: 500 10.5px/1 var(--sans);
  color: var(--ink-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 5px;
  background: var(--surface-2);
}

.filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filterbar .rule { width: 1px; height: 20px; background: var(--border); margin: 0 2px; }

/* ============================================================ 6. CARDS & GRID */
.grid { display: grid; gap: 14px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-hero { grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(0, 1fr)); }
.g-split { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 13.5px; font-weight: 650; letter-spacing: -.005em; }
.card-head p { font-size: 12px; color: var(--ink-muted); margin-top: 1px; }
.card-head .spacer { flex: 1 1 auto; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

/* ============================================================ 7. FIGURES */
.tile { padding: 15px 16px; display: flex; flex-direction: column; gap: 3px; height: 100%; }
.tile .label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.tile .value { font-size: 26px; font-weight: 620; letter-spacing: -.02em; line-height: 1.15; }
.tile .foot { margin-top: auto; padding-top: 10px; font-size: 12px; color: var(--ink-muted); }

/* hero — exactly one per view */
.hero { padding: 18px 20px 8px; display: flex; flex-direction: column; height: 100%; }
.hero .value {
  font-size: 46px; font-weight: 620; letter-spacing: -.03em; line-height: 1.05;
  margin: 6px 0 2px;
}
.hero .spark { margin-top: auto; margin-left: -4px; margin-right: -4px; }

.delta {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 2px 7px 2px 5px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--ink-2);
}
.delta.up   { color: var(--good-ink); }
.delta.down { color: var(--on-neg); }
.delta.flat { color: var(--ink-muted); }

/* meter — fill carries state, track is a lighter step of the same ramp */
table.tbl .meter { min-width: 90px; }
.meter { height: 8px; border-radius: 99px; background: var(--accent-trak); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }

/* 100% split bar — 2px surface gaps do the separating, never borders */
.split {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--surface-2);
}
.split i { display: block; height: 100%; min-width: 0; }
.split i:first-child { border-radius: 99px 0 0 99px; }
.split i:last-child { border-radius: 0 99px 99px 0; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }

/* Names of the people in a department card. A button rather than an anchor because it
   routes in-app, styled down to a chip so eight of them do not shout over the card. */
.linklike {
  font: inherit; font-size: 12px; color: var(--ink-2); cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px 9px;
  transition: color .12s var(--ease), border-color .12s var(--ease);
}
.linklike:hover { color: var(--ink); border-color: var(--ink-muted); }
.linklike:focus-visible { outline: 2px solid var(--pos); outline-offset: 2px; }
.legend .n { color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* ============================================================ 8. PILLS */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px;
  border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid transparent;
}
.pill .dot { width: 6px; height: 6px; border-radius: 99px; flex: none; }
.pill-quiet { background: none; border-color: var(--border); color: var(--ink-muted); font-weight: 500; }

.pill.pos { background: rgba(42, 120, 214, .12); color: var(--on-pos); }
.pill.neu { background: var(--surface-2); color: var(--ink-2); }
.pill.neg { background: rgba(208, 59, 59, .12); color: var(--on-neg); }

/* severity: colour + word, never colour alone */
.pill.sev-high   { background: rgba(208, 59, 59, .12);  color: var(--on-neg); }
.pill.sev-medium { background: rgba(236, 131, 90, .16); color: var(--on-med); }
.pill.sev-low    { background: rgba(250, 178, 25, .18); color: var(--on-low); }

/* ============================================================ 9. TABLES */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}
table.tbl th.sortable { cursor: pointer; user-select: none; }
table.tbl th.sortable:hover { color: var(--ink-2); }
table.tbl th .caret { opacity: 0; margin-left: 4px; }
table.tbl th[aria-sort] .caret { opacity: 1; }
table.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13px;
}
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr.row { cursor: pointer; transition: background .1s var(--ease); }
table.tbl tbody tr.row:hover { background: var(--surface-2); }
table.tbl tbody tr.row:focus-visible { background: var(--surface-2); outline-offset: -2px; }
table.tbl td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl th.n { text-align: right; }
.cell-strong { font-weight: 600; }
.cell-sub { font-size: 11.5px; color: var(--ink-muted); margin-top: 1px; }

/* ============================================================ 10. CHARTS */
.chart { position: relative; }
/* height comes from the height attribute the renderer sets — never `height:auto`,
   which would feed the box's size back into the next measure and loop. */
.chart svg { display: block; width: 100%; overflow: visible; }

/* a card whose chart should fill whatever height the row ends up at */
.card.tall { display: flex; flex-direction: column; }
.card.tall .card-body { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.card.tall .chart { flex: 1 1 auto; min-height: 190px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axisline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--ink-muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; pointer-events: none; }
.chart .band { fill: var(--surface-2); pointer-events: none; }

.tip {
  position: absolute;
  z-index: 30;
  min-width: 150px;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s var(--ease);
}
.tip.on { opacity: 1; }
.tip .t-head {
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--border);
}
.tip .t-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 12px; }
.tip .t-key { width: 12px; height: 2px; border-radius: 2px; flex: none; }
.tip .t-name { color: var(--ink-muted); }
.tip .t-val { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }

/* bars in the horizontal severity chart */
.hbar { display: grid; grid-template-columns: 74px minmax(0, 1fr) 44px; gap: 10px; align-items: center; padding: 6px 0; }
.hbar .k { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.hbar .k i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 3px; }
.hbar .track i { display: block; height: 100%; border-radius: 0 3px 3px 0; min-width: 2px; }
.hbar .v { text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============================================================ 11. LISTS */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  background: none; border-left: 0; border-right: 0; border-top: 0;
  width: 100%;
  transition: background .1s var(--ease);
}
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { background: var(--surface-2); }
.feed-item .body { min-width: 0; flex: 1 1 auto; }
.feed-item .txt { font-size: 13px; line-height: 1.45; }
.feed-item .meta { font-size: 11.5px; color: var(--ink-muted); margin-top: 3px; }
.feed-item .more { font-size: 11.5px; color: var(--ink-2); margin-top: 4px; }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--ink-muted);
}
.empty .big { font-size: 14px; color: var(--ink-2); font-weight: 550; margin-bottom: 4px; }
.empty code {
  font: 12px/1.6 var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px 6px;
}

/* dispatcher cards */
.dcard { padding: 16px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; height: 100%; text-align: left; background: none; border: 0; }
.dcard-top { display: flex; align-items: center; gap: 10px; }
.dcard .nm { font-size: 14px; font-weight: 620; letter-spacing: -.01em; }
.dcard .sb { font-size: 11.5px; color: var(--ink-muted); }
.dcard-stats { display: flex; gap: 18px; }
.dcard-stats div b { display: block; font-size: 17px; font-weight: 620; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dcard-stats div span { font-size: 11px; color: var(--ink-muted); }
.card.click { transition: border-color .12s var(--ease), box-shadow .12s var(--ease), transform .12s var(--ease); }
.card.click:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

/* ============================================================ 11b. ASSISTANT */
/* Ask: conversation list beside the transcript */
.g-chat { grid-template-columns: 268px minmax(0, 1fr); align-items: stretch; }

.card.threads { display: flex; flex-direction: column; min-height: 0; }
.threads-head { padding: 12px; border-bottom: 1px solid var(--border); flex: none; }
.thread-list { flex: 1 1 auto; overflow-y: auto; padding: 8px; min-height: 0; }
.thread-empty { font-size: 12.5px; padding: 10px; }

.thread-row {
  display: flex; align-items: center; gap: 2px;
  border-radius: var(--r-md);
  transition: background .12s var(--ease);
}
.thread-row:hover { background: var(--surface-2); }
.thread-row.active { background: var(--surface-2); }
.thread-row.active .thread-title { font-weight: 620; }

.thread-open {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: none; cursor: pointer; text-align: left;
  padding: 9px 4px 9px 10px;
}
.thread-title { font-size: 13px; line-height: 1.35; color: var(--ink); }
.thread-meta { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }

.thread-del {
  flex: none; border: 0; background: none; cursor: pointer;
  color: var(--ink-muted); padding: 8px 9px; border-radius: var(--r-sm);
  opacity: 0; transition: opacity .12s var(--ease), color .12s var(--ease);
}
.thread-row:hover .thread-del, .thread-del:focus-visible { opacity: 1; }
.thread-del:hover { color: var(--on-neg); }

.card.chat { display: flex; flex-direction: column; height: calc(100vh - var(--topbar) - 92px); min-height: 440px; }

.chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-blank { margin: auto; text-align: center; max-width: 60ch; padding: 12px; }
.chat-blank-icon {
  width: 42px; height: 42px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-wash);
  color: var(--accent);
}
.chat-blank .big { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.chat-blank p { font-size: 13px; line-height: 1.55; margin-top: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 99px;
  padding: 7px 13px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
  transition: background .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease);
}
.chip:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--ink); }

/* a date rule between days of history */
.chat-day { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.chat-day::before, .chat-day::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--border);
}
.chat-day span {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-muted);
}

/* the slice an answer was written against — the reason a stored answer still reads true */
.msg-scope {
  font-size: 11px; color: var(--ink-muted); margin-top: 4px; text-align: right;
}

.msg { display: flex; }
.msg.you { justify-content: flex-end; }
.msg.you .bubble {
  max-width: 78%;
  background: var(--accent-wash);
  border: 1px solid transparent;
  border-radius: 12px 12px 4px 12px;
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.5;
}
.msg.bot { justify-content: flex-start; }
.msg.bot > * { max-width: 100%; width: 100%; }

.answer { font-size: 13.5px; line-height: 1.62; }
.answer.err {
  display: flex; align-items: flex-start; gap: 8px;
  color: var(--on-neg);
  background: rgba(208, 59, 59, .08);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.ans-p { margin: 0 0 10px; }
.ans-p:last-child { margin-bottom: 0; }
.ans-list { margin: 0 0 10px; padding-left: 2px; }
.ans-list li { position: relative; padding-left: 16px; margin: 5px 0; }
.ans-list li::before {
  content: ""; position: absolute; left: 3px; top: .62em;
  width: 4px; height: 4px; border-radius: 99px; background: var(--axis);
}
.answer strong { font-weight: 650; }

.cite {
  display: inline-flex; align-items: center;
  height: 17px; padding: 0 6px; margin: 0 1px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  cursor: pointer; vertical-align: baseline;
}
.cite:hover { border-color: var(--accent); color: var(--accent); }

.cites { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.cites .eyebrow { margin-bottom: 6px; }
.cite-row {
  display: flex; gap: 10px; align-items: flex-start; width: 100%;
  padding: 7px 8px; border: 0; background: none; border-radius: var(--r-md);
  cursor: pointer; text-align: left;
}
.cite-row:hover { background: var(--surface-2); }
.cite-row .body { flex: 1 1 auto; min-width: 0; }
.cite-row .txt { font-size: 12.5px; line-height: 1.45; }
.cite-row .meta { font-size: 11px; color: var(--ink-muted); margin-top: 2px; }

.ans-foot { margin-top: 10px; font-size: 11px; color: var(--ink-muted); }

.thinking { display: flex; align-items: center; gap: 5px; color: var(--ink-muted); font-size: 13px; }
.thinking i {
  width: 5px; height: 5px; border-radius: 99px; background: var(--axis);
  animation: blink 1.2s infinite ease-in-out;
}
.thinking i:nth-child(2) { animation-delay: .18s; }
.thinking i:nth-child(3) { animation-delay: .36s; }
.thinking span { margin-left: 5px; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.chat-form {
  flex: none;
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex; gap: 8px; align-items: flex-end;
}
.chat-input {
  flex: 1 1 auto;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  max-height: 140px;
  min-height: 38px;
}
.chat-input:hover { border-color: var(--border-strong); }
.chat-form .btn { height: 38px; }

@media (max-width: 1080px) {
  .g-chat { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .g-chat { grid-template-columns: minmax(0, 1fr); }
  .card.threads { max-height: 220px; }
  .card.chat { height: calc(100vh - var(--topbar) - 140px); }
  .chips { justify-content: flex-start; }
}

/* ============================================================ 12. DRAWER */
.scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(11, 11, 11, .34);
  opacity: 0;
  /* A closed overlay still covers the viewport — opacity 0 and an off-screen
     transform do not stop hit-testing. Without this the dashboard goes dead to the
     mouse after the first call is opened and closed. */
  pointer-events: none;
  transition: opacity .18s var(--ease);
}
.scrim.on { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(620px, 100vw);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  pointer-events: none;          /* see .scrim — also covers a paused transition */
  transition: transform .22s var(--ease);
}
.drawer.on { transform: none; pointer-events: auto; }
.drawer-head {
  flex: none;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.drawer-head .sub { font-size: 12px; color: var(--ink-muted); margin-top: 3px; }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 16px; }

.sect { margin-bottom: 20px; }
.sect:last-child { margin-bottom: 0; }
.sect > .eyebrow { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.sect p { font-size: 13.5px; line-height: 1.6; color: var(--ink); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.call-audio { width: 100%; margin-top: 4px; }
.facts div { background: var(--surface); padding: 9px 11px; }
.facts dt { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); font-weight: 600; }
.facts dd { margin: 2px 0 0; font-size: 13px; font-weight: 550; font-variant-numeric: tabular-nums; }

.issue-row { display: flex; gap: 9px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.issue-row:last-child { border-bottom: 0; }
.issue-row .txt { font-size: 13px; line-height: 1.5; flex: 1 1 auto; }

.checks li {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 7px 0;
  font-size: 13px; line-height: 1.5;
  border-bottom: 1px solid var(--border);
}
.checks li:last-child { border-bottom: 0; }
.checks .box {
  width: 15px; height: 15px; flex: none; margin-top: 2px;
  border: 1.5px solid var(--axis); border-radius: 4px;
}

/* transcript */
.turns { display: flex; flex-direction: column; gap: 10px; }
.turn { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; }
.turn .who {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  padding-top: 7px;
}
.turn .who i { width: 6px; height: 6px; border-radius: 99px; flex: none; background: var(--neu); }
.turn.Dispatcher .who i { background: var(--accent); }
.turn .say {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px 10px 10px 10px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.55;
}
.turn.Dispatcher .say { background: var(--accent-wash); border-color: transparent; }

/* ============================================================ 13. LOGIN */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--plane);
}
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form form { width: 100%; max-width: 336px; }
.auth-form .brand { border: 0; height: auto; padding: 0 0 26px; }
.auth-form h1 { font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.auth-form .lede { font-size: 13.5px; color: var(--ink-muted); margin-top: 5px; }
.auth-field { margin-top: 14px; }
.auth-field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.auth-field input {
  width: 100%; height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.auth-field input:hover { border-color: var(--border-strong); }
.auth-form button[type=submit] {
  width: 100%; height: 38px; margin-top: 18px;
  justify-content: center;
}
.auth-err {
  min-height: 18px; margin-top: 10px;
  font-size: 12.5px; color: var(--on-neg); font-weight: 550;
  display: flex; align-items: center; gap: 6px;
}
.auth-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--ink-muted); line-height: 1.6; }

.auth-side {
  position: relative;
  overflow: hidden;
  padding: 40px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: var(--surface);
  border-left: 1px solid var(--border);
}
.auth-side .quote { font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.35; max-width: 24ch; }
.auth-side .quote em { font-style: normal; color: var(--ink-muted); }
.auth-side .bullets { margin-top: 22px; display: flex; flex-direction: column; gap: 9px; }
.auth-side .bullets li { display: flex; gap: 9px; align-items: center; font-size: 13px; color: var(--ink-2); }
.auth-side .bullets i { width: 5px; height: 5px; border-radius: 99px; background: var(--accent); flex: none; }
.auth-art { position: absolute; inset: 0; opacity: .5; pointer-events: none; }

/* ============================================================ 14. RESPONSIVE */
@media (max-width: 1280px) {
  .g-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1080px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
}
@media (max-width: 860px) {
  :root { --rail: 0px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 45; width: 244px;
    transform: translateX(-100%); transition: transform .2s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .rail.on { transform: none; }
  .burger { display: inline-flex !important; }
  .g-hero, .g-4, .g-3, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .search input { width: 150px; }
  .view { padding: 14px; }
}
.burger { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
  .rail, .topbar, .filterbar, .scrim, .drawer { display: none !important; }
  .app { display: block; height: auto; }
  .scroll { overflow: visible; }
  .card { break-inside: avoid; box-shadow: none; }
}
