:root {
  --bg: #0f0f0e; --surface: #181816; --surface-2: #1f1e1b; --raised: #262521; --line: #302f2a; --line-strong: #45433b;
  --text: #efede6; --muted: #aeab9f; --faint: #7f7c72;
  --gold: #d6bc7e; --gold-strong: #ead39b; --gold-dim: #8a7a52; --gold-wash: rgba(214, 188, 126, .1);
  --on: #7cc49a; --on-wash: rgba(124, 196, 154, .12); --watch: #e5b55c; --watch-wash: rgba(229, 181, 92, .13);
  --off: #ef8b78; --off-wash: rgba(239, 139, 120, .13); --pending: #9c998d; --pending-wash: rgba(156, 153, 141, .12);
  --radius: 14px; --radius-sm: 9px; --gap: 20px; --side: 248px;
  --font: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
.num, .big, td.n, th.n { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Shell */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); padding: 26px 16px 18px; display: flex; flex-direction: column; gap: 22px; background: #121211; }
.brand img { width: 176px; height: 58px; object-fit: cover; display: block; margin: 0 auto; }
.brand small { display: block; text-align: center; margin-top: 10px; font-size: 10.5px; letter-spacing: .22em; color: var(--faint); }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { display: grid; grid-template-columns: 24px 1fr; align-items: baseline; gap: 4px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--muted); }
.nav a:hover { background: var(--surface); text-decoration: none; color: var(--text); }
.nav a[aria-current="page"] { background: var(--gold-wash); color: var(--gold-strong); box-shadow: inset 0 0 0 1px rgba(214, 188, 126, .25); }
.nav a i { font-style: normal; font-size: 11px; color: var(--faint); }
.nav a span small { display: block; font-size: 11.5px; color: var(--faint); line-height: 1.3; margin-top: 1px; }
.nav a[aria-current="page"] span small { color: var(--gold-dim); }
.side-foot { margin-top: auto; display: grid; gap: 8px; font-size: 12.5px; color: var(--faint); }
.side-foot button { justify-content: flex-start; }
.save-state { font-size: 12px; color: var(--faint); display: flex; gap: 6px; align-items: center; }
.save-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--on); }
.save-state.local .dot { background: var(--watch); }
.save-state.error .dot { background: var(--off); }

main { min-width: 0; padding: 30px 40px 80px; max-width: 1320px; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; font-size: 12.5px; color: var(--faint); letter-spacing: .02em; }
.topline b { color: var(--muted); font-weight: 500; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.eyebrow { font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.lede { color: var(--muted); margin-top: 8px; max-width: 70ch; }
.banner { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13.5px; color: var(--muted); margin-bottom: 18px; display: flex; gap: 10px; align-items: flex-start; }
.banner.warn { border-color: rgba(229, 181, 92, .45); background: var(--watch-wash); color: var(--text); }
.banner.err { border-color: rgba(239, 139, 120, .5); background: var(--off-wash); color: var(--text); }

/* ---- Controls */
.btn, button.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 13.5px; line-height: 1.2; white-space: nowrap; }
.btn:hover { border-color: var(--gold-dim); }
.btn.primary { background: var(--gold); color: #17150f; border-color: var(--gold); font-weight: 500; }
.btn.primary:hover { background: var(--gold-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--gold); padding: 6px 8px; }
.btn.ghost:hover { border-color: var(--line-strong); }
.btn.small { padding: 5px 11px; font-size: 12.5px; }
.btn.danger { color: var(--off); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 13.5px; }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--gold-strong); box-shadow: inset 0 0 0 1px rgba(214, 188, 126, .3); }
.periodbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
select, input[type=text], input[type=number], input[type=date], textarea { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 7px 10px; min-width: 0; }
select { padding-right: 28px; }
textarea { width: 100%; min-height: 84px; resize: vertical; }
label.field { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
label.field .help { font-size: 12px; color: var(--faint); }
label.field.invalid input, label.field.invalid textarea, label.field.invalid select { border-color: var(--off); }
.field-error { color: var(--off); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---- Layout */
.section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head p { color: var(--muted); font-size: 13.5px; }
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; min-width: 0; }
.card.tight { padding: 16px 18px; }
.card.click { cursor: pointer; transition: border-color .15s; }
.card.click:hover { border-color: var(--gold-dim); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.big { font-size: 32px; line-height: 1.1; color: var(--gold-strong); font-weight: 400; letter-spacing: -.01em; }
.big.mid { font-size: 25px; }
.big .of { font-size: 14px; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12.5px; }
.gold { color: var(--gold); }
.foot { color: var(--faint); font-size: 12.5px; margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.kv .total { border-top: 1px solid var(--line); padding-top: 6px; color: var(--gold-strong); }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---- Status */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px 3px 8px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; line-height: 1.4; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.on { color: var(--on); background: var(--on-wash); border-color: rgba(124, 196, 154, .3); }
.pill.watch, .pill.progress { color: var(--watch); background: var(--watch-wash); border-color: rgba(229, 181, 92, .3); }
.pill.off { color: var(--off); background: var(--off-wash); border-color: rgba(239, 139, 120, .3); }
.pill.unknown, .pill.unset { color: var(--pending); background: var(--pending-wash); border-color: rgba(156, 153, 141, .25); }
.pill.done { color: var(--gold); background: var(--gold-wash); border-color: rgba(214, 188, 126, .3); }
.tag { display: inline-block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: var(--raised); color: var(--muted); border: 1px solid var(--line); }
.tag.draft { color: var(--watch); border-color: rgba(229, 181, 92, .35); }
.tag.owner { color: #c9b6e8; border-color: rgba(201, 182, 232, .35); }
.tag.snapshot { color: var(--muted); }
.tag.manual { color: #9fc8e6; border-color: rgba(159, 200, 230, .35); }
.tag.notc { color: var(--faint); }
.tag.live { color: var(--on); border-color: rgba(124, 196, 154, .4); }
.tag.stale { color: var(--off); border-color: rgba(239, 139, 120, .45); }
.chip { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--faint); background: transparent; border: 1px dashed var(--line-strong); border-radius: 999px; padding: 2px 10px; cursor: pointer; }
.chip:hover { color: var(--gold); border-color: var(--gold-dim); }

/* ---- Bars */
.bar { position: relative; height: 8px; background: var(--raised); border-radius: 999px; margin: 14px 0 8px; }
.bar > .fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--gold); }
.bar > .proj { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: repeating-linear-gradient(45deg, rgba(214, 188, 126, .35) 0 4px, rgba(214, 188, 126, .15) 4px 8px); }
.bar > .mark { position: absolute; top: -5px; width: 2px; height: 18px; background: var(--text); border-radius: 2px; }
.bar.on > .fill { background: var(--on); } .bar.watch > .fill { background: var(--watch); } .bar.off > .fill { background: var(--off); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--faint); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---- North star */
.star .proj-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin-top: 12px; font-size: 13.5px; }
.star .proj-line b { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.star .proj-line span { color: var(--muted); }
.star .proj-line .em { color: var(--gold-strong); font-size: 17px; }

/* ---- Actions & constraints */
.action { display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); align-items: start; }
.action:first-of-type { border-top: 0; }
.action .rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--gold-dim); color: var(--gold); font-size: 13px; }
.action.done .rank { background: var(--gold); color: #17150f; }
.action.done h3 { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.action p { color: var(--muted); margin-top: 3px; }
.action .meta { font-size: 12.5px; color: var(--faint); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.constraint { border-left: 3px solid var(--gold-dim); }
.constraint.first { border-left-color: var(--gold); }
.constraint .why { color: var(--muted); font-size: 13.5px; margin-top: 8px; }
.evidence { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; font-size: 13.5px; }
.evidence li { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.evidence li span:first-child { color: var(--faint); }
.toc-steps { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.toc-steps span { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--faint); }
.toc-steps span.done { color: var(--gold); border-color: var(--gold-dim); background: var(--gold-wash); }
.effect { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.effect div small { display: block; color: var(--faint); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; }
.effect div b { font-weight: 500; color: var(--gold-strong); font-size: 16px; }

/* ---- Dials */
.dials { display: grid; gap: var(--gap); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dials.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 880px; }
.dial-card { text-align: center; }
.dial-card svg { width: 100%; max-width: 230px; display: block; margin: 4px auto 0; }
.dial-card .big { font-size: 26px; }
.dial-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; font-size: 12.5px; text-align: left; }
.dial-meta div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.dial-meta small { display: block; color: var(--faint); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.dial-meta b { font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---- Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 500; background: var(--surface-2); white-space: nowrap; }
td.n, th.n { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.name { color: var(--gold-strong); }
tr.total td { color: var(--gold-strong); background: var(--surface-2); font-weight: 500; }
tr.sub td { color: var(--muted); font-size: 12.5px; }
td.pend { color: var(--faint); }
tr.former td { opacity: .62; }
.cell-sub { display: block; color: var(--faint); font-size: 12px; }

details.disclose { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.disclose > summary { cursor: pointer; padding: 14px 18px; list-style: none; display: flex; justify-content: space-between; align-items: center; color: var(--gold-strong); }
details.disclose > summary::after { content: '+'; color: var(--gold); font-size: 18px; }
details.disclose[open] > summary::after { content: '−'; }
details.disclose > div { padding: 0 18px 18px; }

/* ---- Drawer */
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(620px, 100vw); border: 0; border-left: 1px solid var(--line-strong); background: #151513; color: var(--text); padding: 0; }
dialog.drawer::backdrop { background: rgba(0, 0, 0, .55); }
.drawer-inner { padding: 28px 30px 60px; display: grid; gap: 16px; }
.drawer-close { position: sticky; top: 0; float: right; margin: 14px 14px 0 0; z-index: 1; }
.drawer h2 { font-size: 22px; }
.drawer h3 { color: var(--gold); margin-top: 8px; }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--muted); white-space: pre-wrap; }

/* ---- Empty / pending */
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 22px; color: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(255, 255, 255, .012) 10px 20px); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.pending-val { color: var(--pending); font-size: 22px; }

/* ---- Rocks */
.rock { display: grid; grid-template-columns: 1fr 210px; gap: 18px; }
.rock + .rock { margin-top: 12px; }
.rock .focus { margin-top: 12px; background: var(--gold-wash); border: 1px solid rgba(214, 188, 126, .2); border-radius: var(--radius-sm); padding: 10px 12px; }
.rock .focus small { color: var(--gold); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.rock.on { border-left: 3px solid var(--on); } .rock.off { border-left: 3px solid var(--off); } .rock.progress { border-left: 3px solid var(--watch); } .rock.done { border-left: 3px solid var(--gold); }
.status-picker { display: grid; gap: 6px; }
.status-picker button { text-align: left; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 7px 10px; cursor: pointer; color: var(--muted); display: flex; align-items: center; gap: 8px; font-size: 13px; }
.status-picker button::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--pending); }
.status-picker button[data-s="on"]::before { background: var(--on); } .status-picker button[data-s="progress"]::before { background: var(--watch); } .status-picker button[data-s="off"]::before { background: var(--off); } .status-picker button[data-s="done"]::before { background: var(--gold); }
.status-picker button[aria-pressed="true"] { color: var(--text); border-color: var(--gold-dim); background: var(--raised); }
.issue { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.issue:first-child { border-top: 0; }
.issue.resolved span { color: var(--faint); text-decoration: line-through; }
.vto h3 { color: var(--gold); margin: 16px 0 6px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.vto h3:first-child { margin-top: 0; }
.vto p + p { margin-top: 6px; }
.vto b { color: var(--gold-strong); font-weight: 500; }

/* ---- Path */
.driver-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) auto; gap: 18px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.driver-row:first-child { border-top: 0; }
.driver-row h3 small { display: block; color: var(--faint); font-size: 12px; font-weight: 400; margin-top: 2px; }
.driver-nums { display: grid; grid-template-columns: repeat(3, auto); gap: 2px 16px; font-size: 12.5px; color: var(--muted); }
.driver-nums b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: auto; display: block; margin-top: 12px; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dials { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 26px 26px 70px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; padding: 10px 16px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand img { width: 104px; height: 36px; } .brand small, .side-foot { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { grid-template-columns: 1fr; padding: 7px 10px; white-space: nowrap; font-size: 13.5px; }
  .nav a i, .nav a span small { display: none; }
  main { padding: 20px 16px 70px; }
  h1 { font-size: 25px; }
  .g2, .g3, .g4, .g6, .form-grid { grid-template-columns: 1fr; }
  .dials, .dials.two { grid-template-columns: 1fr; }
  .rock { grid-template-columns: 1fr; }
  .action { grid-template-columns: 30px 1fr; }
  .action > :last-child { grid-column: 2; }
  .evidence li { grid-template-columns: 1fr; gap: 0; }
  .driver-row { grid-template-columns: 1fr; gap: 8px; }
  .big { font-size: 28px; }
  .mobile-only { display: inline-flex !important; }
}
.mobile-only { display: none !important; }
@media print { .side, .periodbar, .btn { display: none !important; } .shell { display: block; } }
