/* Layout, controls, tables and chart marks of the operator console. Colours are tokens only. */

/* ---- data colour jobs: one hue, plus grey and status ---- */
:root {
  --ord-1: var(--accent);
  --ord-2: color-mix(in srgb, var(--accent) 80%, var(--surface));
  --ord-3: color-mix(in srgb, var(--accent) 62%, var(--surface));
  --ord-4: color-mix(in srgb, var(--accent) 46%, var(--surface));
  /* Clears 3:1 on the surface. --faint is decoration only (THEMING section 6). */
  --neutral-mark: color-mix(in srgb, var(--muted) 80%, var(--surface));
  --heat-1: color-mix(in srgb, var(--accent) 8%, var(--surface));
  --heat-2: color-mix(in srgb, var(--accent) 18%, var(--surface));
  --heat-3: color-mix(in srgb, var(--accent) 32%, var(--surface));
  --heat-4: color-mix(in srgb, var(--accent) 48%, var(--surface));
  --heat-5: color-mix(in srgb, var(--accent) 68%, var(--surface));
  --heat-6: var(--accent);
  /* Ink on a heat cell. Contrast on the mixes above is at least 4.75:1 in both modes. */
  --heat-ink-1: var(--text);
  --heat-ink-2: var(--text);
  --heat-ink-3: var(--text);
  --heat-ink-4: var(--text);
  --heat-ink-5: var(--text);
  --heat-ink-6: var(--accent-ink);
  --top-h: 44px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ord-2: color-mix(in srgb, var(--accent) 78%, var(--surface));
    --ord-3: color-mix(in srgb, var(--accent) 58%, var(--surface));
    --ord-4: color-mix(in srgb, var(--accent) 42%, var(--surface));
    --neutral-mark: color-mix(in srgb, var(--muted) 68%, var(--surface));
    --heat-1: color-mix(in srgb, var(--accent) 8%, var(--surface));
    --heat-2: color-mix(in srgb, var(--accent) 18%, var(--surface));
    --heat-3: color-mix(in srgb, var(--accent) 32%, var(--surface));
    --heat-4: color-mix(in srgb, var(--accent) 48%, var(--surface));
    --heat-5: color-mix(in srgb, var(--accent) 68%, var(--surface));
    --heat-6: var(--accent);
  }
}
:root[data-theme="dark"] {
  --ord-2: color-mix(in srgb, var(--accent) 78%, var(--surface));
  --ord-3: color-mix(in srgb, var(--accent) 58%, var(--surface));
  --ord-4: color-mix(in srgb, var(--accent) 42%, var(--surface));
  --neutral-mark: color-mix(in srgb, var(--muted) 68%, var(--surface));
  --heat-1: color-mix(in srgb, var(--accent) 8%, var(--surface));
  --heat-2: color-mix(in srgb, var(--accent) 18%, var(--surface));
  --heat-3: color-mix(in srgb, var(--accent) 32%, var(--surface));
  --heat-4: color-mix(in srgb, var(--accent) 48%, var(--surface));
  --heat-5: color-mix(in srgb, var(--accent) 68%, var(--surface));
  --heat-6: var(--accent);
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-base)/var(--lh) var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-wash); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: var(--fs-xs); }
.quiet { color: var(--muted); padding: var(--sp-3) 0; }
.plot-empty { color: var(--muted); font-size: var(--fs-sm); padding: var(--sp-3) 0; text-align: center; }
.icon { display: block; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---- controls ---- */
input, select, button { font-family: var(--sans); font-size: var(--fs-ctl); color: var(--text); }
input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 4px var(--sp-2);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
input::placeholder { color: var(--faint); }
input:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-ctl);
  font-weight: var(--fw-medium);
  padding: 4px var(--sp-3);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-small { padding: 2px var(--sp-2); font-size: var(--fs-sm); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: var(--fw-semibold); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-link { background: none; border: 0; padding: 2px var(--sp-1); color: var(--accent); cursor: pointer; font-size: var(--fs-sm); }
.btn-link:hover { text-decoration: underline; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---- chips ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  font-size: var(--fs-xs);
  line-height: 18px;
  white-space: nowrap;
  color: var(--text-2);
}
.chip-accent { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent); font-weight: var(--fw-semibold); }
.chip-ok { background: var(--ok-wash); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); }
.chip-warn { background: var(--warn-wash); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.chip-bad { background: var(--bad-wash); border-color: var(--bad-line); color: var(--bad); }
.chip-muted { color: var(--muted); }
.chip-dot::before { content: ""; width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--accent); }

/* ---- shell ---- */
.top { position: sticky; top: 0; z-index: 12; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-in {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  height: var(--top-h);
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}
.brand { display: inline-flex; align-items: baseline; gap: var(--sp-1); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-kite { color: var(--accent); font-size: var(--fs-md); font-weight: var(--fw-bold); letter-spacing: -.02em; }
.brand-sub { color: var(--muted); font-size: var(--fs-sm); }
.nav { display: flex; align-items: stretch; align-self: stretch; gap: var(--sp-1); min-width: 0; }
.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--sp-2);
  color: var(--text-2);
  font-weight: var(--fw-medium);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.nav-link:hover { color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.top-end { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.updated { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.filter-band {
  position: sticky;
  top: calc(var(--top-h) + 1px);
  z-index: 11;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.page, .filters { max-width: 1480px; margin: 0 auto; padding-left: var(--sp-4); padding-right: var(--sp-4); }
.page { padding-top: var(--sp-3); padding-bottom: var(--sp-8); }
.view-status { color: var(--muted); padding: var(--sp-2) 0; }
.view-status.is-error { color: var(--bad); }
.view-root { display: flex; flex-direction: column; gap: var(--sp-3); transition: opacity var(--dur-2) var(--ease); }
.is-stale { opacity: .55; transition: opacity var(--dur-2) var(--ease); }

/* ---- filter row ---- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.seg { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.seg-btn {
  background: none;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 3px var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
}
.seg-btn:hover { background: var(--surface-2); color: var(--text); }
.seg > .seg-btn:first-child { border-radius: 5px 0 0 5px; }
.seg .pop-wrap .seg-btn { border-right: 0; border-radius: 0 5px 5px 0; }
.seg-btn[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent); font-weight: var(--fw-semibold); }
.f-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 3px var(--sp-2);
  color: var(--text-2);
  font-size: var(--fs-sm);
  white-space: nowrap;
  cursor: pointer;
}
.f-btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--text); }
.f-btn .icon { color: var(--muted); }
.f-btn.is-active { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--text); }
.f-count {
  min-width: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--fs-xs);
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.f-search { width: 160px; padding: 3px var(--sp-2); font-size: var(--fs-sm); }
.f-chips { display: contents; }
.f-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 280px;
  padding-left: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
}
.f-chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-chip .icon-btn { width: 20px; height: 20px; }

/* ---- popover ---- */
.pop-wrap { position: relative; display: inline-flex; }
.pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: 300px;
  max-height: 420px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-2);
}
.pop-end { left: auto; right: 0; }
.pop-search { width: 100%; }
.pop-list { display: flex; flex-direction: column; overflow: auto; min-height: 0; flex: 1 1 auto; }
.pop-msg { color: var(--muted); font-size: var(--fs-sm); padding: var(--sp-1); }
.pop-msg:empty { display: none; }
.pop-form, .pop-fields-stack { display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
.pop-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); width: 100%; }
.pop-fields input, .pop-fields-stack input { width: 100%; }
.pop-fields-stack .field { width: 100%; }
.field { display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: var(--fs-xs); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.opt { display: flex; align-items: center; gap: var(--sp-2); padding: 3px var(--sp-1); border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-sm); }
.opt:hover { background: var(--surface-2); }
.opt input { flex: none; margin: 0; accent-color: var(--accent); }
.opt-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: var(--lh-tight); }
.opt-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-sub { color: var(--muted); font-size: var(--fs-xs); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-n { flex: none; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.saved { display: flex; align-items: center; gap: var(--sp-1); }
.saved-link { flex: 1 1 auto; min-width: 0; padding: 3px var(--sp-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.saved-form { display: flex; gap: var(--sp-1); }
.saved-form input { flex: 1 1 auto; min-width: 0; }

/* ---- tiles and figures ---- */
.tiles { display: grid; grid-template-columns: repeat(var(--tile-cols), minmax(0, 1fr)); gap: var(--sp-2); }
.tile, .hero {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
}
.fig-link:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); text-decoration: none; }
.tile-label, .hero-label { color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.tile-value { font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: var(--lh-tight); letter-spacing: -.01em; }
.hero-value { font-size: 48px; font-weight: var(--fw-semibold); line-height: 1.1; letter-spacing: -.02em; }
[data-tone="warn"] { color: var(--warn); }
[data-tone="bad"] { color: var(--bad); }
[data-tone="ok"] { color: var(--ok); }
.tile-sub, .hero-sub { color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-tight); }
.fig-delta { color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.fig-delta.is-good { color: var(--ok); }
.fig-delta.is-bad { color: var(--bad); }

/* ---- cards ---- */
.cards-2, .cards-3 { display: grid; gap: var(--sp-3); align-items: stretch; }
.cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards-2.is-solo { grid-template-columns: minmax(0, 1fr); }
.card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.card-heading { min-width: 0; }
.card-title { font-size: var(--fs-base); font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
.card-sub { margin-top: 2px; color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-tight); }
.card-actions { display: flex; flex: none; align-items: center; gap: var(--sp-1); }
.card-body { min-width: 0; }
.card-note { margin-top: auto; color: var(--muted); font-size: var(--fs-xs); line-height: var(--lh-tight); }
.card-table { padding-bottom: 0; }
.card-table .card-body { margin: 0 calc(-1 * var(--sp-4)); }

/* ---- legend ---- */
.legend { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); color: var(--text-2); font-size: var(--fs-xs); }
.lg-item { display: inline-flex; align-items: center; gap: var(--sp-1); }
.lg-key { flex: none; background: var(--key); }
.lg-rect { width: 10px; height: 10px; border-radius: 2px; }
.lg-line { width: 14px; height: 2px; border-radius: 1px; }
.scale { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; align-self: flex-start; }
.scale-step { width: 16px; height: 10px; background: var(--key); }
.scale-text:first-child { margin-right: var(--sp-1); }
.scale-text:last-child { margin-left: var(--sp-1); }

/* ---- charts ---- */
.plot { width: 100%; min-width: 0; overflow: hidden; }
.chart, .segbar, .spark { display: block; }
.chart text, .segbar text { font-family: var(--sans); }
.axis-text { fill: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.axis-x { fill: var(--muted); font-size: var(--fs-xs); }
.axis-label { fill: var(--text-2); font-size: var(--fs-xs); }
/* A value label can sit on a gridline. */
.value-text { fill: var(--text-2); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.cell-text { font-size: var(--fs-xs); font-variant-numeric: tabular-nums; pointer-events: none; }
.seg-text { font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.chart-empty { fill: var(--muted); font-size: var(--fs-sm); }
.axis-grid { stroke: var(--line-soft); stroke-width: 1; }
.axis-base { stroke: var(--line); stroke-width: 1; }
.line-mark { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.dot-mark { stroke: var(--surface); stroke-width: 2; }
.crosshair { stroke: var(--muted); stroke-width: 1; }
.hit { fill: transparent; pointer-events: all; }
.band { outline: none; cursor: default; }
a.band { cursor: pointer; }
a.band:hover { text-decoration: none; }
.band:hover .mark, .band:focus .mark { opacity: .78; }
.band:focus-visible .hit { stroke: var(--accent); stroke-width: 1.5; }
.chart:focus-visible, .segbar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.segbar { cursor: default; }

/* ---- tooltip ---- */
.tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  transform: translate(var(--tip-x, 0), var(--tip-y, 0));
  max-width: 320px;
  padding: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-tight);
  pointer-events: none;
}
.tip-title { margin-bottom: var(--sp-1); color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.tip-row { display: flex; align-items: center; gap: var(--sp-1); padding: 1px 0; }
.tip-row b { font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; color: var(--text); }
.tip-row span { color: var(--muted); }
.tip-key { flex: none; width: 12px; height: 2px; border-radius: 1px; background: var(--key); }
.tip-note { margin-top: var(--sp-1); color: var(--muted); font-size: var(--fs-xs); overflow-wrap: anywhere; }

/* ---- tables ---- */
.tbl { display: flex; flex-direction: column; min-width: 0; }
.tbl-frame { position: relative; isolation: isolate; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tbl-frame::before, .tbl-frame::after { content: ""; position: absolute; top: 0; bottom: 0; z-index: 4; width: 20px; pointer-events: none; opacity: 0; }
.tbl-frame::before { left: var(--tbl-pin, 0px); border-left: 1px solid var(--line); background: linear-gradient(to right, color-mix(in srgb, var(--text) 14%, transparent), transparent); }
.tbl-frame::after { right: 0; border-right: 1px solid var(--line); background: linear-gradient(to left, color-mix(in srgb, var(--text) 14%, transparent), transparent); }
.tbl-frame.more-left::before, .tbl-frame.more-right::after { opacity: 1; }
.tbl-wrap { overflow: auto; max-height: var(--tbl-max, none); border-top: 1px solid var(--line-soft); scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.tbl table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; font-size: var(--fs-ctl); }
.tbl th, .tbl td { padding: 4px var(--sp-2); text-align: left; white-space: nowrap; vertical-align: middle; border-bottom: 1px solid var(--line-soft); }
.tbl th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom-color: var(--line);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.tbl th:first-child, .tbl td:first-child { padding-left: var(--sp-4); }
.tbl th:last-child, .tbl td:last-child { padding-right: var(--sp-4); }
.tbl .num { text-align: right; }
.tbl .pin { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.tbl th.pin { z-index: 3; }
.th-btn { display: flex; align-items: center; gap: 2px; width: 100%; padding: 0; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.th-btn:hover { color: var(--text); }
th[aria-sort] .th-btn { color: var(--text); }
.num .th-btn { justify-content: flex-end; }
.num .sort-ind { order: -1; }
.sort-ind { flex: none; width: 8px; text-align: center; }
.row-link-row { cursor: pointer; }
.row-link-row:hover td, .row-link-row:hover .pin { background: var(--surface-2); }
.is-selected td, .is-selected .pin { background: var(--accent-wash); }
.row-link-row.is-selected:hover td { background: var(--accent-wash); }
.row-link { color: inherit; }
.tbl-empty { padding: var(--sp-6) var(--sp-3); text-align: center !important; color: var(--muted); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; min-height: 32px; padding: var(--sp-1) var(--sp-4); border-top: 1px solid var(--line-soft); color: var(--muted); font-size: var(--fs-xs); }
.tbl-note-bad { color: var(--bad); }
.tbl-pager { display: inline-flex; align-items: center; gap: var(--sp-2); }
.tbl-page { font-variant-numeric: tabular-nums; }
.card:not(.card-table) .tbl { margin: 0 calc(-1 * var(--sp-4)); }
.two-line { line-height: var(--lh-tight); }
.two-line-sub { margin-top: 1px; color: var(--muted); font-size: var(--fs-xs); }
.cell-clip { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.cell-wide { max-width: 250px; }
.cell-name { max-width: 170px; }
.cell-email { max-width: 210px; }

/* ---- drawer ---- */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: min(440px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}
.drawer:focus { outline: none; }
.drawer-head { display: flex; justify-content: flex-end; padding: var(--sp-2) var(--sp-3) 0; }
.drawer-close { display: inline-flex; padding: var(--sp-1); border-radius: var(--r-sm); color: var(--muted); }
.drawer-close:hover { background: var(--surface-2); color: var(--text); }
.drawer-body { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: var(--sp-4); padding: 0 var(--sp-4) var(--sp-5); }
.drawer-title { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
.drawer-title h2 { font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: var(--lh-tight); overflow-wrap: anywhere; }
.drawer-label { margin-bottom: var(--sp-1); color: var(--muted); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.drawer-url { display: block; font-family: var(--mono); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.drawer-error { color: var(--bad); }
.mini-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); }
.mini { padding: var(--sp-1) var(--sp-2); border: 1px solid var(--line); border-radius: var(--r-sm); min-width: 0; }
.mini-value { font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: var(--lh-tight); overflow-wrap: anywhere; }
.mini-label { color: var(--muted); font-size: var(--fs-xs); }
.facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 3px var(--sp-3); margin: 0; font-size: var(--fs-ctl); line-height: var(--lh-tight); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---- sign-in ---- */
.signin {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: min(340px, 100% - var(--sp-8));
  margin: 8vh auto 0;
  padding: var(--sp-6) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  text-align: center;
}
.signin-brand { color: var(--accent); font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: -.02em; }
.signin-sub { margin-bottom: var(--sp-2); color: var(--muted); font-size: var(--fs-sm); }
.signin input { width: 100%; }
.signin .btn { justify-content: center; }
.signin-error { min-height: 19px; color: var(--bad); font-size: var(--fs-sm); }

/* ---- narrow screens ---- */
@media (max-width: 1240px) {
  .tiles { grid-template-columns: repeat(var(--tile-cols-narrow), minmax(0, 1fr)); }
  /* An odd count leaves one free track at the end, and the last tile takes it. */
  .tiles > :last-child:nth-child(odd) { grid-column: span 2; }
}
@media (max-width: 1000px) {
  .cards-2, .cards-3 { grid-template-columns: minmax(0, 1fr); }
  .filter-band { position: static; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-end .updated { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
