/*
 * Vehlo OS design system. Vehlo's brand is black, white and signal yellow with a
 * condensed uppercase display face and squared corners. Yellow is used as a
 * fill with black text (it fails contrast as text on white), and the navigation
 * rail stays black in both themes, as on vehlo.com.
 */

:root {
  --font-body: "Inter Variable", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --brand: #fac300;
  --brand-strong: #e3b100;
  --brand-ink: #111111;
  --orange: #ff7f09;
  --green: #00bf6c;

  --radius: 3px;
  --radius-lg: 6px;
  --rail-w: 248px;
  --topbar-h: 56px;

  --rail-bg: #0b0b0b;
  --rail-text: #d9d9d4;
  --rail-text-dim: #8c8c86;
  --rail-hover: #1c1c1c;
  --rail-active: #242424;
  --rail-border: #222222;

  --shadow-1: 0 1px 2px rgba(17, 17, 17, 0.06);
  --shadow-2: 0 8px 28px rgba(17, 17, 17, 0.14);
  --shadow-3: 0 20px 60px rgba(17, 17, 17, 0.28);
}

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --surface-3: #efefeb;
  --border: #e2e2dc;
  --border-strong: #c8c8c0;
  --text: #121212;
  --text-2: #4b4b47;
  --text-3: #6f6f69;
  --brand-soft: #fff5cc;
  --brand-text: #7a5d00;
  --focus: #121212;
  --success: #087a46;
  --success-soft: #e2f6ec;
  --warning: #b85a00;
  --warning-soft: #fff0df;
  --danger: #c4281c;
  --danger-soft: #fdeceb;
  --info: #1d5fd1;
  --info-soft: #e8f0fd;
  --overlay: rgba(17, 17, 17, 0.45);
  --chart-neutral: #3d3d3a;
  --chart-grid: #e6e6e0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0f;
  --surface: #181818;
  --surface-2: #1e1e1e;
  --surface-3: #272727;
  --border: #2d2d2d;
  --border-strong: #404040;
  --text: #f3f3f0;
  --text-2: #b9b9b3;
  --text-3: #86867f;
  --brand-soft: #3b2f00;
  --brand-text: #fac300;
  --focus: #fac300;
  --success: #2fd48a;
  --success-soft: #0f2e21;
  --warning: #ff9a3d;
  --warning-soft: #3a2410;
  --danger: #ff6b61;
  --danger-soft: #3a1512;
  --info: #6ea8ff;
  --info-soft: #14254a;
  --overlay: rgba(0, 0, 0, 0.62);
  --chart-neutral: #d7dade;
  --chart-grid: #2e2e2e;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 20px 60px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--brand); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--font-mono); font-size: 12.5px; }
::selection { background: var(--brand); color: var(--brand-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.display { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.ti { font-size: 18px; line-height: 1; }
[hidden] { display: none !important; }

/* ---- app frame -------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); height: 100vh; }
.app.rail-collapsed { --rail-w: 60px; }

.rail { background: var(--rail-bg); color: var(--rail-text); display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--rail-border); }
.rail-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--rail-border); flex: none; text-decoration: none; }
.wordmark { font-family: var(--font-body); font-weight: 800; font-size: 21px; letter-spacing: -0.03em; color: #fff; line-height: 1; }
.wordmark b { color: var(--brand); font-weight: 800; }
.wordmark-os { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em; font-size: 15px; font-weight: 700; color: #0b0b0b; background: var(--brand); padding: 1px 6px 0; line-height: 1.35; border-radius: 2px; }
.rail-scroll { flex: 1; overflow-y: auto; padding: 10px 8px 16px; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.rail-section { margin-top: 14px; }
.rail-section:first-child { margin-top: 4px; }
.rail-heading { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; cursor: pointer; padding: 6px 8px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; font-weight: 600; color: var(--rail-text-dim); text-align: left; }
.rail-heading:hover { color: #fff; }
.rail-heading .ti { font-size: 15px; }
.rail-heading .chev { margin-left: auto; transition: transform 0.15s; font-size: 14px; }
.rail-section.closed .chev { transform: rotate(-90deg); }
.rail-section.closed .rail-items { display: none; }
.rail-group { padding: 8px 8px 2px; font-size: 11px; color: #6b6b66; letter-spacing: 0.02em; }
.rail-link { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius); color: var(--rail-text); text-decoration: none; font-size: 13.5px; position: relative; }
.rail-link .ti { color: var(--rail-text-dim); font-size: 17px; flex: none; }
.rail-link:hover { background: var(--rail-hover); color: #fff; }
.rail-link.active { background: var(--rail-active); color: #fff; }
.rail-link.active::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 3px; background: var(--brand); }
.rail-link.active .ti { color: var(--brand); }
.rail-foot { border-top: 1px solid var(--rail-border); padding: 10px 12px; font-size: 11.5px; color: var(--rail-text-dim); display: flex; align-items: center; gap: 8px; flex: none; }
.app.rail-collapsed .rail-link span, .app.rail-collapsed .rail-heading span, .app.rail-collapsed .rail-heading .chev,
.app.rail-collapsed .rail-group, .app.rail-collapsed .wordmark-os, .app.rail-collapsed .rail-foot span { display: none; }
.app.rail-collapsed .rail-brand { padding: 0; justify-content: center; }
.app.rail-collapsed .wordmark { font-size: 0; }
.app.rail-collapsed .wordmark b { font-size: 24px; }
.app.rail-collapsed .rail-link, .app.rail-collapsed .rail-heading { justify-content: center; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 20px 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumbs b { color: var(--text); font-weight: 600; }
.topbar .spacer { flex: 1; }
.searchbox { display: flex; align-items: center; gap: 8px; height: 34px; min-width: 300px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-3); cursor: pointer; font-size: 13px; }
.searchbox:hover { border-color: var(--border-strong); }
.kbd { font-family: var(--font-mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--border-strong); border-radius: 3px; color: var(--text-2); background: var(--surface); }
.searchbox .kbd { margin-left: auto; }
.content { flex: 1; overflow-y: auto; min-height: 0; }
.content-inner { max-width: 1480px; margin: 0 auto; padding: 24px 28px 64px; }

/* ---- page ------------------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .titles { min-width: 0; flex: 1; }
.page-title { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.03em; font-size: 30px; font-weight: 700; line-height: 1.1; }
.page-sub { color: var(--text-2); margin-top: 4px; max-width: 80ch; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-title { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em; font-size: 15px; font-weight: 600; color: var(--text-2); margin: 26px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(max(var(--min, 220px), calc((100% - (var(--cols, 3) - 1) * 14px) / var(--cols, 3))), 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row > .select, .row > .input { width: auto; }
.grow { flex: 1; min-width: 0; }
@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform 0.2s; }
  .app.rail-open .rail { transform: none; }
  .searchbox { min-width: 0; }
  .searchbox span.label { display: none; }
  .content-inner { padding: 16px 14px 48px; }
}

/* ---- card ------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-head .titles { flex: 1; min-width: 0; }
.card-title { font-weight: 600; font-size: 14px; }
.card-sub { color: var(--text-3); font-size: 12.5px; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12.5px; }
.card.clickable { cursor: pointer; transition: border-color 0.12s, box-shadow 0.12s; }
.card.clickable:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }

.kpi { padding: 14px 16px; position: relative; }
.kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; background: var(--border-strong); }
.kpi.tone-brand::before { background: var(--brand); }
.kpi.tone-success::before { background: var(--success); }
.kpi.tone-danger::before { background: var(--danger); }
.kpi.tone-warning::before { background: var(--warning); }
.kpi-label { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.1em; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.kpi-value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-3); }

/* ---- buttons ---------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-3); }
.btn .ti { font-size: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--surface); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- badges ----------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 2px; font-size: 11.5px; font-weight: 600; line-height: 18px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.brand { background: var(--brand-soft); color: var(--brand-text); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.solid { background: var(--brand); color: var(--brand-ink); }
.badge .ti { font-size: 13px; }
.demo-flag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px dashed var(--border-strong); border-radius: 2px; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--brand) 18%, transparent) 6px 12px); }

/* ---- forms ------------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .err { font-size: 12px; color: var(--danger); }
.input, .select, .textarea { height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); width: 100%; min-width: 0; }
.textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input.sm, .select.sm { height: 28px; font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.toggle { position: relative; width: 36px; height: 20px; flex: none; border-radius: 10px; background: var(--border-strong); border: 0; cursor: pointer; transition: background 0.15s; padding: 0; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.toggle[aria-checked="true"] { background: var(--brand); }
.toggle[aria-checked="true"]::after { transform: translateX(16px); background: #111; }
.toggle:disabled { opacity: 0.5; cursor: not-allowed; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.segmented button { border: 0; background: transparent; padding: 0 11px; height: 32px; cursor: pointer; font-size: 13px; font-weight: 550; color: var(--text-2); border-right: 1px solid var(--border); }
.segmented button:last-child { border-right: 0; }
.segmented button[aria-pressed="true"] { background: var(--text); color: var(--surface); }
.filterbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 14px; }
.filterbar .field { min-width: 150px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---- tabs ------------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { background: none; border: 0; padding: 9px 14px; cursor: pointer; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.07em; font-size: 14.5px; font-weight: 600; color: var(--text-3); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.tab .badge { margin-left: 6px; }

/* ---- table ------------------------------------------------------------------ */
.table-wrap { width: 100%; overflow-x: auto; }
.table-tools { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.table-tools .input { max-width: 260px; }
.filter-line { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.filter-line > .ti { color: var(--text-3); font-size: 16px; }
.filter-line .input { width: 260px; max-width: 100%; }
.filter-line .select { width: auto; max-width: 190px; }
.filter-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 4px 0 8px; border-radius: 2px; background: var(--brand-soft); color: var(--text); font-size: 12.5px; white-space: nowrap; }
.chip b { font-weight: 600; color: var(--brand-text); }
.chip button { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; color: var(--text-2); }
.chip button:hover { color: var(--danger); }
.chip-clear { border: 0; background: none; cursor: pointer; font-size: 12.5px; color: var(--text-2); text-decoration: underline; padding: 0 2px; }
.table-wrap.is-loading { opacity: 0.55; transition: opacity 0.15s; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; user-select: none; }
table.t th.sortable { cursor: pointer; }
table.t th.sortable:hover { color: var(--text); }
table.t th .sort { font-size: 12px; margin-left: 3px; color: var(--brand-text); }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr:hover td { background: var(--surface-2); }
table.t.dense td { padding: 6px 12px; }
table.t tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
table.t td.neg { color: var(--danger); }
.table-foot { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12.5px; flex-wrap: wrap; }
.table-note { padding: 8px 12px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12.5px; }
.cell-main { font-weight: 550; }
.cell-sub { color: var(--text-3); font-size: 12px; }

/* ---- states ----------------------------------------------------------------- */
.empty { padding: 44px 20px; text-align: center; color: var(--text-2); }
.empty .ti { font-size: 34px; color: var(--text-3); }
.empty h3 { margin-top: 10px; font-size: 15px; color: var(--text); }
.empty p { margin-top: 4px; max-width: 52ch; margin-inline: auto; }
.empty .btn { margin-top: 14px; }
.loading { padding: 40px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-3); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: var(--radius); min-height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }
.callout { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--border-strong); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; }
.callout.info { border-left-color: var(--info); }
.callout.warning { border-left-color: var(--warning); background: var(--warning-soft); }
.callout.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.callout.success { border-left-color: var(--success); }
.callout.brand { border-left-color: var(--brand); }
.callout .ti { margin-top: 1px; }

/* ---- overlays --------------------------------------------------------------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; animation: fade 0.12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); width: min(560px, 100%); max-height: 84vh; display: flex; flex-direction: column; }
.modal.lg { width: min(860px, 100%); }
.modal.xl { width: min(1120px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { flex: 1; font-size: 16px; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.drawer-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 100; animation: fade 0.12s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--drawer-w, 560px), 100%); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-3); z-index: 101; display: flex; flex-direction: column; animation: slide 0.16s; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer .modal-body { flex: 1; }
.menu { position: fixed; z-index: 120; min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); padding: 4px; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: var(--radius); cursor: pointer; font-size: 13.5px; text-align: left; color: var(--text); text-decoration: none; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.danger { color: var(--danger); }
.menu-item .ti { color: var(--text-3); font-size: 16px; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-label { padding: 6px 10px 2px; font-size: 11.5px; color: var(--text-3); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; gap: 9px; align-items: flex-start; background: #111; color: #fff; border-left: 3px solid var(--brand); padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0; box-shadow: var(--shadow-2); max-width: 420px; font-size: 13.5px; animation: slide 0.16s; }
.toast.success { border-left-color: var(--green); }
.toast.danger { border-left-color: #ff6b61; }
.toast.warning { border-left-color: var(--orange); }

/* ---- command palette --------------------------------------------------------- */
.palette { width: min(680px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette-input input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; }
.palette-list { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette-group { padding: 8px 10px 4px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.1em; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; }
.palette-item.sel { background: var(--brand-soft); }
.palette-item .ti { color: var(--text-3); }
.palette-item .sub { color: var(--text-3); font-size: 12.5px; margin-left: auto; white-space: nowrap; }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; background: var(--surface-2); }

/* ---- misc ------------------------------------------------------------------- */
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; flex: none; letter-spacing: 0.02em; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.brand { background: var(--brand); color: var(--brand-ink); }
.dl { display: grid; grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.codeblock { position: relative; background: #0f0f0f; color: #e8e8e3; border-radius: var(--radius); padding: 12px 44px 12px 14px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; overflow-x: auto; white-space: pre; border: 1px solid #262626; }
.codeblock .copy { position: absolute; top: 6px; right: 6px; background: #1f1f1f; border: 1px solid #333; color: #ddd; border-radius: var(--radius); width: 28px; height: 28px; cursor: pointer; }
.codeblock .copy:hover { background: #2a2a2a; }
.chart { width: 100%; }
.bar-inline { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar-inline > i { display: block; height: 100%; background: var(--brand); }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item.click { cursor: pointer; }
.list-item.click:hover { background: var(--surface-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.success { background: var(--success); }
.dot.warning { background: var(--warning); }
.dot.danger { background: var(--danger); }
.dot.brand { background: var(--brand); }
.chevrons { height: 6px; background: repeating-linear-gradient(135deg, var(--brand) 0 8px, transparent 8px 16px); opacity: 0.9; }

/* ---- heat cells (cohort grids) ------------------------------------------------ */
table.heat { border-collapse: separate; border-spacing: 2px; font-size: 12px; font-variant-numeric: tabular-nums; }
table.heat th { font-weight: 600; color: var(--text-2); padding: 4px 8px; text-align: right; white-space: nowrap; font-size: 11.5px; }
table.heat th.l { text-align: left; }
table.heat td { padding: 5px 8px; text-align: right; border-radius: 2px; min-width: 54px; }

/* ---- sign-in ---------------------------------------------------------------- */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.signin-brand { background: #0b0b0b; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.signin-brand::after { content: ""; position: absolute; right: -120px; bottom: -60px; width: 520px; height: 520px; background: repeating-linear-gradient(115deg, transparent 0 46px, rgba(250, 195, 0, 0.9) 46px 54px, transparent 54px 70px, rgba(255, 255, 255, 0.5) 70px 74px); transform: skewX(-18deg); opacity: 0.55; mask-image: linear-gradient(to top left, #000 20%, transparent 75%); }
.signin-brand h1 { font-family: var(--font-display); text-transform: uppercase; font-size: 54px; line-height: 1; font-weight: 700; letter-spacing: 0.01em; max-width: 12ch; position: relative; z-index: 1; }
.signin-brand p { color: #b9b9b3; max-width: 46ch; margin-top: 16px; font-size: 15px; position: relative; z-index: 1; }
.signin-panel { padding: 48px 56px; display: flex; flex-direction: column; justify-content: center; background: var(--bg); }
.signin-panel .inner { width: min(460px, 100%); margin: 0 auto; }
.person { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; margin-top: 8px; }
.person:hover { border-color: var(--text); }
.person .who { flex: 1; min-width: 0; }
@media (max-width: 900px) { .signin { grid-template-columns: 1fr; } .signin-brand { padding: 32px; } .signin-brand h1 { font-size: 40px; } .signin-panel { padding: 32px 20px; } }

@media print {
  .rail, .topbar, .page-actions, .table-tools, .filterbar { display: none !important; }
  .app { display: block; height: auto; }
  .content { overflow: visible; }
}
