/* ROCKWOOL CVI alternative. All visual tokens live here; calculation geometry
   (layer weights and transmission shares) remains in the Razor templates. */
:root {
    color-scheme: light;
    --red: #D20014;
    --red-dark: #8C0F1E;
    --black: #000000;
    --grey: #63666A;
    --white: #FFFFFF;
    --yellow: #EBEA79;
    --beige: #D6BB74;
    --coral: #FF7768;
    --blue: #45A6DE;
    --green: #1AB092;
    --grey-75: #8A8C8F;
    --grey-50: #B1B3B5;
    --grey-25: #D8D9DA;
    --yellow-25: #FAFADE;
    --green-25: #C6EBE4;
    --blue-25: #D1E9F7;
    --beige-25: #F5EEDC;
    --ink: var(--black);
    --text: var(--black);
    --muted: var(--grey);
    --heading: var(--grey);
    --line: var(--grey-25);
    --paper: var(--white);
    --surface: var(--white);
    --surface-band: var(--grey-25);
    --error: var(--red-dark);
    --font: "Avenir Next LT Pro", "Avenir Next", Avenir, Arial, sans-serif;
    --text-small: 14px;
    --text-body: 16px;
    --text-title: 21px;
    --text-section: 28px;
    --text-display: 38px;
    --weight-regular: 400;
    --weight-medium: 600;
    --weight-bold: 700;
    --leading: 1.5;
    --leading-heading: 1.25;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --space-9: 40px;
    --space-10: 48px;
    --radius-card: 8px;
    --radius-control: 6px;
    --radius-small: 4px;
    --radius-round: 50%;
    --border: 1px;
    --indicator: 3px;
    --focus: 2px;
    --control-height: 40px;
    --control-compact: 36px;
    --sidebar-width: 224px;
    --summary-width: 272px;
    --content-width: 1600px;
    --modal-width: 800px;
    --table-number-width: 105px;
    --brand-width: 164px;
    --brand-width-compact: 148px;
    --topbar-height: 73px;
    --topbar-height-compact: 59px;
    --copy-width: 680px;
    --empty-copy-width: 380px;
    --textarea-height: 90px;
    --json-height: 400px;
    --code-height: 480px;
    --unit-clearance: 76px;
    --table-input-width: 80px;
    --table-name-width: 148px;
    --error-width: 140px;
    --editor-side-width: 170px;
    --diagram-height: 145px;
    --summary-metric-width: 210px;
    --skip-link-offset: -80px;
    --shadow: none;
    --backdrop: rgb(0 0 0 / 60%);
    --transition: 150ms ease;
    font-family: var(--font);
    font-size: var(--text-body);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--paper); line-height: var(--leading); text-align: left; hyphens: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; color: var(--grey); background: var(--grey-25); border-color: var(--grey-50); opacity: 1; }
button, input, select, textarea, a { outline-offset: var(--space-1); }
:focus-visible { outline: var(--focus) solid var(--black); }
button:focus:not(:focus-visible) { outline: none; }
input:focus, select:focus, textarea:focus { outline: var(--focus) solid var(--black); outline-offset: var(--focus); }
a { color: var(--red); text-decoration-thickness: var(--border); text-underline-offset: var(--space-1); }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { color: var(--heading); line-height: var(--leading-heading); font-weight: var(--weight-bold); }
h1 { font-size: var(--text-display); margin-bottom: var(--space-3); }
h2 { font-size: var(--text-title); margin-bottom: var(--space-3); }
h3, h4 { font-size: var(--text-body); margin-bottom: var(--space-2); }
p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }
svg { vertical-align: middle; flex-shrink: 0; }
button svg { pointer-events: none; }
.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); color: var(--text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding: var(--space-8) var(--space-4) var(--space-6); border-right: var(--border) solid var(--line); }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); padding: 0 var(--space-3) var(--space-9); }
.brand-logo { display: block; width: var(--brand-width); max-width: 100%; height: auto; }
.brand-name { color: var(--red); font-size: var(--text-title); font-weight: var(--weight-bold); }
.brand-subtitle { display: block; color: var(--grey); font-size: var(--text-small); font-weight: var(--weight-medium); margin-top: var(--space-2); }
.sidebar nav { display: grid; gap: var(--space-2); }
.nav-item { display: flex; align-items: center; width: 100%; min-height: var(--space-10); gap: var(--space-3); padding: var(--space-3); border: 0; border-radius: var(--radius-control); background: transparent; color: var(--text); text-align: left; font-size: var(--text-small); transition: background var(--transition); }
.nav-item:hover { background: var(--grey-25); }
.nav-item.active { color: var(--black); background: var(--grey-25); box-shadow: inset var(--indicator) 0 var(--red); font-weight: var(--weight-bold); }
.nav-index { color: var(--grey); font-size: var(--text-small); font-variant-numeric: tabular-nums; width: var(--space-6); }
.nav-item.active .nav-index, .nav-item:hover .nav-index { color: var(--black); }
.nav-label { flex: 1; }
.nav-count { font-size: var(--text-small); color: var(--black); padding: 0 var(--space-1); }
.sidebar-bottom { margin-top: auto; border-top: var(--border) solid var(--line); padding: var(--space-5) var(--space-3) 0; color: var(--muted); font-size: var(--text-small); }
.sidebar-bottom p { margin: var(--space-3) 0; }
.status-dot { display: inline-block; width: var(--space-2); height: var(--space-2); border-radius: var(--radius-round); background: var(--grey); margin-right: var(--space-2); vertical-align: middle; }
.workspace, .primary { min-width: 0; }
.topbar { min-height: var(--topbar-height); padding: var(--space-4) var(--space-8); display: flex; justify-content: space-between; align-items: center; gap: var(--space-5); background: var(--surface); border-bottom: var(--border) solid var(--line); }
.breadcrumb { color: var(--muted); font-size: var(--text-small); overflow-wrap: anywhere; }
.breadcrumb strong { color: var(--ink); font-weight: var(--weight-medium); }
.topbar-actions { display: flex; gap: var(--space-3); align-items: center; flex-shrink: 0; }
.tag, .pill { display: inline-flex; align-items: center; gap: var(--space-2); width: fit-content; padding: var(--space-1) var(--space-2); border-radius: var(--radius-small); font-size: var(--text-small); font-weight: var(--weight-medium); background: var(--grey-25); color: var(--black); line-height: var(--leading); }
.tag-muted { background: var(--white); border: var(--border) solid var(--line); color: var(--grey); }
.pill.amber { background: var(--yellow-25); color: var(--black); }
.pill.green { background: var(--green-25); color: var(--black); }
.pill.amber::before { content: "!"; font-weight: var(--weight-bold); }
.pill.green::before { content: "✓"; font-weight: var(--weight-bold); }
.session-strip { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-1) var(--space-5); padding: var(--space-3) var(--space-8); background: var(--yellow-25); border-bottom: var(--border) solid var(--line); color: var(--black); font-size: var(--text-small); }
.session-strip > span:first-child::before { content: "ⓘ"; margin-right: var(--space-2); }
.main-content { max-width: var(--content-width); padding: var(--space-8) var(--space-8) var(--space-6); margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-6); margin-bottom: var(--space-6); }
.page-heading p { max-width: var(--copy-width); color: var(--muted); font-size: var(--text-body); }
.page-heading > .pill { flex-shrink: 0; }
.eyebrow, .section-label { color: var(--muted); font-size: var(--text-small); font-weight: var(--weight-medium); margin-bottom: var(--space-2); }
.eyebrow { color: var(--red); }
.heading-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); padding-top: var(--space-5); }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) var(--summary-width); gap: var(--space-6); align-items: start; }
.workbench > .primary > * + * { margin-top: var(--space-6); }
.summary-panel { min-width: 0; position: sticky; top: var(--space-6); display: grid; gap: var(--space-5); }
.summary-panel .card-header, .summary-panel .card-body, .summary-panel .card-footer { padding-left: var(--space-5); padding-right: var(--space-5); }
.card { min-width: 0; background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow); }
.card-header { display: flex; gap: var(--space-4); justify-content: space-between; align-items: center; padding: var(--space-6); border-bottom: var(--border) solid var(--line); }
.card-header h2, .card-header h3 { margin-bottom: 0; }
.card-header p { color: var(--muted); font-size: var(--text-small); margin: var(--space-2) 0 0; }
.card-body { padding: var(--space-6); }
.card-footer { padding: var(--space-4) var(--space-6); background: var(--surface-band); border-top: var(--border) solid var(--line); font-size: var(--text-small); color: var(--black); }
.muted, .field-hint { color: var(--muted); }
.small { font-size: var(--text-small); }
.notice { position: relative; font-size: var(--text-small); padding: var(--space-4) var(--space-5); border: var(--border) solid var(--line); border-left: var(--space-1) solid var(--grey); background: var(--white); color: var(--black); border-radius: var(--radius-control); line-height: var(--leading); }
.notice::before { content: "ⓘ"; display: inline-block; font-weight: var(--weight-medium); margin-right: var(--space-2); }
.notice.warning { color: var(--black); background: var(--yellow-25); }
.notice.warning::before { content: "⚠"; }
.notice.success { color: var(--black); background: var(--green-25); }
.notice.success::before { content: "✓"; }
.notice.error { color: var(--error); background: var(--white); border-color: var(--error); }
.notice.error::before { content: "!"; }
.notice strong { color: inherit; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-2) var(--space-4); min-height: var(--control-height); border-radius: var(--radius-control); border: var(--border) solid var(--grey-50); font-weight: var(--weight-medium); font-size: var(--text-small); line-height: var(--leading); text-decoration: none; background: var(--surface); color: var(--black); transition: background var(--transition), border-color var(--transition); }
.button:hover { background: var(--grey-25); border-color: var(--grey); }
.button.primary { color: var(--white); background: var(--red); border-color: var(--red); font-weight: var(--weight-bold); }
.button.primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
/* Existing actions stay in place. Emphasis follows the current workspace. */
.workspace:has(main .button.primary) .topbar .button.primary { color: var(--black); background: var(--white); border-color: var(--grey-50); font-weight: var(--weight-medium); }
.workspace:has(main .button.primary) .topbar .button.primary:hover { background: var(--grey-25); border-color: var(--grey); }
.button.secondary { background: var(--white); }
.button.secondary:hover { background: var(--grey-25); }
.button.ghost { background: var(--white); border-color: var(--line); color: var(--red); }
.button.ghost:hover { border-color: var(--red); }
.button.danger { border-color: var(--grey-50); color: var(--black); background: var(--white); }
.button.small-button { min-height: var(--control-height); padding: var(--space-2) var(--space-3); font-size: var(--text-small); }
.button:disabled, .icon-button:disabled { color: var(--grey); background: var(--grey-25); border-color: var(--grey-50); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: var(--control-compact); height: var(--control-compact); border: var(--border) solid var(--grey-50); border-radius: var(--radius-control); background: var(--white); color: var(--black); font-size: var(--text-title); }
.icon-button:hover { background: var(--grey-25); border-color: var(--grey); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.field > label, .field label, .field > span:first-child { color: var(--black); font-size: var(--text-small); font-weight: var(--weight-medium); }
.field-hint { font-size: var(--text-small); line-height: var(--leading); }
.span-2 { grid-column: span 2; }
input, select, textarea { color: var(--black); border: var(--border) solid var(--grey); border-radius: var(--radius-control); background: var(--white); width: 100%; min-width: 0; min-height: var(--control-height); padding: var(--space-2) var(--space-3); font-size: var(--text-body); line-height: var(--leading); transition: border-color var(--transition); }
input { font-variant-numeric: tabular-nums; }
input::placeholder, textarea::placeholder { color: var(--grey); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--black); }
input[type="checkbox"], input[type="radio"] { width: var(--space-5); height: var(--space-5); min-height: 0; accent-color: var(--red); margin: 0; vertical-align: middle; }
textarea { resize: vertical; min-height: var(--textarea-height); }
select { appearance: auto; }
input:disabled, select:disabled, textarea:disabled { background: var(--grey-25); color: var(--grey); border-color: var(--grey-50); }
input.invalid, select.invalid, textarea.invalid, input[aria-invalid="true"] { border-color: var(--error); background: var(--white); border-width: var(--focus); }
.validation-message, .field-error { color: var(--error); font-size: var(--text-small); font-weight: var(--weight-medium); margin-top: var(--space-1); }
.field-error::before, .validation-message::before { content: "! "; font-weight: var(--weight-bold); }
.input-unit { position: relative; display: flex; align-items: center; }
.input-unit input { padding-right: var(--unit-clearance); }
.input-unit > span { position: absolute; right: var(--space-3); font-size: var(--text-small); color: var(--grey); pointer-events: none; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.stat-card { padding: var(--space-5); background: var(--white); border: var(--border) solid var(--line); border-radius: var(--radius-card); }
.stat-label { font-size: var(--text-small); color: var(--muted); margin-bottom: var(--space-2); }
.stat-value { display: inline-block; font-size: var(--text-section); line-height: var(--leading-heading); color: var(--ink); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.stat-unit { font-size: var(--text-small); color: var(--muted); margin-left: var(--space-1); font-weight: var(--weight-regular); }
.demo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.demo-card { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: var(--space-3); padding: var(--space-5); background: var(--white); border: var(--border) solid var(--line); border-radius: var(--radius-card); color: var(--text); }
button.demo-card:hover { border-color: var(--grey); }
.demo-icon { width: var(--space-10); height: var(--space-10); color: var(--red); display: flex; align-items: center; justify-content: flex-start; font-size: var(--text-display); margin-bottom: var(--space-1); }
.demo-icon svg { width: var(--space-10); height: var(--space-10); stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.demo-title { color: var(--heading); font-size: var(--text-title); font-weight: var(--weight-bold); }
.demo-meta { color: var(--muted); font-size: var(--text-small); }
.demo-card p { font-size: var(--text-small); color: var(--muted); }
.demo-card .button { margin-top: auto; }
.step-list { display: grid; gap: var(--space-6); }
.step { display: flex; gap: var(--space-4); align-items: flex-start; }
.step > div { flex: 1; }
.step .button { flex-shrink: 0; }
.step-number { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: var(--space-8); height: var(--space-8); border: var(--border) solid var(--grey-50); background: var(--white); border-radius: var(--radius-round); color: var(--black); font-size: var(--text-small); font-weight: var(--weight-medium); }
.step p { color: var(--muted); font-size: var(--text-small); }
.step h3 { margin-bottom: var(--space-1); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table, .layer-table, .compare-table { border-collapse: collapse; width: 100%; font-size: var(--text-small); text-align: left; font-variant-numeric: tabular-nums; }
.data-table th, .layer-table th, .compare-table th { background: var(--surface-band); color: var(--black); font-size: var(--text-small); font-weight: var(--weight-bold); padding: var(--space-4) var(--space-3); text-align: left; white-space: nowrap; border-bottom: var(--border) solid var(--line); }
.data-table td, .layer-table td, .compare-table td { padding: var(--space-4) var(--space-3); border-bottom: var(--border) solid var(--line); vertical-align: middle; }
.data-table tr:last-child td, .layer-table tr:last-child td, .compare-table tr:last-child td { border-bottom: 0; }
.data-table tr.row-active td { box-shadow: inset 0 calc(-1 * var(--focus)) var(--grey-25); }
.data-table tr.row-active td:first-child { box-shadow: inset var(--indicator) 0 var(--red); }
.data-table input, .data-table select, .layer-table input, .layer-table select { font-size: var(--text-small); padding: var(--space-2); min-width: var(--table-input-width); min-height: var(--control-height); }
.data-table td:first-child input { min-width: var(--brand-width-compact); }
.data-table .icon-button { flex-shrink: 0; }
.data-table .numeric { text-align: right; }
.data-table caption { text-align: left; padding: var(--space-4) var(--space-3) var(--space-2); color: var(--muted); font-size: var(--text-small); }
.card-body > .table-wrap { margin-top: var(--space-6); }
.subnav { display: flex; gap: var(--space-6); border-bottom: var(--border) solid var(--line); margin-bottom: var(--space-6); overflow-x: auto; }
.subnav button { border: 0; border-bottom: var(--focus) solid transparent; background: transparent; color: var(--grey); padding: var(--space-3) 0; font-size: var(--text-small); white-space: nowrap; min-height: var(--control-height); }
.subnav button.active { color: var(--black); border-bottom-color: var(--red); font-weight: var(--weight-bold); }
.subnav button:hover { color: var(--black); }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(var(--editor-side-width), .6fr); gap: var(--space-6); }
.construction-diagram { display: flex; height: var(--diagram-height); gap: var(--space-1); align-items: stretch; padding: var(--space-5) 0; margin-bottom: var(--space-3); }
.layer-swatch { display: flex; align-items: center; justify-content: center; min-width: var(--space-2); color: var(--black); background: var(--blue-25); border: var(--border) solid var(--grey); border-radius: var(--radius-small); overflow: hidden; font-size: var(--text-small); }
.layer-swatch:nth-child(3n+2) { background: var(--beige-25); }
.layer-swatch:nth-child(3n+3) { background: var(--grey-25); }
.metric { margin: var(--space-2) 0 var(--space-6); }
.metric-value { display: block; color: var(--ink); font-size: var(--text-display); font-weight: var(--weight-bold); line-height: var(--leading-heading); font-variant-numeric: tabular-nums; }
.metric-value small, .metric-value > span { font-size: var(--text-small); color: var(--muted); font-weight: var(--weight-regular); margin-left: var(--space-1); }
.metric-label { display: block; color: var(--muted); font-size: var(--text-small); margin-top: var(--space-2); }
.summary-divider { height: var(--border); background: var(--line); margin: var(--space-6) 0; }
.breakdown-row { display: flex; justify-content: space-between; gap: var(--space-3); margin: var(--space-4) 0 var(--space-1); font-size: var(--text-small); }
.breakdown-row strong { font-size: var(--text-small); font-weight: var(--weight-medium); color: var(--ink); white-space: nowrap; }
.breakdown-bar { height: var(--space-2); border-radius: var(--radius-small); background: var(--grey-25); overflow: hidden; }
.breakdown-bar span { display: block; height: 100%; background: var(--blue); border-radius: var(--radius-small); }
.empty-state { text-align: left; padding: var(--space-8) var(--space-6); }
.empty-state p { max-width: var(--empty-copy-width); margin: 0 0 var(--space-5); font-size: var(--text-small); color: var(--muted); }
.empty-mark { display: inline-flex; align-items: center; justify-content: flex-start; width: var(--space-10); height: var(--space-10); color: var(--red); font-size: var(--text-section); margin-bottom: var(--space-4); }
.issue-list { margin: 0; padding-left: var(--space-5); font-size: var(--text-small); color: var(--black); }
.issue-list li + li { margin-top: var(--space-3); }
.issue-link { background: none; border: 0; color: var(--black); font-size: inherit; padding: 0; text-align: left; text-decoration: underline; text-underline-offset: var(--space-1); }
.version-list { display: grid; gap: 0; margin: 0; font-size: var(--text-small); }
.version-list > div { display: flex; justify-content: space-between; gap: var(--space-5); border-bottom: var(--border) solid var(--line); padding: var(--space-3) 0; }
.version-list dt { color: var(--muted); }
.version-list dd { margin: 0; text-align: right; color: var(--ink); overflow-wrap: anywhere; }
.version-list strong { text-align: right; overflow-wrap: anywhere; }
.version-list > div:last-child { border-bottom: 0; }
.json-editor, .code-preview { font-family: var(--font); font-size: var(--text-small); line-height: 1.7; white-space: pre; tab-size: 2; }
.json-editor { display: block; width: 100%; min-height: var(--json-height); background: var(--white); padding: var(--space-5); }
.code-preview { color: var(--black); background: var(--white); border: var(--border) solid var(--line); border-radius: var(--radius-control); padding: var(--space-5); overflow: auto; max-height: var(--code-height); margin: 0; }
.reference-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.reference-card { background: var(--white); border: var(--border) solid var(--line); border-radius: var(--radius-card); padding: var(--space-5); }
.reference-number { font-size: var(--text-section); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; }
.reference-card p { margin-top: var(--space-2); color: var(--muted); font-size: var(--text-small); }
.compare-table th:first-child, .compare-table td:first-child { padding-left: var(--space-5); }
.progress-track { height: var(--space-2); background: var(--grey-25); border-radius: var(--radius-small); overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); border-radius: var(--radius-small); transition: width var(--transition); }
.toast { padding: var(--space-3) var(--space-4); background: var(--green-25); border: var(--border) solid var(--grey); border-radius: var(--radius-control); color: var(--black); font-size: var(--text-small); position: fixed; bottom: var(--space-5); left: 50%; transform: translateX(-50%); z-index: 90; box-shadow: var(--shadow); pointer-events: none; }
.toast::before { content: "✓ "; }
.page-footer { color: var(--muted); font-size: var(--text-small); padding: var(--space-6) 0 0; display: flex; gap: var(--space-4); justify-content: space-between; border-top: var(--border) solid var(--line); margin-top: var(--space-8); }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: var(--backdrop); padding: var(--space-6); }
.modal { width: min(var(--modal-width), 100%); max-height: 90dvh; background: var(--white); border-radius: var(--radius-card); box-shadow: var(--shadow); overflow: auto; }
.modal-header { padding: var(--space-6); border-bottom: var(--border) solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-5); }
.modal-header h2 { font-size: var(--text-section); margin-bottom: var(--space-1); }
.modal-header p { font-size: var(--text-small); color: var(--muted); }
.modal-body { padding: var(--space-6); }
.modal-actions { padding: var(--space-4) var(--space-6); border-top: var(--border) solid var(--line); display: flex; gap: var(--space-3); justify-content: flex-end; }
dialog.modal { border: var(--border) solid var(--line); padding: 0; width: min(var(--modal-width), calc(100% - var(--space-8))); }
dialog.modal::backdrop { background: var(--backdrop); }
.loading { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4); color: var(--muted); }
.loading h1 { font-size: var(--text-section); }
#blazor-error-ui { background: var(--white); color: var(--error); border-top: var(--focus) solid var(--error); bottom: 0; padding: var(--space-4) var(--space-6); position: fixed; width: 100%; z-index: 1000; display: none; font-size: var(--text-small); }
#blazor-error-ui::before { content: "! "; font-weight: var(--weight-bold); }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }
.skip-link { position: fixed; left: var(--space-3); top: var(--skip-link-offset); z-index: 1001; padding: var(--space-3) var(--space-4); background: var(--white); border: var(--focus) solid var(--black); }
.skip-link:focus { top: var(--space-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
details { margin-top: var(--space-5); font-size: var(--text-small); }
summary { cursor: pointer; color: var(--red); font-weight: var(--weight-medium); padding: var(--space-1) 0; }
details p { margin-top: var(--space-3); }
.example-list { display: grid; gap: var(--space-2); margin-top: var(--space-5); }
.example-option { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); text-align: left; padding: var(--space-4); border: var(--border) solid var(--line); border-radius: var(--radius-control); background: var(--white); color: var(--text); }
.example-option:hover { background: var(--grey-25); border-color: var(--grey); }
.example-option:hover .muted { color: var(--black); }
.example-option > span:first-child { display: grid; gap: var(--space-1); }
.cell-number .field > span:first-child { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.cell-number .input-unit input { padding-right: var(--space-2); text-align: right; }
.cell-number .field { position: relative; gap: 0; }
.cell-number .field-error { display: block; max-width: var(--error-width); margin-top: var(--space-1); font-size: var(--text-small); }
.envelope-table td { padding: var(--space-3); }
.envelope-table .cell-number { min-width: var(--table-number-width); }
.envelope-table .calculated-value { display: inline-block; padding-left: var(--space-2); font-weight: var(--weight-medium); }
.row-actions { display: flex; gap: var(--space-1); }
.catalog-picker { margin: var(--space-6) 0; padding: var(--space-5); border: var(--border) solid var(--line); background: var(--white); border-radius: var(--radius-control); }
.catalog-picker .form-grid { margin-bottom: var(--space-4); }
.layer-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); margin-top: var(--space-6); }
.layer-heading h3 { margin-bottom: 0; }
.layer-method-note { margin-top: var(--space-5); }
.live-strip { display: none; }
@media (min-width: 1600px) {
    :root { --summary-width: 290px; }
    .main-content { padding: var(--space-9) var(--space-10) var(--space-7); }
    .topbar, .session-strip { padding-left: var(--space-10); padding-right: var(--space-10); }
    .workbench { gap: var(--space-8); }
}
@media (max-width: 1400px) {
    .workbench { grid-template-columns: minmax(0,1fr); }
    .summary-panel { position: static; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); align-items: start; }
    .summary-panel > .notice { grid-column: 2; }
    .summary-panel > .card:first-child { grid-row: span 2; }
    .live-strip { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-6); position: sticky; top: 0; z-index: 30; padding: var(--space-3) var(--space-8); border-bottom: var(--border) solid var(--line); background: var(--white); font-size: var(--text-small); }
    .live-strip strong { font-variant-numeric: tabular-nums; font-size: var(--text-body); }
}
@media (max-width: 1200px) {
    :root { --sidebar-width: 210px; }
    .main-content { padding: var(--space-7) var(--space-6) var(--space-6); }
    .topbar, .session-strip { padding-left: var(--space-6); padding-right: var(--space-6); }
    .summary-panel .metric { display: inline-block; min-width: var(--summary-metric-width); margin-right: var(--space-8); vertical-align: top; }
    .demo-card { padding: var(--space-5) var(--space-4); }
    .demo-grid { gap: var(--space-3); }
}
@media (max-width: 1024px) {
    :root { --sidebar-width: 190px; }
    .sidebar { padding-left: var(--space-3); padding-right: var(--space-3); }
    .brand { padding-left: var(--space-2); }
    .nav-item { padding-left: var(--space-2); gap: var(--space-2); }
    .nav-index { width: var(--space-5); }
    .topbar { gap: var(--space-3); }
    .topbar-actions { gap: var(--space-2); }
    .topbar-actions .tag-muted { display: none; }
    .page-heading { flex-wrap: wrap; gap: var(--space-3); }
    .editor-grid { grid-template-columns: minmax(0,1fr); }
    .stats-grid { gap: var(--space-3); }
    .stat-card { padding: var(--space-4); }
    .reference-grid { gap: var(--space-3); }
    .reference-card { padding: var(--space-4); }
    .demo-title { font-size: var(--text-body); }
}
@media (max-width: 768px) {
    .app-shell { display: block; }
    .sidebar { position: relative; height: auto; padding: var(--space-4) var(--space-5) 0; border-right: 0; border-bottom: var(--border) solid var(--line); }
    .brand { flex-direction: row; align-items: center; padding: 0 0 var(--space-4); gap: var(--space-4); }
    .brand-logo { width: var(--brand-width-compact); }
    .brand-subtitle { margin-top: 0; }
    .sidebar nav { display: flex; gap: var(--space-1); overflow-x: auto; padding-bottom: var(--space-2); scrollbar-width: thin; }
    .nav-item { width: auto; flex: 0 0 auto; min-height: var(--control-height); padding: var(--space-2) var(--space-3); gap: var(--space-1); }
    .nav-item.active { box-shadow: inset 0 calc(-1 * var(--indicator)) var(--red); }
    .nav-index, .sidebar-bottom, .topbar .tag { display: none; }
    .topbar { min-height: var(--topbar-height-compact); padding: var(--space-3) var(--space-5); }
    .session-strip { padding: var(--space-2) var(--space-5); }
    .main-content { padding: var(--space-6) var(--space-5); }
    .page-heading { margin-bottom: var(--space-5); }
    .stats-grid { gap: var(--space-3); }
    .stat-card { padding: var(--space-4); }
    .stat-unit { display: block; margin: var(--space-1) 0 0; }
    .form-grid { gap: var(--space-5); }
    .card-header, .card-body { padding: var(--space-5); }
    .card-header { flex-wrap: wrap; }
    .card-footer { padding: var(--space-4) var(--space-5); }
    .subnav { gap: var(--space-5); }
    .demo-card { padding: var(--space-4); }
    .demo-card .button { padding: var(--space-2); }
    .summary-panel { grid-template-columns: 1fr; }
    .summary-panel > .notice { grid-column: auto; }
    .step { flex-wrap: wrap; }
    .step .button { margin-left: var(--space-10); }
    .live-strip { padding: var(--space-3) var(--space-5); gap: var(--space-1) var(--space-5); }
    .live-strip > .small { flex-basis: 100%; }
    .toast { max-width: 92vw; width: max-content; }
    .modal-backdrop { padding: var(--space-4); }
    .modal-header, .modal-body { padding: var(--space-5); }
    .modal-actions { padding: var(--space-4) var(--space-5); }
}
@media (max-width: 480px) {
    .main-content { padding: var(--space-6) var(--space-4); }
    .topbar { padding-left: var(--space-4); padding-right: var(--space-4); flex-wrap: wrap; }
    .topbar .breadcrumb { max-width: 100%; }
    .session-strip { padding-left: var(--space-4); padding-right: var(--space-4); }
    .form-grid { grid-template-columns: minmax(0,1fr); }
    .span-2 { grid-column: auto; }
    .stats-grid { grid-template-columns: minmax(0,1fr); gap: var(--space-2); }
    .stat-card { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-4); }
    .stat-label { margin-bottom: 0; margin-right: auto; }
    .stat-unit { display: inline; }
    .demo-grid { grid-template-columns: minmax(0,1fr); }
    .demo-card { padding: var(--space-5); }
    .demo-title { font-size: var(--text-title); }
    .reference-grid { grid-template-columns: minmax(0,1fr); }
    .page-footer { flex-direction: column; gap: var(--space-2); }
    .summary-panel .metric { min-width: 0; margin-right: var(--space-5); }
    .version-list > div { gap: var(--space-3); }
    .modal { max-height: 95dvh; }
    .modal-header, .modal-body { padding: var(--space-5); }
    .modal-actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
    .sidebar, .topbar-actions, .session-strip, .heading-actions, .button, .icon-button { display: none !important; }
    .app-shell, .workbench { display: block; }
    .main-content { padding: 0; }
    body { background: var(--white); }
    .summary-panel { position: static; margin-top: var(--space-6); }
    .card { break-inside: avoid; box-shadow: var(--shadow); }
}
