/* OTH CS Tracker — styles.
   Palette values come from the validated data-viz reference palette; the light
   and dark steps are selected sets, not an automatic inversion. */

:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;
  --series-1-soft: #cde2fb;

  /* Status palette — reserved, never reused for a data series. */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --success-text: #006300;

  /* Usage tiers. Ordered light->dark in engagement, so the ramp itself reads
     as "how alive is this account" even before you read the label. */
  --tier-power: #008300;
  --tier-active: #2a78d6;
  --tier-light: #eda100;
  --tier-dormant: #eb6834;
  --tier-none: #898781;

  /* Action categories */
  --cat-rescue: #d03b3b;
  --cat-renewal: #eb6834;
  --cat-activation: #2a78d6;
  --cat-expansion: #008300;
  --cat-hygiene: #898781;

  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 12px rgba(11, 11, 11, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --plane: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-1-soft: #184f95;
    --success-text: #0ca30c;
    --shadow: none;

    --tier-power: #0ca30c;
    --tier-active: #3987e5;
    --tier-light: #c98500;
    --tier-dormant: #d95926;
    --tier-none: #898781;

    --cat-rescue: #e66767;
    --cat-renewal: #d95926;
    --cat-activation: #3987e5;
    --cat-expansion: #0ca30c;
    --cat-hygiene: #898781;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --plane: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --series-1-soft: #184f95;
  --success-text: #0ca30c;
  --shadow: none;

  --tier-power: #0ca30c;
  --tier-active: #3987e5;
  --tier-light: #c98500;
  --tier-dormant: #d95926;
  --tier-none: #898781;

  --cat-rescue: #e66767;
  --cat-renewal: #d95926;
  --cat-activation: #3987e5;
  --cat-expansion: #0ca30c;
  --cat-hygiene: #898781;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; font-weight: 650; margin: 0 0 2px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 620; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; color: var(--text-secondary); }

/* ----------------------------------------------------------------- layout */

.topbar {
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px; height: 52px;
}
.brand {
  font-weight: 680; font-size: 14px; color: var(--text-primary);
  letter-spacing: -0.01em; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--series-1); }
.nav { display: flex; gap: 2px; flex: 1; }
.nav a {
  padding: 6px 11px; border-radius: var(--radius-sm); color: var(--text-secondary);
  font-weight: 520; font-size: 13px;
}
.nav a:hover { background: var(--plane); text-decoration: none; color: var(--text-primary); }
.nav a.active { background: var(--series-1-soft); color: var(--text-primary); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .nav a.active { color: #fff; }
}
:root[data-theme="dark"] .nav a.active { color: #fff; }

.topbar-right {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 12px; white-space: nowrap;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.subtle { color: var(--text-muted); font-size: 12.5px; }

.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 940px) { .grid-2 { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------------- tiles */

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

.tile {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.tile .label {
  font-size: 11.5px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600; margin-bottom: 4px;
}
/* Proportional figures on standalone numbers — tabular-nums is for columns. */
.tile .value { font-size: 27px; font-weight: 640; letter-spacing: -0.02em; line-height: 1.1; }
.tile .foot { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
/* The tile whose filter is currently applied, so it is obvious which number
   narrowed the list below. */
.tile.is-on { border-color: var(--series-1); box-shadow: 0 0 0 1px var(--series-1); }

/* ----------------------------------------------------------------- status */

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border); color: var(--text-primary);
  background: var(--plane);
}
/* The swatch is a redundant channel: the text label always carries the meaning,
   so this never encodes by color alone. */
.pill .swatch { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.pill.green  .swatch { background: var(--good); }
.pill.amber  .swatch { background: var(--warning); }
.pill.red    .swatch { background: var(--critical); }
.pill.unset  .swatch { background: var(--text-muted); }
.pill.none    .swatch { background: var(--text-muted); }
.pill.watch   .swatch { background: var(--warning); }
.pill.at_risk .swatch { background: var(--serious); }
.pill.critical .swatch { background: var(--critical); }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px;
  font-weight: 600; background: var(--plane); border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* Account-manager picker — chips for the current owners, a dropdown to add. */
.owner-picker { display: flex; flex-direction: column; gap: 8px; }
.owner-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.owner-chips:empty { display: none; }
.owner-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 9px; border-radius: 14px; font-size: 12.5px;
  font-weight: 600; background: var(--plane); border: 1px solid var(--border);
  color: var(--text-primary);
}
.owner-chip .chip-x {
  border: none; background: none; cursor: pointer; line-height: 1;
  font-size: 15px; padding: 0 4px; border-radius: 50%;
  color: var(--text-muted);
}
.owner-chip .chip-x:hover { color: var(--critical); background: var(--surface-1); }
.owner-add { width: 100%; }

.reason {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px;
  border-radius: 4px; font-size: 11.5px; font-weight: 550;
  background: var(--plane); border: 1px solid var(--border); color: var(--text-secondary);
}
.reason.overdue, .reason.churn { color: var(--critical); border-color: var(--critical); }
.reason.due { color: var(--text-primary); }

.delta.up { color: var(--success-text); font-weight: 600; }
.delta.down { color: var(--critical); font-weight: 600; }
.delta.flat { color: var(--text-muted); }

/* ----------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
thead th a { color: var(--text-muted); }
thead th a.sorted { color: var(--text-primary); }

/* Sorting affordance. The caret is always present but nearly invisible until
   the column is hovered or active — a header row carrying twelve dark arrows
   competes with the data underneath. */
thead th.th-sortable { cursor: pointer; user-select: none; }
thead th.th-sortable:hover,
thead th.th-sortable:focus-visible,
thead th.sorted { color: var(--text-primary); }
thead th.th-sortable:focus-visible { outline: 2px solid var(--series-1); outline-offset: -2px; }
.sort-caret { margin-left: 5px; font-size: 10px; opacity: 0.25; }
thead th.th-sortable:hover .sort-caret,
a.sort-link:hover .sort-caret { opacity: 0.6; }
thead th.sorted .sort-caret,
a.sort-link.sorted .sort-caret { opacity: 1; }
a.sort-link { display: inline-flex; align-items: baseline; }
tbody td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tbody tr:hover { background: var(--plane); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tenant-name { font-weight: 600; color: var(--text-primary); }
.tenant-name:hover { color: var(--series-1); }
.muted { color: var(--text-muted); }

/* ----------------------------------------------------------------- forms */

label.field { display: block; margin-bottom: 10px; }
label.field > span {
  display: block; font-size: 11.5px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 4px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="search"], select, textarea {
  width: 100%; padding: 7px 10px; font-family: var(--font); font-size: 13px;
  border: 1px solid var(--axis); border-radius: var(--radius-sm);
  background: var(--surface-1); color: var(--text-primary);
}
textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--series-1); outline-offset: -1px; border-color: var(--series-1);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; font-family: var(--font); font-size: 13px; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid var(--axis);
  background: var(--surface-1); color: var(--text-primary); cursor: pointer;
  min-height: 34px;
}
.btn:hover { background: var(--plane); text-decoration: none; }
.btn.primary { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 4px 9px; font-size: 12px; min-height: 28px; }
.btn.link {
  border: none; background: none; color: var(--series-1); padding: 0; min-height: 0;
  font-weight: 550;
}
.btn.link:hover { text-decoration: underline; background: none; }

/* Filters sit in one row above everything they scope. */
.filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end;
  margin-bottom: 14px; padding: 12px 14px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--radius);
  /* Frozen while the records scroll underneath. top clears the 52px topbar;
     z-index sits below it (50) but above the table rows. A shadow separates it
     from whatever is scrolling past. */
  position: sticky; top: 52px; z-index: 40;
  box-shadow: 0 4px 10px -6px rgba(0, 0, 0, 0.25);
}
.filters .field { margin-bottom: 0; }
.filters label.field { min-width: 130px; }
.filters label.field.grow { flex: 1; min-width: 180px; }

/* ----------------------------------------------------------------- flash */

.flash {
  padding: 9px 13px; border-radius: var(--radius-sm); margin-bottom: 12px;
  font-size: 13px; border: 1px solid var(--border); background: var(--surface-1);
  display: flex; align-items: center; gap: 8px;
}
.flash.ok { border-left: 3px solid var(--good); }
.flash.error { border-left: 3px solid var(--critical); }
.flash.link {
  border-left: 3px solid var(--series-1);
  justify-content: space-between; gap: 12px;
}
.flash.link .copytext {
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  word-break: break-all; user-select: all; flex: 1;
}

/* ----------------------------------------------------------------- queue */

.queue-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border-bottom: 1px solid var(--grid);
}
.queue-item:last-child { border-bottom: none; }
.queue-item:hover { background: var(--plane); }
.queue-main { flex: 1; min-width: 0; }
.queue-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.queue-reasons { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.queue-metrics {
  display: flex; gap: 20px; align-items: center; font-size: 12px;
  color: var(--text-secondary); white-space: nowrap;
}
.queue-metrics .m { text-align: right; }
.queue-metrics .m .k {
  font-size: 10.5px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 600;
}
.queue-metrics .m .v { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }

/* ----------------------------------------------------------------- timeline */

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 12px 0; border-bottom: 1px solid var(--grid); }
.timeline li:last-child { border-bottom: none; }
.tp-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
  font-size: 12px; color: var(--text-muted); flex-wrap: wrap;
}
.tp-author { font-weight: 600; color: var(--text-primary); }
.tp-body { white-space: pre-wrap; word-wrap: break-word; font-size: 13px; }

/* A number that navigates. Inherits its own size and colour so a tile value
   stays a tile value — only the underline on hover says it is a link. Making
   these look like ordinary links would turn every dashboard into blue soup. */
.statlink {
  color: inherit; text-decoration: none;
  border-bottom: 1px dashed var(--border);
}
.statlink:hover, .statlink:focus-visible {
  color: var(--series-1); border-bottom-color: var(--series-1);
  text-decoration: none;
}
.statlink:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }
.tile .value .statlink { border-bottom-width: 2px; }

/* Calls per day. Same idea as the concentration strip on a tenant page: the
   shape is the point — a wall then nothing reads differently from steady work,
   and a zero day stays visible as a stub rather than disappearing. */
.perf-bars {
  display: flex; align-items: flex-end; gap: 2px;
  height: 64px; margin: 4px 0 8px;
}
.perf-bar { flex: 1 1 0; min-width: 2px; border-radius: 2px 2px 0 0; background: var(--series-1); }
.perf-bar.is-zero { background: var(--grid); }

/* Label-left, value-right list used in the performance sidebar. */
ul.plain { list-style: none; padding: 0; margin: 0; font-size: 13px; }
ul.plain li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--grid);
}
ul.plain li:last-child { border-bottom: none; }

.history { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.history li {
  padding: 6px 0; border-bottom: 1px solid var(--grid); color: var(--text-secondary);
}
.history li:last-child { border-bottom: none; }

/* ----------------------------------------------------------------- charts */

.chart-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 10px; flex-wrap: wrap;
}
.seg { display: inline-flex; border: 1px solid var(--axis); border-radius: var(--radius-sm); overflow: hidden; }
.seg button {
  padding: 4px 11px; font-size: 12px; font-weight: 600; border: none; cursor: pointer;
  background: var(--surface-1); color: var(--text-secondary); font-family: var(--font);
  min-height: 28px;
}
.seg button + button { border-left: 1px solid var(--axis); }
.seg button[aria-pressed="true"] { background: var(--series-1); color: #fff; }

/* Container grows to include the x-axis band — never a nested scrollbar. */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }

.tooltip {
  position: absolute; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 9px; font-size: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .13); white-space: nowrap; z-index: 10;
}
.tooltip .t-date { color: var(--text-muted); font-size: 11px; margin-bottom: 2px; }
.tooltip .t-val { font-weight: 650; font-variant-numeric: tabular-nums; }

.sparkline { width: 84px; height: 24px; display: block; }

/* Health mix bar — 2px surface gaps, no borders around segments. */
.mixbar { display: flex; gap: 2px; height: 10px; margin: 10px 0 12px; }
.mixbar div { border-radius: 2px; min-width: 2px; }
.mixbar .green { background: var(--good); }
.mixbar .amber { background: var(--warning); }
.mixbar .red { background: var(--critical); }
.mixbar .unset { background: var(--text-muted); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); }
.legend .item { display: inline-flex; align-items: center; gap: 5px; }
.legend .sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty .big { font-size: 15px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 550; }

/* ----------------------------------------------------------------- login */

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 340px; }
.login-card .card { padding: 24px; }
.login-head { text-align: center; margin-bottom: 20px; }
.login-head .brand { font-size: 17px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; font-size: 12.5px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ================================================================ v2 */

.card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 14px; padding: 14px 16px 12px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card > .card-head:first-child { padding-top: 0; }

/* ---------------------------------------------------------- scope bar */

.scopebar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 14px;
}
.seg {
  display: inline-flex; border: 1px solid var(--axis);
  border-radius: var(--radius-sm); overflow: hidden;
}
.seg a, .seg button {
  padding: 5px 12px; font-size: 12.5px; font-weight: 600; border: none;
  background: var(--surface-1); color: var(--text-secondary); cursor: pointer;
  font-family: var(--font); min-height: 30px; display: inline-flex;
  align-items: center;
}
.seg a:hover, .seg button:hover { background: var(--plane); text-decoration: none; }
.seg a + a, .seg button + button { border-left: 1px solid var(--axis); }
.seg a.on, .seg button[aria-pressed="true"] { background: var(--series-1); color: #fff; }

.warnchip {
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  background: var(--plane); border: 1px solid var(--warning);
  color: var(--text-secondary); cursor: help;
}
.warn-text { color: var(--serious); font-weight: 600; }

/* Required-field marker. Only used where a field is genuinely enforced on the
   server, so it never promises something the form does not actually check. */
.req { color: var(--critical); font-weight: 700; cursor: help; }

/* Usage concentration. The bar strip is the whole argument in one glance: an
   even ridge means the account is genuinely adopted, a cliff followed by a flat
   line means a few people carry it and the rest have stopped. */
/* Focus strip — the colour-coded "where do I look first" tiles. Each severity
   band tints its own background and paints a thick left accent, so a red tile
   is unmistakable at a glance even before any number is read. The bands map:
   crit = big red alert, warn = amber watch, ok = green, na = unknown/grey. */
.focus-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin: 0 14px 12px;
}
.focus-tile {
  padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); border-left: 4px solid var(--axis);
  background: var(--plane);
}
.focus-tile .ft-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 700;
}
.focus-tile .ft-value { font-size: 26px; font-weight: 700; line-height: 1.1; margin: 2px 0; }
.focus-tile .ft-value .ft-of { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.focus-tile .ft-foot { font-size: 11.5px; color: var(--text-secondary); }
.focus-tile.is-crit {
  border-left-color: var(--critical);
  background: color-mix(in srgb, var(--critical) 10%, var(--surface-1));
}
.focus-tile.is-crit .ft-value { color: var(--critical); }
.focus-tile.is-warn {
  border-left-color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, var(--surface-1));
}
.focus-tile.is-ok { border-left-color: var(--good); }
.focus-tile.is-na { border-left-color: var(--axis); }

.conc {
  margin: 0 14px 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--plane);
}
.conc-crit { border-color: var(--critical); }
.conc-warn { border-color: var(--warning); }
.conc-head {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 10px; font-size: 13.5px;
}
.conc-bars {
  display: flex; align-items: flex-end; gap: 2px;
  height: 52px;
}
.conc-bar {
  flex: 1 1 0; min-width: 2px; border-radius: 2px 2px 0 0;
  background: var(--series-1);
}
/* Silent seats stay visible as a stub rather than vanishing — "nothing there"
   is the finding, so it has to be countable on screen. */
.conc-bar.is-zero { background: var(--axis); }
.conc-crit .conc-bar { background: var(--critical); }
.conc-warn .conc-bar { background: var(--serious); }
.conc-crit .conc-bar.is-zero,
.conc-warn .conc-bar.is-zero { background: var(--axis); }

/* Silent user rows in the roster — dimmed with a faint red wash so a dead
   seat reads as dead without shouting over the active ones. */
tbody tr.u-silent > td:first-child { box-shadow: inset 3px 0 0 var(--critical); }
tr.u-silent { background: color-mix(in srgb, var(--critical) 5%, transparent); }
tr.u-silent:hover { background: color-mix(in srgb, var(--critical) 9%, transparent); }

/* Admin contacts on the marketing shortlist. These are the people to ring, so
   they get the name at full strength and the address and number as live
   mailto:/tel: links — the point is to act without leaving the page. */
.contact-strip {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.contact-chip {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  font-size: 12.5px; padding: 5px 10px; border-radius: var(--radius-sm);
  background: var(--plane); border: 1px solid var(--border);
}
.contact-chip .cc-name { font-weight: 600; color: var(--text-primary); }
.contact-chip a { color: var(--text-secondary); text-decoration: none; }
.contact-chip a:hover { color: var(--series-1); text-decoration: underline; }

.btn.icon { padding: 4px 8px; font-size: 14px; line-height: 1; }

/* ------------------------------------------------------------- tiles */

.tiles.k5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .tiles.k5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .tiles.k5 { grid-template-columns: repeat(2, 1fr); } }

.tile.danger { border-left: 3px solid var(--critical); }
.tile .value.sm { font-size: 19px; }
.verdict-up { color: var(--success-text); }
.verdict-down { color: var(--critical); }
.verdict-flat { color: var(--text-muted); }

/* -------------------------------------------------------- tier pills */

.pill.tier-power .swatch { background: var(--tier-power); }
.pill.tier-active .swatch { background: var(--tier-active); }
.pill.tier-light .swatch { background: var(--tier-light); }
.pill.tier-dormant .swatch { background: var(--tier-dormant); }
.pill.tier-none .swatch { background: var(--tier-none); }

.tag.sent-good { border-color: var(--good); color: var(--success-text); }
.tag.sent-mid { border-color: var(--axis); }
.tag.sent-bad { border-color: var(--critical); color: var(--critical); }

/* Deactivated in LeadRat. Filled rather than outlined, unlike every other tag,
   because it overrides everything next to it — a Power tier pill on a closed
   account is actively misleading, and this has to win the glance. */
.tag.deactivated {
  background: var(--critical); border-color: var(--critical);
  color: #fff; cursor: help;
}
tr.is-deactivated td { opacity: 0.55; }
tr.is-deactivated td:first-child, tr.is-deactivated td .tag.deactivated { opacity: 1; }

.delta.unreliable { opacity: .6; }
.delta .qmark {
  font-size: 9px; vertical-align: super; margin-left: 1px; cursor: help;
}

/* ------------------------------------------------------ action cards */

.action {
  border-left: 3px solid var(--cat-hygiene); background: var(--plane);
  border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0;
}
.action.act-rescue { border-left-color: var(--cat-rescue); }
.action.act-renewal { border-left-color: var(--cat-renewal); }
.action.act-activation { border-left-color: var(--cat-activation); }
.action.act-expansion { border-left-color: var(--cat-expansion); }
.action.compact { padding: 8px 10px; margin: 6px 0; }

.action-head {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 4px;
}
.act-cat {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
}
.act-urgency {
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 4px;
  background: var(--surface-1); border: 1px solid var(--border);
  color: var(--text-secondary);
}
.act-urgency.u-now { border-color: var(--critical); color: var(--critical); }
.act-urgency.u-this_week { border-color: var(--serious); }
.act-impact {
  margin-left: auto; font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--text-primary);
}
.act-title { font-size: 14px; font-weight: 650; margin-bottom: 3px; }
.action.compact .act-title { font-size: 13px; }
.act-why { font-size: 12.5px; color: var(--text-secondary); max-width: 78ch; }
.act-steps {
  margin: 8px 0 2px; padding-left: 20px; font-size: 12.5px;
  color: var(--text-secondary);
}
.act-steps li { margin-bottom: 3px; }

.lead-action {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.lead-action .action { margin-top: 0; }
.lead-cta { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Roomy hero: the recommended play gets the width, the actions a fixed rail. */
.lead-action.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 18px;
  align-items: stretch;
}
@media (max-width: 760px) { .lead-action.hero { grid-template-columns: 1fr; } }
.hero-play { min-width: 0; }
.hero-play .action { border-left-width: 4px; background: transparent; padding: 2px 0 0 14px; }
.hero-cta {
  display: flex; flex-direction: column; gap: 8px;
  border-left: 1px solid var(--border); padding-left: 18px;
}
@media (max-width: 760px) { .hero-cta { border-left: none; padding-left: 0; } }
.hero-cta .btn { width: 100%; justify-content: center; }
.btn.lg { padding: 10px 14px; font-size: 14px; }
.hero-meta { margin-top: auto; display: flex; flex-direction: column; gap: 7px; padding-top: 6px; }
.hero-meta > div { display: flex; flex-direction: column; gap: 1px; }
.hero-meta .k {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 700;
}
.hero-meta .v { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* Full-width blocks between the header and the two-column working area. */
.detail-full { margin-bottom: 14px; }

/* Long roster: scroll the table inside a capped box rather than stretching the
   whole page, with the header pinned so the columns stay labelled. */
.users-scroll { max-height: min(560px, 68vh); overflow-y: auto; }
.users-scroll thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-1);
  box-shadow: inset 0 -1px 0 var(--border);
}

.nextact {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px;
  border-radius: 4px; background: var(--plane); border: 1px solid var(--border);
  border-left: 3px solid var(--cat-hygiene); color: var(--text-secondary);
  max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nextact:hover { text-decoration: none; color: var(--text-primary); }
.nextact.act-rescue { border-left-color: var(--cat-rescue); }
.nextact.act-renewal { border-left-color: var(--cat-renewal); }
.nextact.act-activation { border-left-color: var(--cat-activation); }
.nextact.act-expansion { border-left-color: var(--cat-expansion); }

/* ----------------------------------------------------- urgent rows */

.urgent-row {
  display: flex; gap: 16px; padding: 12px 16px;
  border-bottom: 1px solid var(--grid); align-items: flex-start;
}
.urgent-row:last-child { border-bottom: none; }
.urgent-row:hover { background: var(--plane); }
.ur-main { flex: 1; min-width: 0; }
.ur-side {
  display: flex; gap: 18px; align-items: center; white-space: nowrap;
  padding-top: 2px;
}
.ur-side .m { text-align: right; }
.ur-side .k {
  font-size: 10.5px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .04em; font-weight: 600;
}
.ur-side .v { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13px; }
.ur-side .v.sm, .queue-metrics .v.sm { font-size: 12px; font-weight: 550; }

/* ------------------------------------------------------ workstreams */

.st-cat {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px;
  border-radius: 4px; background: var(--plane); border: 1px solid var(--border);
  border-left: 3px solid var(--cat-hygiene); color: var(--text-secondary);
}
.st-cat.cat-rescue { border-left-color: var(--cat-rescue); }
.st-cat.cat-renewal { border-left-color: var(--cat-renewal); }
.st-cat.cat-activation { border-left-color: var(--cat-activation); }
.st-cat.cat-expansion { border-left-color: var(--cat-expansion); }

.stream-row {
  display: flex; gap: 14px; align-items: center; padding: 13px 16px;
  border-bottom: 1px solid var(--grid); color: var(--text-primary);
}
.stream-row:last-child { border-bottom: none; }
.stream-row:hover { background: var(--plane); text-decoration: none; }
.sr-main { flex: 1; min-width: 0; }
.sr-title { display: block; font-weight: 620; font-size: 14px; }
.sr-sub { display: block; font-size: 12px; color: var(--text-muted); }
.sr-value {
  font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px;
  white-space: nowrap;
}
.sr-go { color: var(--text-muted); font-size: 16px; }

.streamlist { list-style: none; padding: 0; margin: 0; }
.streamlist li { padding: 7px 0; border-bottom: 1px solid var(--grid); }
.streamlist li:last-child { border-bottom: none; }
.streamlist a { display: flex; gap: 8px; align-items: center; }
.streamlist a:hover { text-decoration: none; }
.st-title {
  flex: 1; font-size: 12.5px; color: var(--text-primary); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.st-n { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; }
.st-val {
  font-size: 11.5px; color: var(--text-muted); text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------- charts */

.donut { width: 100%; max-width: 180px; height: auto; display: block; margin: 0 auto 12px; }
.donut-big {
  font-size: 30px; font-weight: 650; fill: var(--text-primary);
  font-family: var(--font);
}
.donut-sub {
  font-size: 11px; fill: var(--text-muted); font-family: var(--font);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}

.legend-list { list-style: none; padding: 0; margin: 0; }
.legend-list li { border-bottom: 1px solid var(--grid); }
.legend-list li:last-child { border-bottom: none; }
.legend-list a {
  display: flex; gap: 8px; align-items: center; padding: 6px 2px;
  color: var(--text-primary); font-size: 12.5px;
}
.legend-list a:hover { text-decoration: none; background: var(--plane); }
.legend-list .sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.legend-list .sw.tier-power { background: var(--tier-power); }
.legend-list .sw.tier-active { background: var(--tier-active); }
.legend-list .sw.tier-light { background: var(--tier-light); }
.legend-list .sw.tier-dormant { background: var(--tier-dormant); }
.legend-list .sw.tier-none { background: var(--tier-none); }
.lg-label { font-weight: 600; }
.lg-blurb { color: var(--text-muted); font-size: 11.5px; flex: 1; }
.lg-n { font-weight: 700; font-variant-numeric: tabular-nums; }
.lg-pct {
  color: var(--text-muted); font-size: 11.5px; width: 34px; text-align: right;
  font-variant-numeric: tabular-nums;
}

.riskbar { display: flex; gap: 2px; height: 12px; margin: 4px 0 10px; }
.riskbar div { border-radius: 2px; min-width: 3px; }
.riskbar .at-risk { background: var(--critical); }
.riskbar .protected { background: var(--good); }

.movers { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .movers { grid-template-columns: 1fr; } }
.moverlist { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.moverlist li {
  display: flex; justify-content: space-between; gap: 10px; padding: 5px 0;
  border-bottom: 1px solid var(--grid);
}
.moverlist li:last-child { border-bottom: none; }

.mv-abs {
  font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px;
  color: var(--text-secondary); margin-right: 8px;
}

.minibar {
  height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden;
  min-width: 60px;
}
.minibar div { height: 100%; background: var(--good); border-radius: 3px; }

/* ------------------------------------------------------------ misc */

.nudge {
  font-size: 12.5px; color: var(--text-secondary); background: var(--plane);
  border-left: 3px solid var(--warning); border-radius: var(--radius-sm);
  padding: 8px 10px;
}
/* For a statement of fact that changes what the page means, not a suggestion. */
.nudge.danger { border-left-color: var(--critical); }

.prefill { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: -4px 0 10px; }
.chip {
  font-size: 11.5px; padding: 3px 9px; border-radius: 20px; cursor: pointer;
  background: var(--surface-1); border: 1px dashed var(--axis);
  color: var(--text-secondary); font-family: var(--font);
}
.chip:hover { border-style: solid; color: var(--text-primary); background: var(--plane); }

.filters label.check {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px;
  font-weight: 600; color: var(--text-secondary); white-space: nowrap;
}
.filters label.check input { width: auto; }

table.dense tbody td { padding: 7px 9px; font-size: 12.5px; }
table.dense thead th { padding: 7px 9px; }

.pager {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border);
  flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary);
}
.pagebtns { display: flex; gap: 4px; flex-wrap: wrap; }

select[multiple] { padding: 4px; }
select[multiple] option { padding: 3px 6px; }

/* ---------------------------------------------------- onboarding */

.progress-track {
  height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden;
  margin-bottom: 14px;
}
.progress-fill {
  height: 100%; background: var(--good); border-radius: 4px;
  transition: width .2s;
}

.steplist { list-style: none; padding: 0; margin: 0; }
.steplist .step { border-bottom: 1px solid var(--grid); }
.steplist .step:last-child { border-bottom: none; }

.step-form {
  display: flex; align-items: center; gap: 10px; padding: 9px 0; flex-wrap: wrap;
}
.step-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: var(--text-muted); border: 2px solid var(--surface-1);
  box-shadow: 0 0 0 1px var(--axis);
}
.step.st-done .step-dot { background: var(--good); }
.step.st-in_progress .step-dot { background: var(--warning); }
.step.st-blocked .step-dot { background: var(--critical); }
.step.st-skipped .step-dot { background: var(--grid); }

.step-main { flex: 1; min-width: 170px; display: flex; flex-direction: column; }
.step-label { font-weight: 600; font-size: 13px; }
.step.st-done .step-label { color: var(--text-secondary); }
.step.st-skipped .step-label { color: var(--text-muted); text-decoration: line-through; }
.step-desc { font-size: 11.5px; color: var(--text-muted); }
.step-note {
  font-size: 12px; color: var(--text-secondary); margin-top: 3px;
  padding-left: 8px; border-left: 2px solid var(--axis);
}
.step-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.step-form select { width: auto; min-width: 116px; }
.step-notes { width: auto; flex: 1; min-width: 130px; }

/* ------------------------------------------------------- contacts */

.contactlist { list-style: none; padding: 0; margin: 0; }
.contactlist li { padding: 9px 0; border-bottom: 1px solid var(--grid); }
.contactlist li:last-child { border-bottom: none; }
.ct-head { display: flex; align-items: center; gap: 7px; }
.ct-name { font-weight: 620; font-size: 13px; }
.ct-role { font-size: 12px; color: var(--text-secondary); }
.ct-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; margin-top: 2px; }
.contactlist form { margin-top: 3px; }

/* ---------------------------------------------------- follow-up alerts */
/* A promised call is a commitment, so its strip is louder than the queue —
   a left border in the serious colour, not the plane background. */
.followup-alert { border-left: 3px solid var(--serious); }
.followup-list { list-style: none; margin: 0; padding: 0; }
.followup-list li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; border-top: 1px solid var(--grid);
}
.followup-list li.is-overdue { background: color-mix(in srgb, var(--critical) 7%, transparent); }
.fu-when { min-width: 150px; display: flex; gap: 8px; align-items: center; }
.fu-day { font-weight: 600; font-size: 13px; }
.fu-main { flex: 1; min-width: 200px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.fu-note { color: var(--text-secondary); font-size: 12.5px; }

/* Who scheduled the call vs whose account it is — two facts that a promise on
   someone else's book needs to keep straight. */
/* "was <tier>" note under a tier pill, so a moved tenant carries its origin. */
.tier-move { font-size: 11px; font-weight: 600; margin-top: 3px; white-space: nowrap; }
.tier-move.up { color: var(--good); }
.tier-move.down { color: var(--critical); }

.fu-people { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.fu-tag {
  font-size: 11px; padding: 1px 7px; border-radius: 10px;
  background: var(--plane); border: 1px solid var(--border);
  color: var(--text-secondary); white-space: nowrap;
}

/* ------------------------------------------------------- My Day controls */
.myday-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.view-seg a { letter-spacing: 0.01em; }

/* --------------------------------------------------------- calendar view */
/* Two-week strip: the shape of the fortnight in one compact row. Clear days
   are thin and quiet; busy days carry a count and pull the eye. */
.cal-week {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
}
.cal-chip {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 46px; padding: 6px 8px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-secondary); position: relative; line-height: 1.1;
}
.cal-chip:hover { text-decoration: none; }
.cal-chip .chip-dow { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.cal-chip .chip-dnum { font-size: 15px; font-weight: 650; color: var(--text-primary); }
.cal-chip.is-weekend { background: var(--plane); }
.cal-chip.is-weekend .chip-dnum { color: var(--text-secondary); }
.cal-chip.has-items {
  border-color: color-mix(in srgb, var(--series-1) 45%, var(--border));
  background: color-mix(in srgb, var(--series-1) 8%, var(--surface-1));
}
.cal-chip.is-today {
  border-color: var(--series-1);
  box-shadow: inset 0 0 0 1px var(--series-1);
}
.cal-chip.is-today .chip-dnum { color: var(--series-1); }
.cal-chip .chip-count {
  position: absolute; top: -6px; right: -6px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--series-1); color: #fff; font-size: 10.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.cal-block { margin-bottom: 14px; }

/* Agenda: one group per day that actually has follow-ups. No empty rows. */
.cal-daygroup + .cal-daygroup { border-top: 1px solid var(--border); }
.cal-dayhead {
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
  padding: 9px 16px; background: var(--plane);
  position: sticky; top: 52px; z-index: 5;
}
.cal-dayhead.is-today { box-shadow: inset 3px 0 0 var(--series-1); }
.cal-dayname { font-weight: 680; font-size: 13.5px; }
.cal-daydate { color: var(--text-secondary); font-size: 12.5px; }
.cal-daycount {
  margin-left: auto; background: var(--axis); color: var(--text-primary);
  border-radius: 20px; font-size: 11px; font-weight: 600; padding: 1px 9px;
}
.cal-rows { display: flex; flex-direction: column; }
.cal-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 8px 16px; border-top: 1px solid var(--grid);
}
.cal-row:first-child { border-top: none; }
.cal-row:hover { background: var(--plane); }
.cal-row-main {
  flex: 1; min-width: 0; display: flex; align-items: baseline;
  gap: 8px; flex-wrap: wrap;
}
.cal-time {
  min-width: 84px; flex-shrink: 0; color: var(--text-secondary);
  font-size: 12.5px; font-variant-numeric: tabular-nums; font-weight: 600;
}
@media (max-width: 640px) {
  .cal-row { flex-wrap: wrap; gap: 6px; }
  .cal-time { min-width: 0; }
}

/* ================================================================= *
 *  TENANT DETAIL — header, briefing, KPIs, tabs, drawer             *
 * ================================================================= */
.td-head {
  display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px 20px;
  align-items: start; margin-bottom: 14px;
}
.td-back { font-size: 12px; color: var(--text-muted); }
.td-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 4px; }
.td-title h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.td-sub { display: flex; gap: 6px; flex-wrap: wrap; color: var(--text-secondary); font-size: 12.5px; }
.td-facts {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 4px 0 0;
  padding: 12px 0 0; border-top: 1px solid var(--border);
}
.td-facts > div { display: flex; flex-direction: column; gap: 2px; }
.td-facts dt { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; }
.td-facts dd { margin: 0; font-size: 14px; font-weight: 650; color: var(--text-primary); display: flex; align-items: baseline; gap: 7px; }
.td-facts dd .q { font-size: 11px; font-weight: 500; color: var(--text-secondary); }
.td-facts dd .neg { color: var(--critical); }
.td-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-self: end; }

.briefing { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 14px; margin-bottom: 16px; }
.brief-card {
  padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--border));
  border-left: 4px solid var(--warning);
  background: color-mix(in srgb, var(--warning) 8%, var(--surface-1));
}
.brief-flag { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--warning) 55%, var(--text-primary)); }
.brief-headline { margin: 5px 0 4px; font-size: 17px; letter-spacing: -0.01em; }
.brief-summary { margin: 0 0 12px; font-size: 13.5px; color: var(--text-secondary); max-width: 72ch; }
.brief-actions { margin: 0; padding: 0; list-style: none; counter-reset: b; display: flex; flex-direction: column; gap: 6px; }
.brief-actions li { counter-increment: b; }
.brief-step {
  display: flex; gap: 9px; align-items: baseline; width: 100%; text-align: left;
  padding: 8px 11px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface-1); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 13px; font-family: var(--font);
}
.brief-step::before { content: counter(b); font-weight: 700; color: var(--warning); font-variant-numeric: tabular-nums; }
.brief-step:hover { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 7%, var(--surface-1)); }
.brief-side {
  padding: 14px 16px; border-radius: var(--radius); background: var(--surface-1);
  border: 1px solid var(--border); display: flex; flex-direction: column; gap: 11px;
}
.bs-row { display: flex; flex-direction: column; gap: 2px; }
.bs-k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 700; }
.bs-v { font-size: 13.5px; font-weight: 600; }
.bs-row.is-gap { border-left: 3px solid var(--warning); padding-left: 9px; margin-left: -12px; }
.bs-gap { align-self: start; font-size: 12.5px; font-weight: 650; cursor: pointer;
  color: color-mix(in srgb, var(--warning) 50%, var(--text-primary));
  background: none; border: none; padding: 0; font-family: var(--font); text-align: left; }
.bs-gap:hover { text-decoration: underline; }

.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 13px 15px; border-radius: var(--radius); background: var(--surface-1);
  border: 1px solid var(--border); border-top: 3px solid var(--border); }
.kpi-k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 700; }
.kpi-v { font-size: 30px; font-weight: 700; line-height: 1.05; margin: 5px 0 3px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi-v .kpi-u { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-left: 2px; }
.kpi-v .neg { color: var(--critical); }
.kpi-s { font-size: 11.5px; color: var(--text-secondary); }
.kpi.sev-crit { border-top-color: var(--critical); }
.kpi.sev-crit .kpi-v { color: var(--critical); }
.kpi.sev-warn { border-top-color: var(--warning); }
.kpi.sev-ok { border-top-color: var(--good); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
  overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 9px 15px; border: none; background: none; cursor: pointer; white-space: nowrap;
  font-family: var(--font); font-size: 13.5px; font-weight: 600; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text-primary); }
.tab.on { color: var(--series-1); border-bottom-color: var(--series-1); }
.tab-n { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 9px; margin-left: 5px;
  background: var(--plane); color: var(--text-secondary); }
.tab.on .tab-n { background: color-mix(in srgb, var(--series-1) 15%, var(--surface-1)); color: var(--series-1); }
.tabpanel[hidden] { display: none; }

.ov-grid { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 14px; align-items: start; }
.ov-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ov-rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 64px; }

.drivers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.dr { padding: 9px 0 9px 13px; border-left: 3px solid var(--axis); border-top: 1px solid var(--grid); }
.dr:first-child { border-top: none; }
.dr-t { display: block; font-size: 13px; font-weight: 650; }
.dr-d { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.dr.dr-high { border-left-color: var(--critical); }
.dr.dr-med { border-left-color: var(--warning); }
.dr.dr-pos { border-left-color: var(--good); }

.kc-name { font-size: 14px; font-weight: 650; display: flex; gap: 7px; align-items: center; }
.kc-role { font-size: 12.5px; color: var(--text-secondary); margin: 1px 0 4px; }
.kc-meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.kv.compact dt, .kv.compact dd { padding-top: 3px; padding-bottom: 3px; }

.users-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 0 14px 12px; }
.td-search { flex: 1; min-width: 180px; max-width: 320px; padding: 6px 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1); color: var(--text-primary); font-family: var(--font); }
.users-toolbar #user-count { margin-left: auto; }

.drawer-overlay { position: fixed; inset: 0; background: rgba(11,11,11,0.32); z-index: 90; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(520px, 94vw); z-index: 95;
  background: var(--surface-1); border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px -12px rgba(0,0,0,0.28);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.18s ease; will-change: transform; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-x { border: none; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 0 4px; }
.drawer-x:hover { color: var(--text-primary); }
.drawer-body { padding: 16px 18px; overflow-y: auto; }
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .briefing { grid-template-columns: 1fr; }
  .ov-grid { grid-template-columns: 1fr; }
  .ov-rail { position: static; }
}
@media (max-width: 720px) {
  .td-head { grid-template-columns: 1fr; }
  .td-actions { justify-self: start; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
