/* ══════════════════════════════════════════════════════════════════
   ATLAS COCKPIT — DESIGN SYSTEM
   Calm, premium, fast. Light + dark via [data-theme].
   ══════════════════════════════════════════════════════════════════ */

:root {
  /* — Light theme tokens — */
  --bg:            #FAFAF8;   /* app canvas, warm off-white */
  --bg-sidebar:    #F4F4F0;   /* sidebar, a hair deeper */
  --bg-elevated:   #FFFFFF;   /* panels / cards */
  --bg-sunken:     #F1F1EC;   /* wells, inputs, table headers */
  --bg-hover:      #F3F3EE;   /* row / item hover */
  --bg-overlay:    rgba(28,28,26,0.38);

  --ink:           #16160F;
  --ink-strong:    #000000;
  --ink-muted:     #6B6B63;
  --ink-faint:     #A2A29A;

  --rule:          #E7E7E1;
  --rule-strong:   #D9D9D2;

  --accent:        #016AFF;
  --accent-weak:   rgba(1,106,255,0.08);
  --accent-mid:    rgba(1,106,255,0.16);
  --accent-ink:    #FFFFFF;

  --success:       #1F7A4D;
  --success-weak:  rgba(31,122,77,0.10);
  --warning:       #B47912;
  --warning-weak:  rgba(180,121,18,0.12);
  --danger:        #C0392B;
  --danger-weak:   rgba(192,57,43,0.10);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  --r-sm: 6px; --r-md: 9px; --r-lg: 13px; --r-xl: 18px;

  --sh-sm: 0 1px 2px rgba(17,17,12,0.05), 0 1px 1px rgba(17,17,12,0.03);
  --sh-md: 0 2px 4px rgba(17,17,12,0.05), 0 4px 12px rgba(17,17,12,0.06);
  --sh-lg: 0 8px 24px rgba(17,17,12,0.10), 0 2px 6px rgba(17,17,12,0.06);
  --sh-pop: 0 16px 48px rgba(17,17,12,0.20), 0 4px 12px rgba(17,17,12,0.10);

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --content-max: 1160px;
}

[data-theme="dark"] {
  --bg:            #0D0E10;
  --bg-sidebar:    #0A0B0D;
  --bg-elevated:   #16181B;
  --bg-sunken:     #101214;
  --bg-hover:      #1C1F23;
  --bg-overlay:    rgba(0,0,0,0.58);

  --ink:           #ECECE8;
  --ink-strong:    #FFFFFF;
  --ink-muted:     #9A9A92;
  --ink-faint:     #66665E;

  --rule:          #24272B;
  --rule-strong:   #313539;

  --accent:        #4D93FF;
  --accent-weak:   rgba(77,147,255,0.12);
  --accent-mid:    rgba(77,147,255,0.22);
  --accent-ink:    #06121F;

  --success:       #46B07C;
  --success-weak:  rgba(70,176,124,0.14);
  --warning:       #D99A36;
  --warning-weak:  rgba(217,154,54,0.16);
  --danger:        #E5705F;
  --danger-weak:   rgba(229,112,95,0.14);

  --sh-sm: 0 1px 2px rgba(0,0,0,0.4);
  --sh-md: 0 2px 8px rgba(0,0,0,0.5);
  --sh-lg: 0 10px 30px rgba(0,0,0,0.55);
  --sh-pop: 0 20px 60px rgba(0,0,0,0.65);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 450;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background 240ms var(--ease), color 240ms var(--ease);
}
#root { height: 100%; }

h1,h2,h3,h4 { margin: 0; font-weight: 680; letter-spacing: -0.02em; line-height: 1.12; color: var(--ink); }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

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

.mono {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.tnum { font-variant-numeric: tabular-nums; }

/* Custom scrollbars */
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 99px; border: 3px solid var(--bg); }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* focus ring */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ─────────────────────────────  APP SHELL  ───────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100%;
  transition: grid-template-columns 260ms var(--ease);
}
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
.app.focus-mode { grid-template-columns: 0 1fr; }

/* Sidebar */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: background 240ms var(--ease);
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 18px;
  white-space: nowrap;
}
.sb-mark {
  width: 30px; height: 30px;
  flex-shrink: 0;
  color: var(--ink);
  display: grid;
  place-items: center;
}
.sb-mark svg { width: 100%; height: 100%; }
.sb-wordmark {
  font-size: 19px; font-weight: 720; letter-spacing: -0.03em; color: var(--ink);
}
.sb-collapse {
  margin-left: auto; flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--ink-faint);
  display: grid; place-items: center; transition: all 140ms var(--ease);
}
.sb-collapse:hover { background: var(--bg-hover); color: var(--ink); border-color: var(--rule); }
.app.collapsed .sb-brand { flex-direction: column; gap: 12px; padding: 18px 0 12px; }
.app.collapsed .sb-collapse { margin-left: 0; }
.app.collapsed .sb-wordmark, .app.collapsed .sb-label,
.app.collapsed .sb-foot-expand, .app.collapsed .sb-section-label { opacity: 0; pointer-events: none; }
.app.collapsed .sb-wordmark { display: none; }

.sb-nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sb-section-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint); padding: 14px 12px 6px; transition: opacity 200ms var(--ease);
}
.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; border-radius: var(--r-md);
  color: var(--ink-muted); background: transparent; border: 0;
  font-size: 13.5px; font-weight: 500; width: 100%; text-align: left;
  position: relative; transition: background 140ms var(--ease), color 140ms var(--ease);
  white-space: nowrap;
}
.sb-item:hover { background: var(--bg-hover); color: var(--ink); }
.sb-item.active { background: var(--bg-elevated); color: var(--ink); box-shadow: var(--sh-sm); font-weight: 580; }
.sb-item.active .sb-ico { color: var(--accent); }
.sb-ico { width: 18px; height: 18px; flex-shrink: 0; display: grid; place-items: center; color: var(--ink-faint); }
.sb-item.active .sb-ico { color: var(--accent); }
.sb-badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  display: grid; place-items: center; background: var(--bg-sunken); color: var(--ink-muted);
}
.sb-item.active .sb-badge { background: var(--accent-weak); color: var(--accent); }
.sb-badge.alert { background: var(--danger-weak); color: var(--danger); }
.app.collapsed .sb-badge { display: none; }

.sb-foot { border-top: 1px solid var(--rule); padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.sb-status {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  font-size: 11.5px; color: var(--ink-muted); white-space: nowrap;
}
.sb-status .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--warning); flex-shrink: 0; }
.sb-status .dot.ok { background: var(--success); }
.sb-foot-row { display: flex; align-items: center; gap: 4px; }
.sb-foot-btn {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: var(--r-md);
  border: 0; background: transparent; color: var(--ink-muted); font-size: 12.5px; font-weight: 500;
  flex: 1; transition: background 140ms var(--ease), color 140ms var(--ease); white-space: nowrap;
}
.sb-foot-btn:hover { background: var(--bg-hover); color: var(--ink); }
.sb-foot-btn .sb-ico { color: var(--ink-faint); }

/* ───────────────────────────  MAIN COLUMN  ───────────────────────── */
.main { display: flex; flex-direction: column; height: 100%; min-width: 0; overflow: hidden; }

.topbar {
  display: flex; align-items: center; gap: var(--s-4);
  padding: 0 clamp(20px, 3vw, 40px); height: 60px; flex-shrink: 0;
  border-bottom: 1px solid var(--rule); background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
}
.tb-title { font-size: 16px; font-weight: 640; letter-spacing: -0.02em; }
.tb-sub { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.tb-spacer { flex: 1; }
.tb-search {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px 0 12px;
  min-width: 230px; border: 1px solid var(--rule); border-radius: var(--r-md);
  background: var(--bg-elevated); color: var(--ink-faint); font-size: 13px;
  transition: border-color 140ms var(--ease);
}
.tb-search:hover { border-color: var(--rule-strong); }
.tb-search .kbd { margin-left: auto; }
.kbd {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  padding: 2px 6px; border-radius: 5px; background: var(--bg-sunken);
  border: 1px solid var(--rule); color: var(--ink-muted); line-height: 1.3;
}
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-md); border: 1px solid var(--rule);
  background: var(--bg-elevated); color: var(--ink-muted); display: grid; place-items: center;
  transition: all 140ms var(--ease); flex-shrink: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.icon-btn.on { color: var(--accent); border-color: var(--accent); background: var(--accent-weak); }
.topbar-menu { display: none; }

.content { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.content-inner { max-width: var(--content-max); margin: 0 auto; padding: clamp(24px,3vw,40px) clamp(20px,3vw,40px) 100px; }

/* page header */
.page-head { margin-bottom: var(--s-8); }
.page-h1 { font-size: clamp(24px, 3vw, 30px); font-weight: 700; letter-spacing: -0.03em; }
.page-lead { color: var(--ink-muted); font-size: 15px; margin-top: 6px; max-width: 60ch; }

/* section block */
.block { margin-top: var(--s-10); }
.block:first-child { margin-top: 0; }
.block-head { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); flex-wrap: wrap; }
.block-title { font-size: 15px; font-weight: 640; letter-spacing: -0.015em; }
.block-aside { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.block-count {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); letter-spacing: 0.04em;
}

/* ─────────────────────────────  CARDS  ───────────────────────────── */
.card {
  background: var(--bg-elevated); border: 1px solid var(--rule); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease), transform 160ms var(--ease);
}
.card.pad { padding: var(--s-6); }
.card.hover:hover { border-color: var(--rule-strong); box-shadow: var(--sh-md); }
.card.click { cursor: pointer; }
.card.click:hover { border-color: var(--rule-strong); box-shadow: var(--sh-md); transform: translateY(-1px); }

/* ─────────────────────────────  PILLS  ───────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap;
  padding: 3px 8px; border-radius: 99px; border: 1px solid var(--rule);
  color: var(--ink-muted); background: var(--bg-elevated);
}
.pill .pdot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.pill.live, .pill.shipped { color: var(--success); background: var(--success-weak); border-color: transparent; }
.pill.in-progress, .pill.active { color: var(--accent); background: var(--accent-weak); border-color: transparent; }
.pill.blocked { color: var(--warning); background: var(--warning-weak); border-color: transparent; }
.pill.dormant, .pill.handed-off { color: var(--ink-faint); }
.pill.greenlight-scoped { color: var(--success); background: var(--success-weak); border-color: transparent; }
.pill.bounded-experiment, .pill.private-research-test { color: var(--accent); background: var(--accent-weak); border-color: transparent; }
.pill.paused-validation { color: var(--warning); background: var(--warning-weak); border-color: transparent; }
.pill.parked { color: var(--ink-faint); }
.pill.sev-high { color: var(--danger); background: var(--danger-weak); border-color: transparent; }
.pill.sev-medium { color: var(--warning); background: var(--warning-weak); border-color: transparent; }
.pill.sev-low { color: var(--ink-muted); }
.pill.lane { background: var(--bg-sunken); border-color: transparent; color: var(--ink-muted); }
.pill.ghost { background: transparent; }

/* urgency tags */
.utag {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 7px; border-radius: 5px; white-space: nowrap;
  color: var(--ink-muted); background: var(--bg-sunken);
}
.utag.critical, .utag.high { color: var(--danger); background: var(--danger-weak); }
.utag.medium { color: var(--warning); background: var(--warning-weak); }
.utag.low { color: var(--ink-muted); }

/* ────────────────────────────  BUTTONS  ──────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; font-size: 13px; font-weight: 580; letter-spacing: -0.01em;
  border-radius: var(--r-md); border: 1px solid var(--rule); background: var(--bg-elevated);
  color: var(--ink); transition: all 140ms var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--rule-strong); background: var(--bg-hover); }
.btn:active { transform: translateY(0.5px); }
.btn.sm { padding: 6px 11px; font-size: 12px; }
.btn.xs { padding: 4px 9px; font-size: 11.5px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-muted); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--ink); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-weak); }
.btn.warning:hover { border-color: var(--warning); color: var(--warning); background: var(--warning-weak); }
.btn.success:hover { border-color: var(--success); color: var(--success); background: var(--success-weak); }
.btn.trash { border-color: transparent; background: transparent; color: var(--ink-faint); }
.btn.trash:hover { color: var(--danger); background: var(--danger-weak); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn .bico { width: 15px; height: 15px; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; background: var(--bg-sunken); border-radius: var(--r-md); gap: 2px; }
.seg button {
  padding: 5px 12px; font-size: 12px; font-weight: 540; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-muted); transition: all 140ms var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--bg-elevated); color: var(--ink); box-shadow: var(--sh-sm); font-weight: 600; }

/* filter chips */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.03em;
  padding: 6px 12px; border: 1px solid var(--rule); border-radius: 99px;
  background: var(--bg-elevated); color: var(--ink-muted); transition: all 140ms var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--rule-strong); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
[data-theme="dark"] .chip.on { background: var(--ink); color: var(--bg); }
.chip .cn { opacity: 0.6; }

/* inputs */
.field {
  width: 100%; font-size: 13px; line-height: 1.5; color: var(--ink);
  background: var(--bg-sunken); border: 1px solid var(--rule); border-radius: var(--r-md);
  padding: 9px 11px; transition: border-color 140ms var(--ease), background 140ms var(--ease);
}
.field:focus { outline: none; border-color: var(--accent); background: var(--bg-elevated); }
.field::placeholder { color: var(--ink-faint); }
textarea.field { resize: vertical; min-height: 64px; }
.field-label {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-muted); margin-bottom: 6px; display: block;
}

/* metric / KPI */
.kpi-grid { display: grid; gap: var(--s-3); }
.kpi {
  background: var(--bg-elevated); border: 1px solid var(--rule); border-radius: var(--r-lg);
  padding: var(--s-5); box-shadow: var(--sh-sm); position: relative;
  transition: border-color 160ms var(--ease);
}
.kpi.editable { cursor: text; }
.kpi.editable:hover { border-color: var(--rule-strong); }
.kpi-label { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.kpi-label .t {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-muted);
}
.kpi-val { font-size: 27px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-val.muted { color: var(--ink-faint); }
.kpi-sub { font-size: 12px; color: var(--ink-muted); margin-top: 9px; display: flex; align-items: center; gap: 6px; }
.est-tag {
  font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-faint); background: var(--bg-sunken); padding: 2px 6px; border-radius: 4px;
}
.delta { font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }

/* empty state */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: var(--s-12) var(--s-6); color: var(--ink-muted);
  border: 1px dashed var(--rule-strong); border-radius: var(--r-lg); gap: 10px;
}
.empty .eico { width: 34px; height: 34px; color: var(--ink-faint); }
.empty h4 { font-size: 15px; font-weight: 620; color: var(--ink); }
.empty p { font-size: 13px; max-width: 42ch; }

/* checkbox tick */
.tick {
  width: 16px; height: 16px; border: 1.6px solid var(--ink-faint); border-radius: 5px;
  flex-shrink: 0; cursor: pointer; position: relative; background: var(--bg-elevated);
  transition: all 130ms var(--ease);
}
.tick:hover { border-color: var(--ink-muted); }
.tick.on { background: var(--success); border-color: var(--success); }
.tick.on::after {
  content: ''; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* progress */
.bar { height: 5px; border-radius: 99px; background: var(--bg-sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 300ms var(--ease); }
.bar > i.full { background: var(--success); }

/* divider */
.hr { height: 1px; background: var(--rule); border: 0; margin: 0; }

/* toast */
.toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: flex-start; gap: 12px; padding: 11px 14px 11px 16px;
  background: var(--ink); color: var(--bg); border-radius: var(--r-md); box-shadow: var(--sh-pop);
  font-size: 13px; font-weight: 500; min-width: 260px; max-width: 440px;
  animation: toastIn 240ms var(--ease);
}
.toast .t-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.toast .t-msg { line-height: 1.35; }
.toast .t-detail { font-size: 11.5px; font-weight: 450; opacity: 0.82; line-height: 1.4; }
.toast.t-error { background: var(--danger, #d63b3b); color: #fff; box-shadow: 0 6px 18px rgba(214,59,59,0.28), var(--sh-pop); }
.toast.t-error .undo { color: #fff; background: rgba(255,255,255,0.20); }
[data-theme="dark"] .toast { background: var(--bg-elevated); color: var(--ink); border: 1px solid var(--rule-strong); }
[data-theme="dark"] .toast.t-error { background: var(--danger-weak, #4a1d1d); color: #ffbcbc; border-color: var(--danger, #d63b3b); }
.toast.out { animation: toastOut 200ms var(--ease) forwards; }
.toast .undo {
  margin-left: auto; align-self: center; font-weight: 650; color: var(--bg); background: rgba(255,255,255,0.16);
  border: 0; padding: 5px 11px; border-radius: 6px; font-size: 12px; flex-shrink: 0;
}
[data-theme="dark"] .toast .undo { color: var(--accent); background: var(--accent-weak); }
.toast .undo:hover { filter: brightness(1.2); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* mobile off-canvas sidebar scrim */
.mobile-scrim { position: fixed; inset: 0; background: var(--bg-overlay); z-index: 320; display: none; }

/* ───────────────────────────  RESPONSIVE  ───────────────────────── */
@media (max-width: 980px) {
  :root { --content-max: 100%; }
}
@media (max-width: 860px) {
  .app, .app.collapsed, .app.focus-mode { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100%; width: 272px; z-index: 330;
    transform: translateX(-100%); transition: transform 280ms var(--ease); box-shadow: var(--sh-pop);
  }
  .sidebar.mobile-open { transform: none; }
  .app.collapsed .sb-wordmark, .app.collapsed .sb-label,
  .app.collapsed .sb-foot-expand, .app.collapsed .sb-section-label { opacity: 1; pointer-events: auto; }
  .app.collapsed .sb-wordmark { display: block; }
  .app.collapsed .sb-badge { display: grid; }
  .app.collapsed .sb-brand { flex-direction: row; gap: 11px; padding: 20px 18px 18px; }
  .mobile-scrim.show { display: block; }
  .topbar-menu { display: grid; }
  .topbar { padding: 0 16px; gap: 10px; }
  .tb-title { font-size: 15px; }
}
@media (max-width: 680px) {
  .tb-search { min-width: 0; width: 36px; padding: 0; justify-content: center; }
  .tb-search > span, .tb-search .kbd { display: none; }
  .hero-stat { padding-right: 18px; margin-right: 18px; }
  .content-inner { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 460px) {
  .seg button { padding: 5px 9px; }
  .hero-stats { gap: 4px; }
  .hero-stat { border-right: 0; padding-right: 0; margin-right: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ─────────────────────────────  TWEAKS  ──────────────────────────── */
[data-radius="sharp"]   { --r-sm: 3px; --r-md: 4px;  --r-lg: 6px;  --r-xl: 9px;  }
[data-radius="rounded"] { --r-sm: 9px; --r-md: 13px; --r-lg: 18px; --r-xl: 26px; }

[data-density="compact"] .content-inner { padding-top: 22px; }
[data-density="compact"] .block { margin-top: 28px; }
[data-density="compact"] .page-head { margin-bottom: 22px; }
[data-density="compact"] .card.pad { padding: 16px; }
[data-density="compact"] .hero { padding: 20px; }
[data-density="compact"] .hero-stats { margin-top: 16px; }
[data-density="compact"] .hero-stat { padding-top: 12px; }
[data-density="compact"] .today-grid { margin-top: 22px; gap: 18px; }
[data-density="compact"] .queue { gap: 8px; }
[data-density="compact"] .aq-top { padding: 11px 14px; }
[data-density="compact"] .aq-why { margin-top: 2px; }
[data-density="compact"] .kpi { padding: 14px; }
[data-density="compact"] .kpi-val { font-size: 23px; }
[data-density="compact"] .ptile { padding: 16px; gap: 10px; }
[data-density="compact"] .mini { padding: 14px; }
[data-density="compact"] .mini-row { padding: 7px 0; }
[data-density="compact"] table.fin td, [data-density="compact"] table.dt td { padding: 9px 14px; }
[data-density="compact"] .risk-card, [data-density="compact"] .idea-card { padding: 16px; gap: 10px; }
