:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --line: #e1e0d9;
  --line-2: #efeee9;
  --nav: #0a1b3d;
  --nav-ink: #c6d1e2;
  --nav-active: #16305e;
  --brand: #2d6bff;
  --accent: #2459d6;
  --accent-hover: #1d49b3;
  --accent-soft: #e9f0ff;
  --good: #0ca30c;
  --good-ink: #006300;
  --good-soft: #e7f5e7;
  --warning: #fab219;
  --warning-ink: #7a5000;
  --warning-soft: #fff4dc;
  --serious: #ec835a;
  --serious-ink: #9c3f19;
  --serious-soft: #fdeee7;
  --critical: #d03b3b;
  --critical-ink: #a82828;
  --critical-soft: #fbeaea;
  --info-ink: #1c5cab;
  --info-soft: #e8f0fb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 35, 63, .05), 0 6px 18px rgba(16, 35, 63, .05);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
h1 { font-size: 22px; line-height: 1.25; margin: 0 0 2px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0; font-weight: 620; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 620; }
p { margin: 0 0 8px; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 8px; }
.boot { padding: 40px; color: var(--muted); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30; }
.brand { display: flex; flex-direction: column; gap: 4px; padding: 20px 20px 10px; color: #fff; }
.brand img { width: 132px; height: auto; display: block; }
.brand b { font-size: 15px; }
.brand small { display: block; color: #8fa3c2; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.nav-group { padding: 16px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #7f93b3; }
.side nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; margin: 1px 8px; border-radius: 7px; color: var(--nav-ink); text-decoration: none; }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.active { background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.nav-pill { font-size: 10.5px; padding: 1px 7px; border-radius: 99px; background: rgba(90, 160, 255, .16); color: #cfe0ff; }
.nav-pill.lock { background: rgba(250, 178, 25, .18); color: #ffd27a; }
.nav-count { font-size: 11px; min-width: 20px; text-align: center; padding: 0 6px; border-radius: 99px; background: var(--critical); color: #fff; }
.nav-count.warn { background: #b07a00; }
.side-foot { margin-top: auto; padding: 14px 20px 18px; font-size: 12px; color: #8fa3c2; border-top: 1px solid rgba(255, 255, 255, .08); }
.side-foot button { background: none; border: 1px solid rgba(255, 255, 255, .18); color: #dbe5f3; border-radius: 6px; padding: 3px 9px; margin-top: 8px; cursor: pointer; }
.side-foot button:hover { background: rgba(255, 255, 255, .08); }

.main { display: flex; flex-direction: column; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; min-height: 56px; }
.cycle-info { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cycle-info .sep { color: var(--line); margin: 0 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.nav-toggle { display: none; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 3px 12px 3px 3px; cursor: pointer; }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--nav); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.user-btn small { display: block; color: var(--muted); font-size: 11px; line-height: 1.1; text-align: left; }
.user-btn span.who { text-align: left; line-height: 1.15; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-width: 190px; padding: 4px; z-index: 35; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.banner { background: #fff8e6; border-bottom: 1px solid #f3dfaa; color: #6b4a00; padding: 7px 28px; font-size: 12.5px; }
.view { padding: 22px 28px 64px; max-width: 1500px; width: 100%; }
.view:focus { outline: none; }

/* ---------- page primitives ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--ink-2); margin: 0; max-width: 780px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; min-width: 0; }
.card.flat { box-shadow: none; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-head.wrap { flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.grid2 .span2 { grid-column: 1 / -1; }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.alert { border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; font-size: 13px; }
.alert.info { background: var(--info-soft); color: #173f73; }
.alert.warning { background: var(--warning-soft); color: var(--warning-ink); }
.alert.critical { background: var(--critical-soft); color: var(--critical-ink); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 7px 13px; border-radius: 7px; cursor: pointer; font-weight: 550; text-decoration: none; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--surface-2); border-color: #cfcec6; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn.danger-text { color: var(--critical-ink); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.block { width: 100%; padding: 10px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 4px 6px; }
.icon-btn { border: 0; background: none; cursor: pointer; width: 30px; height: 30px; border-radius: 6px; color: var(--ink-2); font-size: 15px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
:focus-visible { outline: 2px solid #5aa0ff; outline-offset: 2px; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-weight: 550; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.scenario { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* forms */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field > span small, legend small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea, .filter select, .toolbar input, .toolbar select, .tbl.edit input, .tbl.edit select {
  border: 1px solid #d6d5cd; border-radius: 7px; padding: 7px 9px; background: #fff; min-width: 0; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus, .tbl.edit input:focus { border-color: #5aa0ff; outline: 2px solid rgba(90, 160, 255, .25); outline-offset: 0; }
.field input:disabled, .field select:disabled, .field textarea:disabled, .tbl.edit input:disabled { background: var(--surface-2); color: var(--ink-2); }
.field textarea { resize: vertical; }
.hint { color: var(--muted); font-size: 11.5px; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.check.pad-top { padding-top: 20px; }
.form-error { background: var(--critical-soft); color: var(--critical-ink); border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; font-size: 13px; }
.form-error ul { margin: 4px 0 0; padding-left: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 14px 0; min-width: 0; }
legend { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 76px 30px; gap: 6px; margin-bottom: 6px; }
.line-row select, .line-row input { border: 1px solid #d6d5cd; border-radius: 7px; padding: 6px 8px; background: #fff; min-width: 0; }
.line-card legend { font-size: 13px; color: var(--ink); }

/* filters & toolbar */
.controls { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); min-width: 130px; }
.filter select { padding: 5px 8px; font-size: 13px; color: var(--ink); }
.filter.inline { flex-direction: row; align-items: center; gap: 6px; min-width: 0; }
.filter.inline select { width: auto; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar input[type=search] { width: 260px; max-width: 100%; padding: 6px 9px; }
.toolbar select { width: auto; padding: 6px 8px; }

/* tiles */
.tiles { display: grid; grid-template-columns: 1.3fr repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); color: inherit; text-decoration: none; min-width: 0; }
a.tile:hover { border-color: #c9c8c0; }
.tile-label { font-size: 12px; color: var(--ink-2); }
.tile-value { font-size: 24px; font-weight: 650; margin: 4px 0 2px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.hero .tile-value { font-size: 34px; }
.tile-sub { font-size: 12px; color: var(--muted); }
.up { color: var(--good-ink); }
.down { color: var(--critical-ink); }
.stat-row { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 8px; }
.stat-row > div { display: flex; flex-direction: column; }
.stat-row b { font-size: 18px; font-weight: 650; }

/* chips & badges */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px 1px 6px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12px; white-space: nowrap; }
.chip.plain { padding: 1px 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 2px; padding: 1px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good-ink); }
.badge.warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge.serious { background: var(--serious-soft); color: var(--serious-ink); }
.badge.critical { background: var(--critical-soft); color: var(--critical-ink); }
.badge.info { background: var(--info-soft); color: var(--info-ink); }
.badge.muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-2); }
.risk-text { color: var(--serious-ink); font-weight: 600; }

/* tables */
.tbl-wrap { overflow-x: auto; margin: 0 -2px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 7px 8px; white-space: nowrap; background: var(--surface); }
.tbl td { border-bottom: 1px solid var(--line-2); padding: 8px; vertical-align: top; }
.tbl tbody tr:hover td { background: #fafaf8; }
.tbl tr.faded td { color: var(--muted); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td.actions { white-space: nowrap; text-align: right; }
.tbl td.actions .btn + .btn { margin-left: 4px; }
.tbl a[data-project] { color: var(--ink); text-decoration: none; font-weight: 600; }
.tbl a[data-project]:hover { color: var(--accent); text-decoration: underline; }
.tbl tfoot td { font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; }
.tbl.matrix td, .tbl.matrix th { padding: 6px 7px; }
.tbl.matrix th button { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; padding: 0; }
.tbl.matrix th button:hover { color: var(--accent); }
.tbl.matrix th.sel, .tbl.matrix td.sel { background: var(--accent-soft); }
.tbl.edit td { padding: 4px; vertical-align: middle; }
.tbl.edit input { padding: 5px 7px; }
.tbl.edit input[type=number] { text-align: right; min-width: 80px; }
.tbl.edit input[type=checkbox] { width: auto; }
/* spec v0.5.1: sortable headers and per-column filters on the department boards */
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--accent); }
.tbl th.sortable:focus-visible { outline: 2px solid rgba(90, 160, 255, .35); outline-offset: -2px; }
.tbl th.sorted { color: var(--accent); }
.tbl th .sort-ind { font-size: 9px; margin-left: 3px; }
.tbl tr.col-filters th { padding: 3px 6px 6px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tbl tr.col-filters select.col-filter { width: 100%; min-width: 72px; font-size: 11px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink-2); }
.key-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.key-line { display: inline-block; width: 16px; height: 2px; border-radius: 2px; background: var(--ink); flex: none; }

/* funnel */
.funnel { display: grid; gap: 6px; }
.funnel-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 80px 80px; gap: 10px; align-items: center; }
.funnel-label { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.funnel-bar { background: var(--surface-2); height: 12px; border-radius: 4px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.funnel-head { font-size: 11.5px; color: var(--muted); }

/* charts */
.chart { position: relative; }
.chart-box { width: 100%; min-height: 60px; }
.chart-svg { display: block; overflow: visible; }
.chart-svg .tick { font-size: 11px; fill: #898781; font-variant-numeric: tabular-nums; }
.chart-svg .xlab { font-size: 11px; fill: #6f6d68; }
.chart-svg .xyear { font-size: 10px; fill: #898781; }
.chart-svg .risk-mark { font-size: 10px; fill: #c4592f; }
.tip { position: absolute; z-index: 10; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 22px rgba(0, 0, 0, .12); padding: 8px 10px; font-size: 12px; min-width: 190px; max-width: 300px; }
.tip-title { font-weight: 650; margin-bottom: 4px; }
.tip-sub { color: var(--muted); margin: 6px 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.tip-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.tip-row span { flex: 1; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tip-row.total { border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 4px; }
.tip-row.risk span, .tip-row.risk b { color: var(--serious-ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink-2); margin: 0 0 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.chart-note { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* timeline */
.tl { min-width: 860px; }
.tl-row { display: grid; grid-template-columns: 260px minmax(0, 1fr); border-bottom: 1px solid var(--line-2); }
.tl-row.faded { opacity: .45; }
.tl-label { padding: 7px 10px 7px 0; min-width: 0; }
.tl-label a { color: var(--ink); font-weight: 600; text-decoration: none; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-label a:hover { color: var(--accent); }
.tl-track { position: relative; min-height: 44px; background-image: linear-gradient(to right, var(--line-2) 1px, transparent 1px); }
.tl-head .tl-track { min-height: 26px; }
.tl-head span { position: absolute; top: 5px; font-size: 11px; color: var(--muted); padding-left: 4px; white-space: nowrap; }
.tl-bar { position: absolute; top: 17px; height: 10px; border-radius: 3px; }
.tl-bar.eng { background: #2a78d6; top: 9px; }
.tl-bar.mfg { background: #eb6834; top: 20px; }
.tl-bar.dep { background: #1baf7a; top: 31px; height: 6px; }
.tl-bar.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tl-bar.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.tl-rev { position: absolute; top: 13px; width: 11px; height: 11px; margin-left: -5.5px; background: #0b0b0b; transform: rotate(45deg); border: 2px solid #fff; border-radius: 2px; }
.tl-beyond { position: absolute; right: 4px; top: 26px; font-size: 11px; color: var(--muted); background: #fff; padding: 0 3px; }
.tl-legend-diamond { display: inline-block; width: 9px; height: 9px; background: #0b0b0b; transform: rotate(45deg); border-radius: 1px; }

/* checklist meters */
.meters { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.meter-card { border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; }
.meter-card .row { justify-content: space-between; gap: 6px; }
.meter { height: 8px; background: var(--accent-soft); border-radius: 4px; overflow: hidden; margin: 8px 0 4px; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.meter.full span { background: var(--good); }

/* steps (cycle wizard) */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps > li { position: relative; padding: 0 0 18px 44px; }
.steps > li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.steps > li.done::before { content: "✓"; background: var(--good-soft); border-color: #bfe3bf; color: var(--good-ink); }
.steps > li::after { content: ""; position: absolute; left: 14px; top: 32px; bottom: 4px; width: 1px; background: var(--line); }
.steps > li:last-child::after { display: none; }
.steps h3 { margin: 4px 0 6px; font-size: 14px; }
.lock-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; background: #fff; }
.switch input { accent-color: var(--accent); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 550; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a:hover { color: var(--ink); }

/* project detail */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; margin-bottom: 14px; }
.facts div span { display: block; font-size: 11.5px; color: var(--muted); }
.facts div b { font-weight: 600; }
.chain { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin: 6px 0 16px; }
.chain > div { position: relative; padding: 18px 8px 0 0; font-size: 12px; }
.chain > div::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--line); }
.chain > div::after { content: ""; position: absolute; left: 0; top: 1px; width: 12px; height: 12px; border-radius: 50%; background: #2a78d6; border: 2px solid #fff; box-shadow: 0 0 0 1px #2a78d6; }
.chain > div.na::after { background: #fff; box-shadow: 0 0 0 1px var(--line); }
.chain b { display: block; font-size: 13px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 4px 0; display: flex; gap: 8px; align-items: baseline; }

/* preview */
.preview { margin-top: 6px; }
.preview-card { border: 1px dashed #c9d8ee; background: #f7faff; border-radius: 10px; padding: 12px 14px; }
.preview-card h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.preview-card h3 small { font-weight: 400; color: var(--muted); }
.mini-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 8px; }
.mini-tbl td { padding: 3px 0; border-bottom: 1px solid #e6edf7; }
.mini-tbl td:nth-child(2), .mini-tbl td:nth-child(3) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mini-tbl tr.changed td { font-weight: 650; }
.mini-tbl tr.changed td:nth-child(3) { color: var(--accent); }

/* dialogs */
.modal-backdrop, .drawer-backdrop { position: fixed; inset: 0; background: rgba(16, 24, 40, .34); z-index: 50; display: flex; }
.drawer-backdrop { z-index: 40; justify-content: flex-end; }
.modal-backdrop { align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal-backdrop.confirm { z-index: 60; align-items: center; }
.modal { background: var(--surface); border-radius: 12px; width: min(600px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.modal.wide { width: min(1000px, 100%); }
.modal.small { width: min(440px, 100%); }
.drawer { background: var(--surface); width: min(640px, 100%); height: 100%; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0, 0, 0, .18); animation: slide-in .16s ease-out; }
@keyframes slide-in { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 16px; }
.dlg-head .subtitle { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.dlg-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.dlg-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 12px 12px; flex-wrap: wrap; }
.drawer .dlg-foot { border-radius: 0; }
.foot-note { margin-right: auto; font-size: 12px; color: var(--muted); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 15px; user-select: all; }

/* toasts */
.toast-stack { position: fixed; bottom: 18px; right: 18px; z-index: 70; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: #1b2433; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: 13px; transition: opacity .25s, transform .25s; border-left: 4px solid #5aa0ff; }
.toast.good { border-left-color: var(--good); }
.toast.error { border-left-color: var(--critical); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 20% 0%, #1b3a7a 0%, #0a1b3d 55%, #07122a 100%); }
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: 14px; padding: 26px 26px 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 12.5px; }
.login-card form { display: grid; gap: 12px; }
.demo-box { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 12.5px; }
.demo-box table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.demo-box td { padding: 3px 4px; border-bottom: 1px solid var(--line-2); }
.demo-box code { font-size: 12px; }

/* method page */
.prose { max-width: 860px; }
.prose h2 { margin: 6px 0 8px; }
.prose ol, .prose ul { padding-left: 20px; margin: 6px 0 10px; }
.prose li { margin: 3px 0; }
.prose code { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; font-size: 12.5px; }
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 4px; }
.flow span { background: var(--accent-soft); color: #173f73; border-radius: 6px; padding: 4px 9px; font-size: 12.5px; font-weight: 600; }
.flow i { color: var(--muted); font-style: normal; }
.roadmap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.roadmap > div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.roadmap h3 { margin-bottom: 4px; }

/* responsive */
@media (max-width: 1200px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile.hero { grid-column: span 3; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .nav-toggle { display: inline-block; }
  .top, .view, .banner { padding-left: 16px; padding-right: 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile.hero { grid-column: span 2; }
  .cols2, .roadmap { grid-template-columns: 1fr; }
  .user-btn .who { display: none; }
  .user-btn { padding-right: 3px; }
}
@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 120px minmax(0, 1fr) 64px; }
  .funnel-row > :last-child { display: none; }
  .chain { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; }
  .top-actions .btn .lbl { display: none; }
}

/* ===== v0.2 ===== */
.brand .product { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #9fb4d8; padding-left: 2px; }
.login-brand img { width: 170px; height: auto; display: block; }
.login-brand .product { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.banner.model { background: #eef3ff; border-bottom-color: #c9d8fb; color: #173f73; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner.model .btn { padding: 3px 10px; }

/* tone chips (blue auto, green confirmed, yellow working/risk, red conflict) */
.tone { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.tone i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.tone.blue { background: #e9f0ff; color: #1d49b3; } .tone.blue i { background: #2a78d6; }
.tone.green { background: var(--good-soft); color: var(--good-ink); } .tone.green i { background: var(--good); }
.tone.yellow { background: var(--warning-soft); color: var(--warning-ink); } .tone.yellow i { background: var(--warning); }
.tone.red { background: var(--critical-soft); color: var(--critical-ink); } .tone.red i { background: var(--critical); }
button.tone { cursor: pointer; font-family: inherit; }
button.tone:hover { border-color: currentColor; }
.chain > div.tone-blue::after { background: #2a78d6; box-shadow: 0 0 0 1px #2a78d6; }
.chain > div.tone-green::after { background: var(--good); box-shadow: 0 0 0 1px var(--good); }
.chain > div.tone-yellow::after { background: var(--warning); box-shadow: 0 0 0 1px #d69400; }
.chain > div.tone-red::after { background: var(--critical); box-shadow: 0 0 0 1px var(--critical); }
.chain .state { display: block; font-size: 11px; font-weight: 600; margin-top: 2px; }
.chain .state.blue { color: #1d49b3; } .chain .state.green { color: var(--good-ink); } .chain .state.yellow { color: var(--warning-ink); } .chain .state.red { color: var(--critical-ink); }
.tone-legend { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }

/* home cycle card */
.cycle-card .meters { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.meter-card .who { font-size: 11.5px; color: var(--muted); margin-top: 2px; min-height: 16px; }
.meter-card.missing { border-color: #f3dfaa; background: #fffcf3; }
.missing-list { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; }
.missing-list li { display: flex; gap: 8px; align-items: baseline; }
.admin-strip { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line-2); margin-top: 12px; padding-top: 10px; }
.admin-strip input[type=month], .admin-strip input[type=text] { border: 1px solid #d6d5cd; border-radius: 7px; padding: 5px 8px; }
.lock-toggle { font-size: 12px; }

/* prospect board */
.board td { vertical-align: middle; }
.board .chips { display: flex; gap: 4px; flex-wrap: wrap; }
.readiness { font-size: 12px; font-weight: 600; }
.readiness.ready { color: var(--good-ink); }
.confirm-panel { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; background: var(--surface-2); }
.confirm-panel .row { justify-content: space-between; gap: 8px; }
.confirm-panel textarea { width: 100%; border: 1px solid #d6d5cd; border-radius: 7px; padding: 6px 8px; margin: 8px 0; resize: vertical; font: inherit; }
.linkish { color: var(--accent); text-decoration: none; }
.linkish:hover { text-decoration: underline; }

/* timeline tooltip */
.tl-card { position: relative; }
.tl-rev { cursor: help; }
.tl-rev.conflict { background: var(--critical); }
.tl-tip { position: absolute; z-index: 20; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 26px rgba(0,0,0,.14); padding: 9px 11px; font-size: 12px; width: 290px; }
.tl-tip .tip-row span { white-space: normal; }

/* book-to-bill */
.b2b { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.b2b-fy { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; }
.b2b-fy .big { font-size: 26px; font-weight: 650; }
.b2b-bar { height: 10px; border-radius: 5px; background: var(--accent-soft); overflow: hidden; margin: 8px 0 6px; }
.b2b-bar span { display: block; height: 100%; background: var(--accent); }
.grid-hours input { max-width: 110px; }
.cap-grid { overflow-x: auto; }
.cap-grid table { min-width: 1100px; }
.cap-grid input { width: 64px; text-align: right; }
@media (max-width: 900px) { .b2b { grid-template-columns: 1fr; } }
.board td:first-child { min-width: 210px; }
.board td:first-child a { white-space: normal; }
.env-badge { display: inline-block; background: #fff1dc; color: #8a4b00; border: 1px solid #f3cf97; border-radius: 6px; padding: 1px 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-right: 8px; }
.login-brand .env-badge { margin-top: 10px; }

/* ===== v0.4 ===== */
.help-link { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 650; text-decoration: none; vertical-align: middle; margin-left: 6px; }
.help-link:hover { color: var(--accent); border-color: var(--accent); }
.key-dotted { display: inline-block; width: 16px; height: 0; border-top: 2px dotted var(--ink-2); flex: none; }
.key-line.dash { background: none !important; height: 0; border-top: 2px dashed var(--ink); border-radius: 0; }
.chart-svg .end-label { font-size: 11.5px; }
.tip-note { color: var(--ink-2); white-space: normal; }
.tbl td.actions.lead { text-align: left; width: 1%; }
.cycle-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: inherit; text-decoration: none; padding: 10px 16px; }
.cycle-strip:hover { border-color: #c9c8c0; }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.th-note { font-size: 10px; font-weight: 400; color: var(--muted); }
.tbl.fin tr.used td { font-weight: 650; }
.warn-text { color: var(--warning-ink); font-weight: 600; }
.fin-edit input[type=number] { min-width: 104px; }
.fin-edit input[data-k=reason] { min-width: 170px; }
.forecast-list { display: grid; gap: 8px; }
.forecast-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 12px; }
.forecast-row b { min-width: 42px; }
.danger-zone { border-color: #efc4c4; }
.danger-zone input { border: 1px solid #d6d5cd; border-radius: 7px; padding: 6px 9px; }
.help-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.help-toc { position: sticky; top: 72px; padding: 10px 8px; }
.help-toc a { display: block; padding: 6px 10px; border-radius: 7px; color: var(--ink-2); text-decoration: none; }
.help-toc a:hover { background: var(--surface-2); color: var(--ink); }
.help-toc a.on { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.help-toc .toc-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 10px 10px 4px; }
.help-body { max-width: 900px; }
.help-body h2 { font-size: 19px; margin: 0 0 10px; }
.help-body h3 { font-size: 14px; margin: 18px 0 6px; }
.help-body ol, .help-body ul { padding-left: 20px; margin: 6px 0 10px; }
.help-body li { margin: 4px 0; }
.help-body .tbl { margin: 8px 0 12px; }
.help-body code { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; font-size: 12.5px; }
.help-body .callout { background: var(--info-soft); color: #173f73; border-radius: 8px; padding: 9px 12px; margin: 10px 0; }
.help-body .callout.warn { background: var(--warning-soft); color: var(--warning-ink); }
@media (max-width: 1200px) { .tiles.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .help-layout { grid-template-columns: 1fr; } .help-toc { position: static; } }
@media (max-width: 600px) { .tiles.four { grid-template-columns: 1fr; } }

/* ---------- v0.5 ---------- */
.tiles.six { grid-template-columns: 1.2fr repeat(5, minmax(0, 1fr)); }
@media (max-width: 1280px) { .tiles.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .tiles.six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.money-field { display: flex; gap: 6px; }
.money-field select { flex: 0 0 86px; min-width: 0; }
.money-field input { flex: 1; min-width: 0; }
.facts .fact-note { display: block; font-style: normal; font-size: 12px; margin-top: 2px; }
.std-hours { margin-top: 4px; }
.std-hours th, .std-hours td { padding: 5px 8px; }
.fx-table input[type=number] { width: 130px; }
.fx-table input[data-k=code] { width: 64px; text-transform: uppercase; }
.fx-table .code { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.fx-suggest { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
