*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--signal); }
a:hover { color: var(--navy); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--navy); color: var(--surface); padding: 10px 14px; border-radius: var(--r-sm); }
.skip:focus { top: 12px; }

/* Shell: navy sidebar + one main column. */
.app { display: flex; gap: var(--gap); padding: var(--gap); min-height: 100vh; align-items: stretch; }
.app > main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.app > main:focus { outline: none; }
.page { display: flex; flex-direction: column; gap: var(--gap); flex: 1 0 auto; }
.page > .footer { margin-top: auto; }

.sidebar {
  position: sticky; top: var(--gap);
  width: 264px; flex: 0 0 264px;
  height: calc(100vh - 2 * var(--gap));
  overflow-y: auto;
  padding: 24px 16px;
  border-radius: 24px;
  background: var(--navy);
  color: var(--surface);
  display: flex; flex-direction: column; gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--navy-line) transparent;
}
.sidebar > * { flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: var(--surface); text-decoration: none; }
.brand:hover { color: var(--surface); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-stretch: 125%; font-weight: 900; font-size: 15px; text-transform: uppercase; letter-spacing: .3px; }
.brand-sub { font-size: 12px; color: var(--sky); font-weight: 600; letter-spacing: .4px; }
.logo-bg { fill: var(--navy-2); }
.logo-a { stroke: var(--sky); }
.logo-b { stroke: var(--signal); }
.logo-c { stroke: var(--logo-ember); }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { padding: 0 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--sky); }
.nav-item {
  display: flex; align-items: flex-start; gap: 10px;
  min-height: var(--target); padding: 11px 12px; border-radius: 12px;
  color: var(--nav-text); text-decoration: none; font-size: 14px; font-weight: 500; line-height: 1.3;
}
.nav-item:hover { background: var(--navy-2); color: var(--surface); }
.nav-item .num { font-family: var(--font-mono); font-size: 13px; color: var(--nav-muted); min-width: 14px; }
.nav-item[aria-current="page"], .nav-item.is-active { background: var(--signal); color: var(--surface); font-weight: 600; }
.nav-item[aria-current="page"] .num, .nav-item.is-active .num { color: var(--surface); }
.nav-home { align-items: center; font-weight: 700; letter-spacing: .6px; color: var(--nav-dim); }
.soon { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: .6px; color: var(--nav-muted); border: 1px solid var(--navy-line); border-radius: 6px; padding: 2px 6px; }
.nav-subs { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 6px 22px; padding-left: 12px; border-left: 2px solid var(--navy-line); }
.nav-sub { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: 10px; color: var(--nav-dim); text-decoration: none; font-size: 13px; font-weight: 500; }
.nav-sub:hover { background: var(--navy-2); color: var(--surface); }
.nav-sub .num { font-family: var(--font-mono); color: var(--nav-muted); }
.nav-sub[aria-current="page"] { background: var(--mist); color: var(--navy); font-weight: 700; }
.nav-sub[aria-current="page"] .num { color: var(--navy); }

.user-chip { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: var(--r-md); background: var(--navy-2); }
.avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 999px; background: var(--sky); color: var(--navy); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.user-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--nav-caption); }
.icon-btn { width: var(--target); height: var(--target); border: 0; border-radius: 10px; background: transparent; color: var(--nav-dim); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--navy); color: var(--surface); }

.topbar { display: none; }

/* Panels and type */
.panel { border-radius: var(--r-xl); background: var(--surface); padding: 32px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 24px; }
.panel.tight { padding: 24px; gap: 16px; }
.hero { border-radius: var(--r-xl); background: var(--peach); padding: 40px; display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; align-items: flex-end; }
.hero-copy { display: flex; flex-direction: column; gap: 14px; flex: 1 1 420px; max-width: 640px; }
.hero > .row { flex: 0 0 auto; }
.eyebrow { font-size: 13px; font-weight: 700; color: var(--ember-dark); letter-spacing: 1px; text-transform: uppercase; }
.display { margin: 0; font-family: var(--font-display); font-stretch: 125%; font-weight: 900; font-size: clamp(30px, 4vw, 44px); line-height: 1.02; text-transform: uppercase; color: var(--navy); }
.lead { margin: 0; font-size: 17px; line-height: 1.55; color: var(--peach-ink); }
.h2 { margin: 0; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 20px; text-transform: uppercase; color: var(--navy); }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.mono { font-family: var(--font-mono); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px; }

.page-head { padding: 8px 8px 0; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.page-head .crumb { font-family: var(--font-mono); font-size: 13px; color: var(--signal); }
.page-title { margin: 4px 0 0; font-family: var(--font-display); font-stretch: 125%; font-weight: 900; font-size: 30px; line-height: 1.05; text-transform: uppercase; color: var(--navy); }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--target); padding: 0 20px; border-radius: var(--r-md); border: 1.5px solid transparent; font-weight: 700; font-size: 15px; text-decoration: none; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 16px; }
.btn-ember { background: var(--ember); color: var(--surface); }
.btn-ember:hover { background: var(--ember-dark); color: var(--surface); }
.btn-primary { background: var(--signal); color: var(--surface); }
.btn-primary:hover { background: var(--navy); color: var(--surface); }
.btn-white { background: var(--surface); color: var(--navy); }
.btn-white:hover { color: var(--signal); }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--navy); }
.btn-ghost:hover { border-color: var(--signal); color: var(--signal); }

.badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--r-sm); font-weight: 600; font-size: 13px; }
.badge .dot { width: 8px; height: 8px; border-radius: 2px; }
.badge.aws { background: var(--aws-bg); color: var(--aws-ink); }
.badge.aws .dot { background: var(--aws-dot); }
.badge.gcp { background: var(--gcp-bg); color: var(--gcp-ink); }
.badge.gcp .dot { background: var(--gcp-dot); border-radius: 999px; }
.hero .badge { background: var(--surface); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.chip.open { background: var(--st-open-bg); color: var(--st-open-ink); }
.chip.analysis { background: var(--st-analysis-bg); color: var(--st-analysis-ink); }
.chip.resolved { background: var(--st-resolved-bg); color: var(--st-resolved-ink); }
.chip.closed { background: var(--st-closed-bg); color: var(--st-closed-ink); }
.phase-pill { padding: 4px 12px; border-radius: 999px; color: var(--surface); font-weight: 700; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; }
.phase-pill.inform { background: var(--phase-inform); }
.phase-pill.optimize { background: var(--phase-optimize); }
.phase-pill.operate { background: var(--phase-operate); }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { border-radius: var(--r-lg); background: var(--surface); padding: 20px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .6px; }
.kpi-value { font-family: var(--font-display); font-stretch: 112%; font-weight: 800; font-size: 34px; color: var(--navy); line-height: 1.1; }
.kpi-value.ember { color: var(--ember); }
.kpi-value.pending { color: var(--ink-3); font-size: 28px; }
.kpi-caption { font-size: 13px; color: var(--ink-2); }
.meter { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--phase-optimize); }

/* Module cards on Home */
.phase-block { display: flex; flex-direction: column; gap: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.card { text-decoration: none; color: var(--ink); border: 1.5px solid var(--line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.card:hover { border-color: var(--signal); color: var(--ink); }
.card-top { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 13px; color: var(--signal); }
.card-title { font-weight: 700; font-size: 16px; }
.card-text { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.card.planned { border-style: dashed; border-color: var(--line-2); }
.phase-optimize .card-top { color: var(--phase-optimize); }
.phase-operate .card-top { color: var(--phase-operate); }
.later-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.note { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 16px; background: var(--mist); font-size: 14px; color: var(--navy); }
.note.warn { background: var(--peach); color: var(--peach-ink); }

/* Scope list (module progress) */
.scope { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 24px; }
.scope li { position: relative; padding-left: 26px; font-size: 14px; color: var(--ink-2); }
.scope li::before { content: ""; position: absolute; left: 2px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line-2); }
.scope li.partial::before { background: linear-gradient(90deg, var(--signal) 50%, transparent 50%); border-color: var(--signal); }
.scope li.done { color: var(--ink); }
.scope li.done::before { background: var(--phase-optimize); border-color: var(--phase-optimize); }
.progress-text { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }

.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }

.footer { display: flex; justify-content: flex-end; padding: 14px 24px; border-radius: 16px; background: var(--navy); color: var(--nav-text); font-size: 13px; }
.footer .heart { color: var(--heart); margin: 0 4px; }
.footer .by { color: var(--sky); font-weight: 600; margin-left: 4px; }

.toast-host { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 40; }
.toast { min-width: 260px; max-width: 420px; padding: 14px 16px; border-radius: var(--r-md); background: var(--navy); color: var(--surface); box-shadow: var(--shadow-raised); font-size: 14px; }
.toast.error { background: var(--ember); }

.loading { color: var(--ink-2); padding: 40px; }
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--gap); }
.signin .hero { max-width: 760px; }


/* Form controls */
.input { min-height: var(--target); padding: 0 12px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; }
.input:focus { border-color: var(--signal); outline: none; box-shadow: 0 0 0 3px var(--mist); }
textarea.input { padding: 10px 12px; min-height: 80px; resize: vertical; width: 100%; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.link-btn { background: none; border: 0; color: var(--signal); font-weight: 600; font-size: 13px; padding: 6px; min-height: 36px; }
.link-btn:hover { color: var(--navy); }
.icon-btn.sm { width: 36px; height: 36px; color: var(--ink-2); }
.icon-btn.sm:hover { background: var(--mist); color: var(--navy); }
.check { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--signal); }
.ember-text { color: var(--ember); }
.tab { min-height: 40px; padding: 0 16px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.tab[aria-selected="true"] { background: var(--navy); color: var(--surface); }
.tab:hover:not([aria-selected="true"]) { background: var(--mist); color: var(--navy); }

/* Dynamic table */
.dt { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dt-bar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.dt-views { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--ground); }
.dt-views:empty { display: none; }
.dt-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dt-search { position: relative; display: flex; align-items: center; color: var(--ink-2); }
.dt-search svg { position: absolute; left: 12px; pointer-events: none; }
.dt-search .input { padding-left: 36px; width: 260px; max-width: 100%; }
.dt-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.dt-cols { position: relative; }
.popover { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; max-height: 360px; overflow-y: auto; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-raised); border: 1px solid var(--line); }
.popover-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-2); margin-bottom: 6px; }
.dt-chips { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.dt-chips:empty { display: none; }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-2); margin-right: 2px; }
.fchip { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; }
.fchip:hover { border-color: var(--signal); }
.fchip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--surface); }
.dt-summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 14px; }
.table-wrap { overflow: auto; max-height: calc(100vh - 220px); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.dt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; table-layout: fixed; min-width: 900px; }
.dt-table thead th { position: sticky; top: 0; z-index: 2; background: var(--ground); border-bottom: 1px solid var(--line); text-align: left; padding: 0; }
.th-btn { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; background: transparent; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-2); text-align: left; }
th.right .th-btn { justify-content: flex-end; }
.th-btn:hover { color: var(--navy); }
.th-btn .arrow { font-size: 10px; color: var(--line-2); }
th[aria-sort="ascending"] .arrow, th[aria-sort="descending"] .arrow { color: var(--signal); }
.dt-table td { padding: 10px 12px; border-bottom: 1px solid var(--track); vertical-align: middle; overflow: hidden; }
.dt-table td.right { text-align: right; }
.dt-table td.dt-toggle { padding: 4px 6px; }
.dt-table tbody tr:hover > td { background: var(--ground); }
.dt-table tr.is-open > td { background: var(--mist); }
.dt-table .clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-table .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.dt-group td { background: var(--ground); font-size: 13px; padding: 8px 12px; }
.dt-detail > td { background: var(--surface) !important; padding: 0; border-bottom: 2px solid var(--line); }
.dt-empty { text-align: center; color: var(--ink-2); padding: 40px 12px !important; }
.cell-select { min-height: 34px; padding: 0 8px; border: 1.5px solid var(--line-2); border-radius: 8px; background: var(--surface); font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); max-width: 100%; }
.badge.tight { padding: 3px 8px; font-size: 12px; }
.sev { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.sev.high { background: var(--st-open-bg); color: var(--st-open-ink); }
.sev.medium { background: var(--aws-bg); color: var(--aws-ink); }
.sev.low { background: var(--st-closed-bg); color: var(--st-closed-ink); }

/* Detail panel and audit trail */
.dt-detail .detail { position: sticky; left: 0; width: var(--wrap-w, 100%); }
.detail form { margin-top: 16px; }
.detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; padding: 20px 24px; }
.detail h3 { margin: 0 0 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-2); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .help { font-weight: 400; font-size: 12px; }
.field .error { color: var(--ember); font-weight: 600; font-size: 12px; }
.field.has-error .input { border-color: var(--ember); }
.req { color: var(--ember); }
.trail { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.trail li { position: relative; padding-left: 18px; font-size: 13px; color: var(--ink); }
.trail li::before { content: ""; position: absolute; left: 0; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.trail .when { color: var(--ink-2); font-size: 12px; }
.trail .quote { display: block; margin-top: 4px; padding: 8px 10px; border-radius: 8px; background: var(--ground); white-space: pre-wrap; }


/* Generated forms */
.gen-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.gen-form:has(.gen-aside) { grid-template-columns: minmax(0, 1fr) 320px; }
.gen-main { display: flex; flex-direction: column; gap: 20px; }
.fieldset { border: 0; margin: 0; padding: 24px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); }
.fieldset legend { float: left; width: 100%; margin-bottom: 16px; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 16px; text-transform: uppercase; color: var(--navy); }
.fieldset > .form-grid { clear: both; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field[hidden] { display: none; }
.field textarea.input { min-height: 90px; }
.form-actions { justify-content: flex-end; }
.gen-aside { position: sticky; top: var(--gap); display: flex; flex-direction: column; gap: 16px; padding: 24px; border-radius: var(--r-lg); background: var(--peach); color: var(--peach-ink); font-size: 14px; }
.gen-aside h3 { margin: 0; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 15px; text-transform: uppercase; color: var(--navy); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--ground); border: 1px solid var(--line); width: fit-content; }
.segmented button { min-height: 36px; min-width: 64px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--navy); box-shadow: 0 1px 2px rgba(1, 30, 106, 0.15); }
.field .segmented + .help, .field .input + .help { margin-top: -2px; }
@media (max-width: 1100px) { .gen-form:has(.gen-aside) { grid-template-columns: minmax(0, 1fr); } .gen-aside { position: static; } }

/* Modal */
dialog.modal { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: var(--r-xl); box-shadow: var(--shadow-raised); background: var(--ground); color: var(--ink); }
dialog.modal.wide { width: min(980px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(1, 30, 106, 0.45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.tag-preview { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; padding: 16px; border-radius: var(--r-md); background: var(--surface); font-family: var(--font-mono); font-size: 13px; }
.tag-preview dt { color: var(--signal); }
.tag-preview dd { margin: 0; overflow-wrap: anywhere; }
.kv-chip { display: inline-flex; gap: 6px; padding: 2px 8px; border-radius: 6px; background: var(--ground); font-size: 12px; }


/* Cost report */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, max-content)); gap: 16px 20px; align-items: end; }
.ms-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.ms { position: relative; }
.ms-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; }
.ms-summary::-webkit-details-marker { display: none; }
.ms-summary::after { content: "▾"; color: var(--ink-2); font-size: 12px; }
.ms-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-2); }
.ms-value { margin-left: auto; font-weight: 600; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.ms-panel { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 240px; padding: 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-raised); display: flex; flex-direction: column; gap: 8px; }
.ms-search { width: 100%; }
.ms-list { max-height: 260px; overflow-y: auto; }
.ms-list .check[hidden] { display: none; }
.th-static { display: flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-2); }
th.right .th-static { justify-content: flex-end; }
.matrix { table-layout: auto; min-width: 0; }
.matrix tfoot td { position: sticky; bottom: 0; background: var(--mist); border-top: 2px solid var(--line); padding: 10px 12px; }
.matrix tr.group-start > td { border-top: 2px solid var(--line); }

@media (max-width: 900px) {
  .app { flex-direction: column; padding: 12px 16px; gap: 16px; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 18px; background: var(--navy); }
  .topbar .icon-btn { color: var(--surface); }
  .sidebar { display: none; position: fixed; inset: 0; z-index: 30; width: auto; height: auto; border-radius: 0; }
  .app.nav-open .sidebar { display: flex; }
  .sidebar .close-nav { display: inline-flex; }
  .hero, .panel { padding: 24px; }
}
.close-nav { display: none; align-self: flex-end; }

@media print {
  .sidebar, .topbar, .toast-host, .no-print { display: none !important; }
  .app { padding: 0; }
  .panel, .kpi { box-shadow: none; border: 1px solid var(--line); }
  body { background: var(--surface); }
}
.page-sub { margin: -8px 8px 0; }
