/* ============================================================
   Visual Roadmap — Command Center
   Design system per Impeccable (frontend-design). Refined editorial
   command center: light canvas, one indigo accent, dark anchoring
   sidebar, editorial serif titles + geometric-humanist UI sans.
   Colors in OKLCH with tinted neutrals. No pure black/white.
   ============================================================ */

:root {
  /* Neutrals — cool-tinted toward the brand hue (~270) */
  --bg:        oklch(97.6% 0.006 270);
  --surface:   oklch(99.3% 0.004 270);
  --surface-2: oklch(98.2% 0.006 270);
  --surface-3: oklch(96.4% 0.008 270);
  --ink:       oklch(26% 0.03 278);
  --ink-2:     oklch(47% 0.022 274);
  --ink-3:     oklch(60% 0.018 272);
  --line:      oklch(91% 0.008 272);
  --line-2:    oklch(94.5% 0.006 272);

  /* Brand */
  --accent:       oklch(52% 0.15 274);
  --accent-hover: oklch(46% 0.16 274);
  --accent-ink:   oklch(40% 0.14 274);
  --accent-soft:  oklch(95% 0.03 274);
  --accent-ring:  oklch(62% 0.14 274 / 0.5);

  /* Sidebar (dark, tinted slate-indigo) */
  --side-bg:   oklch(27% 0.035 278);
  --side-bg-2: oklch(31% 0.04 278);
  --side-ink:  oklch(90% 0.02 276);
  --side-ink-2:oklch(70% 0.03 276);
  --side-line: oklch(38% 0.04 278);

  /* Status (soft tinted chips) */
  --st-inprogress-bg: oklch(93% 0.06 155);  --st-inprogress-ink: oklch(42% 0.13 155);
  --st-selected-bg:   oklch(93% 0.05 250);  --st-selected-ink:   oklch(45% 0.13 255);
  --st-backlog-bg:    oklch(94% 0.008 272);  --st-backlog-ink:    oklch(48% 0.02 272);
  --st-done-bg:       oklch(92% 0.012 272);  --st-done-ink:       oklch(40% 0.02 272);

  /* Health */
  --h-green: oklch(64% 0.15 152);
  --h-amber: oklch(74% 0.14 78);
  --h-red:   oklch(60% 0.19 25);
  --h-gray:  oklch(74% 0.014 272);

  /* Spacing — 4pt base, named semantically */
  --space-2: 2px; --space-4: 4px; --space-6: 6px; --space-8: 8px;
  --space-12: 12px; --space-16: 16px; --space-20: 20px; --space-24: 24px;
  --space-32: 32px; --space-48: 48px; --space-64: 64px;

  /* Type scale — modular ~1.25, fixed rem for dashboard predictability */
  --text-xs: 0.75rem;   /* 12 */
  --text-sm: 0.8125rem; /* 13 */
  --text-base: 0.9375rem; /* 15 */
  --text-lg: 1.125rem;  /* 18 */
  --text-xl: 1.5rem;    /* 24 */
  --text-2xl: 2rem;     /* 32 */

  --sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  /* z-index scale */
  --z-sticky: 200; --z-drawer-scrim: 300; --z-drawer: 400; --z-toast: 500; --z-tooltip: 600; --z-pop: 650;

  --ease: cubic-bezier(0.22, 1, 0.36, 1); /* ease-out-quint-ish */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: var(--text-base);
  line-height: 1.5;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.num, table.data td.num, .tabular { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button:focus:not(:focus-visible), select:focus:not(:focus-visible) { outline: none; }

/* ============================================================
   App shell: sidebar + main
   ============================================================ */
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--side-bg);
  color: var(--side-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  padding: var(--space-24) var(--space-16) var(--space-16);
}
.brand { display: flex; align-items: center; gap: var(--space-12); padding: 0 var(--space-8) var(--space-24); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: var(--accent); color: #fff; display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; font-size: 1.05rem;
}
.brand-text h1 { font-family: var(--display); font-size: 1.15rem; margin: 0; font-weight: 560; letter-spacing: -0.01em; color: oklch(97% 0.01 276); line-height: 1.1; }
.brand-text span { font-size: var(--text-xs); color: var(--side-ink-2); }

.nav { display: flex; flex-direction: column; gap: var(--space-20); overflow-y: auto; flex: 1; padding-top: var(--space-8); }
.nav-group-label {
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--side-ink-2); font-weight: 600; padding: 0 var(--space-8) var(--space-8);
}
.nav button {
  display: flex; align-items: center; gap: var(--space-10, 10px); width: 100%;
  border: none; background: transparent; color: var(--side-ink);
  padding: 9px var(--space-12); border-radius: var(--radius-sm); cursor: pointer;
  font-family: inherit; font-size: var(--text-sm); text-align: left; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav button:hover { background: var(--side-bg-2); color: oklch(97% 0.01 276); }
.nav button.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav .n-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; flex: none; }
.nav button.active .n-dot { opacity: 1; }

.side-foot { border-top: 1px solid var(--side-line); padding-top: var(--space-16); margin-top: var(--space-16); display: flex; flex-direction: column; gap: var(--space-12); }
.source-badge { display: flex; align-items: center; gap: var(--space-8); font-size: var(--text-xs); color: var(--side-ink-2); }
.source-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--h-gray); }
.source-badge.live .dot { background: var(--h-green); box-shadow: 0 0 0 3px oklch(64% 0.15 152 / 0.2); }
.source-badge.snapshot .dot { background: var(--h-amber); }
.side-foot .btn-side {
  border: 1px solid var(--side-line); background: transparent; color: var(--side-ink);
  padding: 8px; border-radius: var(--radius-sm); cursor: pointer; font-family: inherit; font-size: var(--text-sm);
}
.side-foot .btn-side:hover { background: var(--side-bg-2); }

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

/* ============================================================
   Filter bar (slim, quiet) with progressive disclosure
   ============================================================ */
.filterbar {
  display: flex; align-items: center; gap: var(--space-16); flex-wrap: wrap;
  padding: var(--space-16) var(--space-32);
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.fb-left, .fb-right { display: flex; align-items: center; gap: var(--space-16); flex-wrap: wrap; }
.fb-right { margin-left: auto; }
.fb-field { display: flex; align-items: center; gap: var(--space-8); }
.fb-field > label { font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; }
.time-range { display: flex; align-items: center; gap: var(--space-6); }
.time-range .arrow { color: var(--ink-3); }

select {
  font-family: inherit; font-size: var(--text-sm); padding: 7px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  transition: border-color .15s var(--ease);
}
select:hover { border-color: var(--ink-3); }

.switch {
  width: 40px; height: 23px; border-radius: var(--radius-pill); border: 1px solid var(--line);
  background: var(--surface-3); position: relative; cursor: pointer; padding: 0; flex: none;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.switch span { position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--surface); transition: left .18s var(--ease); border: 1px solid var(--line); }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] span { left: 19px; border-color: var(--accent); }

.segmented { display: inline-flex; background: var(--surface-3); border-radius: var(--radius-sm); padding: 2px; }
.segmented button {
  border: none; background: transparent; padding: 6px 12px; cursor: pointer; font-size: var(--text-sm);
  color: var(--ink-2); font-family: inherit; border-radius: 6px; font-weight: 500; transition: all .15s var(--ease);
}
.segmented button.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px oklch(27% 0.03 278 / 0.08); }

.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm);
  font-family: inherit; font-weight: 500; transition: border-color .15s var(--ease), background .15s var(--ease);
  display: inline-flex; align-items: center; gap: var(--space-6);
}
.btn:hover { border-color: var(--ink-3); }
.btn.small { padding: 5px 10px; font-size: var(--text-xs); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary:disabled, .btn-primary:disabled:hover { background: var(--ink-3); border-color: var(--ink-3); }
.filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--accent); color: #fff; font-size: 0.6875rem; font-weight: 700; }

/* Filters popover — anchored below the trigger, escapes overflow via top layer */
#filters-btn { anchor-name: --fbtn; }
#filters-pop {
  margin: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: var(--space-20); box-shadow: 0 12px 32px oklch(27% 0.03 278 / 0.12);
  width: 300px;
  position-anchor: --fbtn;
  position-area: block-end span-inline-start;
  margin-top: 8px;
}
/* Fallback for browsers without CSS anchor positioning */
@supports not (position-area: block-end) {
  #filters-pop { position: fixed; top: 68px; right: 32px; }
}
#filters-pop::backdrop { background: transparent; }
.pop-field { display: flex; flex-direction: column; gap: var(--space-6); margin-bottom: var(--space-16); }
.pop-field:last-child { margin-bottom: 0; }
.pop-field label { font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.pop-field select { width: 100%; }

.active-chips { display: flex; gap: var(--space-6); flex-wrap: wrap; }
.fchip { display: inline-flex; align-items: center; gap: var(--space-6); font-size: var(--text-xs); background: var(--accent-soft); color: var(--accent-ink); padding: 4px 6px 4px 10px; border-radius: var(--radius-pill); }
.fchip button { border: none; background: transparent; color: var(--accent-ink); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; }

/* ============================================================
   View
   ============================================================ */
.view { padding: var(--space-32); max-width: 1400px; }
.view-head { margin-bottom: var(--space-24); }
.view-head h2 { font-family: var(--display); font-weight: 500; font-size: var(--text-xl); margin: 0; letter-spacing: -0.01em; color: var(--ink); }
.view-head p { margin: var(--space-6) 0 0; color: var(--ink-3); font-size: var(--text-sm); max-width: 74ch; }

@keyframes riseIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view > * { animation: riseIn .32s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: .03s; }
.view > *:nth-child(3) { animation-delay: .06s; }
.view > *:nth-child(4) { animation-delay: .09s; }

/* Stat strip (replaces templated KPI card grid) */
.statbar { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; margin-bottom: var(--space-32); }
.stat { padding: 0 var(--space-24); border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.stat:first-child { padding-left: 0; border-left: none; }
.stat .s-val { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.stat.lead .s-val { color: var(--accent); }
.stat .s-label { font-size: var(--text-xs); color: var(--ink-3); margin-top: var(--space-6); font-weight: 500; }

.section-title { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 700; margin: var(--space-32) 0 var(--space-12); }
.section-title:first-child { margin-top: 0; }

/* Legend */
.legend { display: flex; gap: var(--space-16); flex-wrap: wrap; margin: var(--space-12) 0 var(--space-20); }
.legend .item { display: flex; align-items: center; gap: var(--space-6); font-size: var(--text-xs); color: var(--ink-2); }
.legend .swatch { width: 9px; height: 9px; border-radius: 50%; }

/* Theme + status + health indicators */
.theme-tag { display: inline-flex; align-items: center; gap: var(--space-6); font-size: var(--text-xs); color: var(--ink-2); font-weight: 500; }
.theme-tag .theme-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.badge { font-size: var(--text-xs); padding: 3px 9px; border-radius: var(--radius-pill); font-weight: 600; display: inline-flex; align-items: center; white-space: nowrap; }
.badge.pri { border: 1px solid var(--line); color: var(--ink-2); background: var(--surface-2); }
.badge.warn { background: oklch(95% 0.05 25); color: var(--h-red); }
.badge.flag { background: oklch(96% 0.06 78); color: oklch(52% 0.12 66); }
/* Status chips — soft tinted, shade-of-background text (never gray-on-color) */
.badge.st-inprogress { background: var(--st-inprogress-bg); color: var(--st-inprogress-ink); }
.badge.st-selected   { background: var(--st-selected-bg);   color: var(--st-selected-ink); }
.badge.st-backlog    { background: var(--st-backlog-bg);    color: var(--st-backlog-ink); }
.badge.st-done       { background: var(--st-done-bg);       color: var(--st-done-ink); }
.hbadge { display: inline-flex; align-items: center; gap: var(--space-6); font-size: var(--text-xs); font-weight: 600; }
.hbadge .hdot { width: 8px; height: 8px; border-radius: 50%; }
.chip { display: inline-flex; align-items: center; gap: var(--space-4); font-size: var(--text-xs); padding: 3px 9px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--ink-2); font-weight: 500; }
.chip.committed { background: oklch(95% 0.05 40); color: oklch(50% 0.13 40); }

/* ============================================================
   Portfolio tiles (comparison grid — flattened, no shadows/borders-on-one-side)
   ============================================================ */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-16); }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space-20); cursor: pointer; transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.tile:hover { border-color: var(--ink-3); transform: translateY(-2px); }
.tile .tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-8); }
.tile h3 { margin: 0; font-size: var(--text-lg); font-weight: 650; letter-spacing: -0.01em; }
.tile .tile-theme { margin-top: var(--space-8); display: flex; gap: var(--space-8); align-items: center; flex-wrap: wrap; }
.tile-stats { display: flex; gap: var(--space-20); margin-top: var(--space-16); }
.tile-stats .s { font-size: var(--text-xs); color: var(--ink-3); }
.tile-stats .s b { display: block; font-size: var(--text-lg); color: var(--ink); font-weight: 650; letter-spacing: -0.01em; }
.status-bar { display: flex; height: 6px; border-radius: var(--radius-pill); overflow: hidden; margin-top: var(--space-16); background: var(--line-2); }
.status-bar > i { display: block; height: 100%; }

/* ============================================================
   Cards / lists
   ============================================================ */
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--space-16); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-20); }
.card .card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-8); }
.card h3 { margin: 0; font-size: var(--text-base); font-weight: 650; cursor: pointer; letter-spacing: -0.005em; }
.card h3:hover { color: var(--accent); }
.card .card-theme { margin-top: var(--space-8); }
.card .meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8) var(--space-16); margin-top: var(--space-16); }
.card .meta .m { font-size: var(--text-xs); color: var(--ink-3); }
.card .meta .m b { color: var(--ink); font-weight: 600; font-size: var(--text-sm); display: block; margin-top: 1px; }
.card .badges { display: flex; gap: var(--space-6); flex-wrap: wrap; margin-top: var(--space-16); align-items: center; }

/* ============================================================
   Table
   ============================================================ */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
table.data th, table.data td { text-align: left; padding: 11px var(--space-16); border-bottom: 1px solid var(--line-2); }
table.data th { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: none; }
table.data tr.clickable { cursor: pointer; transition: background .12s var(--ease); }
table.data tr.clickable:hover td { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; }
.row-flag { color: var(--h-red); font-weight: 700; }

/* ============================================================
   Gantt
   ============================================================ */
.gantt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.gantt-inner { min-width: 760px; }
.gantt-row { display: grid; align-items: stretch; border-bottom: 1px solid var(--line-2); }
.gantt-row.header { position: sticky; top: 0; background: var(--surface-2); z-index: 2; }
.gantt-row.header .g-lane { font-weight: 600; color: var(--ink-3); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.gantt-row.header .g-month { text-align: center; font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; padding: 10px 0; border-left: 1px solid var(--line-2); }
.g-lane { padding: 10px var(--space-12); font-size: var(--text-sm); font-weight: 550; border-right: 1px solid var(--line); position: sticky; left: 0; background: var(--surface); z-index: 3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-row.lanehead .g-lane { background: var(--surface-2); color: var(--ink-2); font-weight: 700; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.g-track { position: relative; border-left: 1px solid var(--line-2); min-height: 36px; }
.g-grid { position: absolute; inset: 0; display: grid; }
.g-grid > i { border-left: 1px solid var(--line-2); }
.g-bar {
  position: absolute; top: 6px; bottom: 6px; border-radius: 7px; color: #fff;
  font-size: var(--text-xs); padding: 0 var(--space-8); display: flex; align-items: center; overflow: hidden;
  white-space: nowrap; cursor: pointer; min-width: 8px; font-weight: 500;
  transition: transform .12s var(--ease), filter .12s var(--ease);
}
.g-bar:hover { transform: translateY(-1px); filter: brightness(1.06); }
.g-bar.unscheduled { background: repeating-linear-gradient(45deg, var(--surface-3), var(--surface-3) 6px, var(--line-2) 6px, var(--line-2) 12px); color: var(--ink-2); border: 1px dashed var(--ink-3); }
.g-marker { position: absolute; top: 5px; bottom: 5px; width: 22px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; color: #fff; font-weight: 700; }

/* ============================================================
   Allocation
   ============================================================ */
.alloc-team { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-20); margin-bottom: var(--space-12); }
.alloc-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-12); gap: var(--space-16); }
.alloc-head h3 { margin: 0; font-size: var(--text-base); font-weight: 650; }
.alloc-head .cap { font-size: var(--text-sm); color: var(--ink-3); }
.alloc-head .cap b { color: var(--ink); font-weight: 650; }
.alloc-track { display: flex; height: 28px; border-radius: var(--radius-sm); overflow: hidden; background: var(--line-2); position: relative; }
.alloc-seg { height: 100%; display: flex; align-items: center; padding: 0 var(--space-8); color: #fff; font-size: var(--text-xs); white-space: nowrap; overflow: hidden; cursor: pointer; font-weight: 500; }
.alloc-seg.planned { background: var(--ink-3) !important; opacity: .5; }
.alloc-cap-line { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.alloc-legend { font-size: var(--text-xs); color: var(--ink-3); margin-top: var(--space-8); }

/* ============================================================
   Gauge (Say/Do)
   ============================================================ */
.gauge-wrap { display: flex; gap: var(--space-48); align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-32); }
.gauge { position: relative; width: 200px; height: 200px; flex: none; }
.gauge svg { transform: rotate(-90deg); }
.gauge .g-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge .g-center .pct { font-size: 2.75rem; font-weight: 750; letter-spacing: -0.03em; }
.gauge .g-center .lbl { font-size: var(--text-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.saydo-detail { min-width: 300px; }
.saydo-detail .row { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line-2); font-size: var(--text-sm); }
.saydo-detail .row:last-child { border-bottom: none; }
.saydo-detail .row b { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ============================================================
   Drawer
   ============================================================ */
.drawer-scrim { position: fixed; inset: 0; background: oklch(27% 0.03 278 / 0.32); z-index: var(--z-drawer-scrim); animation: fadeIn .2s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 500px; max-width: 94vw; z-index: var(--z-drawer);
  background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; padding: var(--space-24) var(--space-32);
  animation: slideIn .3s var(--ease);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-12); }
.drawer h2 { font-family: var(--display); font-weight: 500; margin: 0 var(--space-6) 4px 0; font-size: var(--text-lg); letter-spacing: -0.01em; }
.drawer .d-close { border: none; background: var(--surface-3); width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer; font-size: 15px; color: var(--ink-2); flex: none; }
.drawer .d-close:hover { background: var(--line); }
.drawer .d-key { font-size: var(--text-xs); color: var(--ink-3); }
.drawer .d-key a { color: var(--accent); text-decoration: none; font-weight: 500; }
.drawer .d-key a:hover { text-decoration: underline; }
.drawer .d-section { margin-top: var(--space-24); }
.drawer .d-section h4 { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 0 0 var(--space-12); font-weight: 600; }
.drawer .d-fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-12) var(--space-16); }
.drawer .d-field label { font-size: var(--text-xs); color: var(--ink-3); display: block; margin-bottom: 2px; }
.drawer .d-field .v { font-size: var(--text-sm); font-weight: 550; }
.drawer .edit-row { display: flex; gap: var(--space-12); align-items: flex-end; margin-top: var(--space-8); flex-wrap: wrap; }
.drawer .edit-row .fg { display: flex; flex-direction: column; gap: var(--space-4); }
.drawer .edit-row label { font-size: var(--text-xs); color: var(--ink-3); }
.drawer .epic-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: var(--text-sm); }
.drawer .epic-item:last-child { border-bottom: none; }
.drawer .epic-item.clickable { cursor: pointer; }
.drawer .epic-item.clickable:hover { color: var(--accent); }
.drawer .dep { font-size: var(--text-sm); padding: 4px 0; }
.readonly-note { font-size: var(--text-xs); color: var(--ink-3); margin-top: var(--space-8); }

/* ============================================================
   Tooltip / toast / misc
   ============================================================ */
.tooltip {
  position: fixed; z-index: var(--z-tooltip); background: oklch(24% 0.03 278); color: oklch(96% 0.01 276);
  font-size: var(--text-xs); padding: 10px 12px; border-radius: var(--radius-sm); max-width: 300px; pointer-events: none; line-height: 1.55;
  box-shadow: 0 8px 24px oklch(24% 0.03 278 / 0.25);
}
.tooltip .t-title { font-weight: 650; margin-bottom: var(--space-6); font-size: var(--text-sm); color: #fff; }
.tooltip .t-line { color: var(--side-ink-2); }
.tooltip .t-line span { color: oklch(96% 0.01 276); font-weight: 500; }
.toast { position: fixed; bottom: var(--space-24); left: 50%; transform: translateX(-50%); z-index: var(--z-toast); background: oklch(24% 0.03 278); color: #fff; padding: 12px 20px; border-radius: var(--radius-sm); font-size: var(--text-sm); box-shadow: 0 8px 24px oklch(24% 0.03 278 / 0.25); animation: riseIn .25s var(--ease); }
.toast.err { background: var(--h-red); }
.toast.ok { background: var(--h-green); }

.empty { color: var(--ink-3); font-size: var(--text-sm); padding: var(--space-48); text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty b { color: var(--ink-2); font-weight: 600; }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: var(--space-12); padding: var(--space-12) var(--space-16); }
  .brand { padding: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: var(--space-8); overflow-x: auto; }
  .nav-group-label { display: none; }
  .nav-group { display: flex; gap: var(--space-4); }
  .side-foot { border: none; margin: 0; padding: 0; flex-direction: row; margin-left: auto; }
  .view { padding: var(--space-20); }
  .filterbar { padding: var(--space-12) var(--space-20); }
}

@media (prefers-reduced-motion: reduce) {
  *, .view > *, .drawer, .drawer-scrim, .toast { animation: none !important; transition: none !important; }
}
