@font-face { font-family: "SVN-Gilroy"; src: url("/assets/fonts/gilroy-400.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "SVN-Gilroy"; src: url("/assets/fonts/gilroy-500.otf") format("opentype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "SVN-Gilroy"; src: url("/assets/fonts/gilroy-600.otf") format("opentype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "SVN-Gilroy"; src: url("/assets/fonts/gilroy-700.otf") format("opentype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "SVN-Gilroy"; src: url("/assets/fonts/gilroy-800.otf") format("opentype"); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: "SVN-Gilroy"; src: url("/assets/fonts/gilroy-400-italic.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "SVN-Gilroy"; src: url("/assets/fonts/gilroy-500-italic.otf") format("opentype"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "SVN-Gilroy"; src: url("/assets/fonts/gilroy-600-italic.otf") format("opentype"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "SVN-Gilroy"; src: url("/assets/fonts/gilroy-800-italic.otf") format("opentype"); font-weight: 800; font-style: italic; font-display: swap; }
:root {
  font-family: "SVN-Gilroy", Arial, sans-serif;
  font-size: 16px;
  font-synthesis: none;
  color-scheme: light;
  color: #31333f;
  --primary: #194b92;
  accent-color: var(--primary);
  --primary-hover: #153f7b;
  --primary-active: #123564;
  --primary-soft: #e7eff8;
  --primary-tint: #f3f7fc;
  --bg: #fff;
  --secondary: #f0f2f6;
  --line: #d6d9df;
  --muted: #606571;
  --ink: #31333f;
  --positive: #276b39;
  --negative: #aa323b;
  --sidebar: 232px;
  --radius: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
}
* { box-sizing: border-box; }
::selection { color: var(--primary-active); background: var(--primary-soft); }
body { margin: 0; background: var(--bg); line-height: 1.5; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 32px; font-weight: 650; line-height: 1.25; letter-spacing: -.5px; margin-bottom: 12px; text-wrap: balance; }
h2 { font-size: 24px; font-weight: 650; line-height: 1.35; margin: 24px 0 16px; text-wrap: balance; }
h3 { font-size: 20px; font-weight: 600; line-height: 1.4; margin: 24px 0 12px; text-wrap: balance; }
h4 { font-size: 16px; font-weight: 600; }
p { line-height: 1.6; margin-bottom: 16px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; color: inherit; }
button, a, summary, select { -webkit-tap-highlight-color: transparent; }
button, a, input, select { transition: background-color .15s, border-color .15s, color .15s; }
button:disabled, input:disabled { cursor: not-allowed; opacity: .55; }
:where(button, a, summary, select, input, [tabindex]):focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
:where(input, button, select, summary, [tabindex]) { scroll-margin-block: 100px; }
[hidden] { display: none !important; }
.icon { width: 19px; height: 19px; display: inline-block; flex-shrink: 0; vertical-align: middle; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; background: white; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.skip-link:focus { top: 12px; }

/* Original Streamlit palette, with a quieter navigation hierarchy. */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 24px 16px; background: var(--secondary); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 20; overflow-y: auto; }
.brand { display: block; background: transparent; padding: 8px 12px; border-radius: 6px; margin-bottom: 28px; }
/* Blend white image backgrounds into the sidebar without changing the assets. */
.brand img { width: 100%; height: 72px; object-fit: contain; display: block; mix-blend-mode: darken; }
.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.nav-item, .practice-navigation summary, .subnav { color: var(--ink); padding: 11px 12px; border-radius: 6px; display: flex; align-items: center; gap: 10px; font-size: 15px; line-height: 1.45; min-height: 44px; }
.nav-item:hover, .practice-navigation summary:hover, .subnav:hover { background: #e6e8ed; text-decoration: none; }
.practice-navigation summary { list-style: none; cursor: pointer; font-weight: 600; }
.practice-navigation summary::-webkit-details-marker { display: none; }
.practice-navigation summary > span { white-space: nowrap; }
.practice-navigation summary:after { content: "⌄"; margin-left: auto; transform: rotate(-90deg); color: var(--muted); }
.practice-navigation[open] summary:after { transform: none; }
.practice-links { margin: 4px 0 12px 20px; padding-left: 10px; border-left: 1px solid #cdd1da; }
.subnav { margin: 4px 0; padding: 10px 12px; font-size: 14px; }
.subnav.selected, .nav-item.active { color: var(--primary); background: var(--primary-soft); font-weight: 600;  }
.sidebar-contact { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding: 24px 12px 0; color: var(--muted); font-size: 14px; min-height: 44px; }
.sidebar-contact .icon { width: 16px; }
.main-shell { margin-left: var(--sidebar); min-height: 100dvh; display: flex; flex-direction: column; }
.main-shell > main { width: 100%; max-width: 1440px; margin: 0 auto; padding: 32px 40px 48px; flex: 1; min-width: 0; }
.page-footer { padding: 16px 40px 24px; font-size: 12px; color: var(--muted); width: 100%; max-width: 1440px; margin: 0 auto; }

/* Shared page heading and model provenance. */
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.page-heading > div { min-width: 0; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 1px; margin: 0 0 8px; } /* taste-skill-ignore: existing section breadcrumb, no decorative badge. */
.page-heading h1 { margin-bottom: 8px; }
.page-intro { color: var(--muted); font-size: 15px; margin: 0; max-width: 70ch; }
.workflow { display: flex; list-style: none; padding: 0; margin: 0; gap: 20px; flex-shrink: 0; }
.workflow li { color: var(--muted); display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.workflow li + li:before { content: ""; width: 20px; border-top: 1px solid var(--line); margin-right: 4px; }
.workflow span { display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 50%; font-variant-numeric: tabular-nums; }
.workflow .current { color: var(--primary); font-weight: 600; }
.workflow .current span { background: var(--primary); border-color: var(--primary); color: white; }
.dataset-meta { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding: 14px 0; border-top: 1px solid #e9ebef; border-bottom: 1px solid #e9ebef; color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.dataset-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.dataset-meta strong { color: var(--ink); font-weight: 600; }
.dataset-meta .icon { width: 16px; height: 16px; color: var(--primary); }

.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: white; color: var(--ink); line-height: 1.35; text-decoration: none; font-size: 15px; font-weight: 500; }
.button:hover:not(:disabled) { color: var(--primary); border-color: var(--primary); background: var(--primary-tint); text-decoration: none; }
.button:active:not(:disabled) { background: var(--primary-soft); }
.button .icon { width: 17px; height: 17px; }

/* Parameters: meaningful groups, one primary action, persistent feedback. */
.policy-panel { border: 1px solid var(--line); border-radius: 10px; background: white; margin-bottom: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px 0; }
.panel-heading h2 { margin: 0 0 4px; font-size: 20px; }
.panel-heading p { margin: 0; font-size: 14px; color: var(--muted); }
.input-options { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.input-options .button { font-size: 14px; }
.clear-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; min-height: 44px; }
.clear-toggle input { appearance: none; width: 32px; height: 18px; background: #858a95; border-radius: 16px; margin: 0; position: relative; flex-shrink: 0; cursor: pointer; }
.clear-toggle input:after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: white; transition: transform .15s; }
.clear-toggle input:checked { background: var(--primary); }
.clear-toggle input:checked:after { transform: translateX(14px); }
.policy-tabs, .detail-tabs { display: flex; align-items: stretch; gap: 24px; border-bottom: 1px solid var(--line); overflow-x: auto; padding: 0 2px; }
.policy-tabs { margin: 16px 24px 0; }
.policy-tabs button, .detail-tabs button { position: relative; border: 0; border-radius: 0; background: none; padding: 12px 2px; min-height: 46px; font-size: 15px; line-height: 1.4; color: var(--muted); white-space: nowrap; }
.policy-tabs button:hover, .detail-tabs button:hover { color: var(--primary); }
.policy-tabs button.active, .detail-tabs button.active { color: var(--primary); font-weight: 600; }
.policy-tabs button.active:after, .detail-tabs button.active:after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--primary); }
.policy-tabs button:focus-visible, .detail-tabs button:focus-visible { outline-offset: -3px; border-radius: 3px; }
.policy-tab-content { padding: 20px 24px 8px; }
.field-hint { background: var(--secondary); padding: 10px 12px; border-radius: 6px; font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.field-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.field-columns > div { min-width: 0; }
.field-group-title { font-size: 15px; font-weight: 600; line-height: 1.5; padding-bottom: 10px; border-bottom: 1px solid #e9ebef; margin: 0 0 16px; }
.tax-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 15px; line-height: 1.5; min-width: 0; }
.field > label { display: block; font-weight: 400; }
.input-wrap { display: flex; align-items: center; width: 100%; min-width: 0; border-radius: var(--radius); background: var(--secondary); border: 1px solid transparent; }
.input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); } /* taste-skill-ignore: focus ring. */
.input-wrap input { width: 0; min-width: 0; flex: 1; height: 42px; padding: 8px 12px; border: 0; border-radius: var(--radius); color: var(--ink); background: transparent; appearance: textfield; -moz-appearance: textfield; font-size: 16px; font-variant-numeric: tabular-nums; }
.input-wrap input:focus-visible { outline: none; }
.input-wrap input::-webkit-inner-spin-button { appearance: none; }
.input-unit { white-space: nowrap; font-size: 12px; color: var(--muted); margin-right: 8px; }
.step-button { flex-shrink: 0; width: 40px; height: 42px; background: transparent; border: 0; border-left: 1px solid #e1e4eb; font-size: 20px; color: #555b69; line-height: 1; }
.step-button:last-child { border-radius: 0 7px 7px 0; }
.step-button:hover:not(:disabled) { color: var(--primary); background: var(--primary-soft); }
.step-button:focus-visible { outline-offset: -4px; }
.input-wrap.invalid { border-color: var(--negative); background: #fff4f4; }
.field-error { color: var(--negative); font-size: 13px; margin: 0; line-height: 1.5; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.policy-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 10px 10px; }
.changed-count { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.action-hint { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.run-button { width: auto; min-width: 188px; min-height: 44px; background: var(--primary); border-color: var(--primary); color: white; }
.run-button:hover:not(:disabled) { color: white; background: var(--primary-hover); border-color: var(--primary-hover); }
.run-button:active:not(:disabled) { background: var(--primary-active); }

/* Full-width summary keeps key numbers readable beside the supporting assistant. */
.result-heading { display: flex; align-items: center; gap: 20px; margin: 0 0 20px; }
.results-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; }
.results-toolbar strong { font-size: 15px; font-weight: 600; }
.scenario-badge { border-radius: 4px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 600; padding: 4px 7px; white-space: nowrap; }
#run-status { margin-left: auto; font-size: 13px; color: var(--muted); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0 0 28px; }
.kpi-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; background: white; }
.kpi-label { min-height: 40px; margin-bottom: 10px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.kpi-value { font-size: 34px; font-weight: 600; line-height: 1.2; letter-spacing: -.5px; font-variant-numeric: tabular-nums; color: var(--ink); }
.kpi-bottom { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 12px; }
.kpi-delta { display: inline-block; font-size: 12px; line-height: 1.4; padding: 3px 6px; border-radius: 4px; background: var(--secondary); color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi-delta.up { background: #e9f4eb; color: var(--positive); }
.kpi-delta.down { background: #fceceb; color: var(--negative); }
.kpi-bottom small { font-size: 12px; line-height: 1.5; color: var(--muted); }
.results-layout { display: grid; grid-template-columns: minmax(0, 1fr) 264px; gap: 24px; align-items: start; }
.results-main { min-width: 0; container: results / inline-size; }
.results-main .detail-tabs { margin: 0 0 20px; gap: 20px; }
.results-main section { min-width: 0; }
.results-main section > h2:first-child { margin-top: 0; }
.metric-explanation { padding: 12px 14px; border-left: 3px solid var(--primary); border-radius: 0 6px 6px 0; background: var(--secondary); color: var(--muted); font-size: 14px; margin: 0 0 24px; }
.geography-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 18px; }
.geography-header h3 { margin: 0; flex: 1; min-width: 200px; }
.select-label { display: flex; flex-direction: column; gap: 6px; max-width: 100%; font-size: 13px; color: var(--muted); line-height: 1.5; }
select { min-height: 42px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 32px 8px 12px; max-width: 100%; background: var(--secondary); color: var(--ink); font-size: 14px; cursor: pointer; }
.select-label select { min-width: min(200px, 100%); }
.geography-layout { display: grid; grid-template-columns: 1fr; gap: 24px; margin-bottom: 24px; align-items: start; }
.map-wrap, .region-table { min-width: 0; }
.map-wrap { border: 1px solid #e1e4eb; border-radius: var(--radius); padding: 8px 8px 0; }
.map-wrap > svg { display: block; width: 100%; height: 340px; background: #f7f9fc; border-radius: 4px; }
.map-wrap path { stroke: white; stroke-width: .6; cursor: crosshair; transition: opacity .12s; }
.map-wrap path:hover, .map-wrap path:focus { opacity: .7; stroke: var(--primary); stroke-width: 1.4; outline: none; }
.map-tooltip { min-height: 40px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 6px; }
.map-wrap .table-note { text-align: center; font-size: 12px; margin-bottom: 12px; }
.table-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.table-controls select { font-size: 14px; }
.table-scroll { overflow: auto; max-height: 460px; border: 1px solid var(--line); border-radius: var(--radius); margin: 16px 0 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 600; color: #454956; background: var(--secondary); border-bottom: 1px solid var(--line); padding: 11px 12px; }
td { padding: 11px 12px; border-bottom: 1px solid #e9ebef; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #f8f9fc; }
td:not(:first-child), th:not(:first-child) { text-align: right; white-space: nowrap; }
td:first-child, th:first-child { min-width: 100px; }
.change-pos { color: var(--positive); }
.change-neg { color: var(--negative); }
.table-note, .source-caption { font-size: 13px; color: var(--muted); line-height: 1.6; }
.source-caption { margin: 12px 0 20px; }
.chart-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; font-size: 13px; color: var(--muted); margin: 14px 0 16px; }
.chart-legend > span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; }
.legend-baseline { background: #bdd7ee; }
.legend-reform { background: var(--primary); }
.distribution-chart { height: 230px; margin: 8px 0 20px; }
.distribution-chart svg, .catalog-chart svg { width: 100%; height: 100%; }
.scenario-insight { font-size: 14px; color: var(--ink); line-height: 1.7; background: var(--secondary); padding: 16px; border-radius: var(--radius); margin: 20px 0; }
.muted { font-size: 14px; color: var(--muted); margin: 12px 0 20px; }
.method-note { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 24px; font-size: 14px; color: var(--muted); }
.method-note summary { cursor: pointer; color: var(--ink); padding: 6px 0; }
.method-note p { line-height: 1.7; margin-top: 12px; }
.chat-panel { min-width: 0; position: sticky; top: 24px; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.chat-panel h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; margin: 0; }
.chat-panel h2 .icon { color: var(--primary); }
.chat-panel > .muted { margin: 8px 0 16px; }
.chat-status { font-size: 13px; line-height: 1.6; padding: 12px; border-radius: 6px; background: var(--secondary); color: var(--muted); margin-bottom: 16px; }
.chat-status.ready { background: #eef4fc; color: var(--primary); }
#chat-history { max-height: 480px; overflow: auto; }
#chat-history p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; padding: 12px; border-radius: 6px; background: var(--secondary); margin-bottom: 12px; }
#chat-history p.user-message { color: var(--primary); background: #edf2fc; }
#chat-form { display: flex; gap: 10px; flex-direction: column; }
#chat-question { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--secondary); padding: 10px 12px; color: var(--ink); font-size: 16px; }
#chat-form .button { align-self: flex-end; font-size: 14px; }
.chat-privacy { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 16px 0 0; }

/* The same hierarchy carries through the practice catalog and contact pages. */
.practice-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
.practice-list > section { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; align-items: flex-start; }
.practice-list h2 { margin: 0 0 12px; font-size: 22px; }
.practice-list p { color: var(--muted); font-size: 15px; flex: 1; }
.practice-list .button { margin-top: 8px; }
.dataset-panel { border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin-top: 28px; }
.dataset-panel h2 { margin-top: 0; font-size: 24px; }
.dataset-panel dl { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--secondary); padding: 16px; gap: 16px; border-radius: var(--radius); margin: 24px 0; font-size: 15px; }
.dataset-panel dt { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.dataset-panel dd { margin: 0; font-weight: 600; }
.catalog-chart { height: 250px; max-width: 900px; margin: 16px 0 24px; }
.contact-actions { margin-top: 24px; }
#app-error { padding: 14px 16px; border: 1px solid #ebc6ca; border-radius: var(--radius); background: #fff4f4; color: var(--negative); font-size: 15px; margin-bottom: 20px; }
.results-main[aria-busy="true"] { opacity: .6; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.noscript { position: fixed; bottom: 0; left: 0; right: 0; padding: 16px; background: #fff4d6; text-align: center; z-index: 99; }
@container results (min-width: 650px) { .geography-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (min-width: 1600px) { .main-shell > main { padding-top: 40px; } }
@media (max-width: 1250px) {
  :root { --sidebar: 212px; }
  .main-shell > main { padding-left: 28px; padding-right: 28px; }
  .page-footer { padding-left: 28px; padding-right: 28px; }
  .page-heading { align-items: flex-start; }
  .workflow { gap: 12px; }
  .workflow li + li:before { display: none; }
  .results-layout { grid-template-columns: minmax(0, 1fr) 244px; gap: 20px; }
  .panel-heading { align-items: flex-start; }
  .input-options { flex-direction: column-reverse; align-items: flex-end; gap: 4px; }
  .practice-navigation summary { padding: 10px 8px; gap: 8px; font-size: 14px; }
  .kpi-card { padding: 16px; }
  .kpi-value { font-size: 32px; }
  .tax-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tax-columns > div:first-child { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .tax-columns > div:first-child > h3 { grid-column: 1 / -1; }
  .practice-list { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  :root { --sidebar: 196px; }
  .sidebar { padding: 20px 12px; }
  .brand { padding: 6px 8px; margin-bottom: 20px; }
  .brand img { height: 64px; }
  .nav-item, .practice-navigation summary { font-size: 14px; padding: 10px 8px; gap: 8px; }
  .practice-links { margin-left: 15px; padding-left: 6px; }
  .subnav { font-size: 13px; padding: 10px; }
  .main-shell > main { padding: 28px 24px 40px; }
  .page-footer { padding-left: 24px; padding-right: 24px; }
  .page-heading { flex-wrap: wrap; gap: 16px; }
  .workflow { gap: 20px; }
  .results-layout { grid-template-columns: 1fr; }
  .chat-panel { position: static; max-width: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-label { min-height: auto; }
  .panel-heading { flex-wrap: wrap; gap: 12px; }
  .input-options { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
  .field-columns { gap: 24px; }
}
@media (max-width: 720px) {
  :root { --sidebar: 0px; }
  .sidebar { position: relative; inset: auto; width: 100%; padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .brand { width: 128px; padding: 4px 8px; margin: 0 0 12px; }
  .brand img { height: 54px; }
  .sidebar-contact { position: absolute; right: 16px; top: 24px; padding: 0; margin: 0; font-size: 13px; }
  .sidebar nav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; align-items: start; }
  .practice-navigation { grid-column: 1 / -1; }
  .practice-navigation summary { min-height: 44px; }
  .practice-links { display: flex; flex-wrap: wrap; margin: 2px 0 8px; padding: 0; border: 0; gap: 4px; }
  .subnav { font-size: 13px; padding: 8px 10px; margin: 0; min-height: 40px; }
  .nav-item, .practice-navigation summary { font-size: 14px; }
  .nav-item { min-height: 44px; }
  .main-shell { margin-left: 0; }
  .main-shell > main { padding: 24px 16px 32px; }
  .page-footer { padding: 16px; }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  h3 { font-size: 19px; }
  .page-intro { font-size: 15px; }
  .workflow { gap: 24px; }
  .dataset-meta { font-size: 12px; gap: 8px 16px; padding: 12px 0; }
  .dataset-meta > span:last-child { flex-basis: 100%; }
  .panel-heading { padding: 18px 16px 0; }
  .panel-heading p { font-size: 14px; }
  .clear-toggle { font-size: 13px; }
  .policy-tabs { margin: 12px 16px 0; gap: 24px; }
  .policy-tab-content { padding: 16px 16px 0; }
  .field-hint { font-size: 14px; }
  .field-columns, .tax-columns { grid-template-columns: 1fr; gap: 12px; }
  .tax-columns > div:first-child { display: block; grid-column: auto; }
  .field-group-title { margin-bottom: 16px; }
  .field { font-size: 15px; }
  .input-wrap input { height: 44px; }
  .step-button { width: 44px; height: 44px; }
  .policy-actions { padding: 16px; flex-wrap: wrap; }
  .run-button { width: 100%; }
  .result-heading { flex-wrap: wrap; gap: 16px; }
  .results-toolbar { flex-basis: 100%; }
  #run-status { flex-basis: 100%; margin-left: 0; }
  .kpi-grid { gap: 12px; margin-bottom: 24px; }
  .kpi-card { padding: 14px 12px; }
  .kpi-label { min-height: 40px; font-size: 13px; }
  .kpi-value { font-size: 29px; }
  .kpi-bottom small { font-size: 12px; }
  .detail-tabs { gap: 20px; }
  .geography-header { align-items: stretch; }
  .select-label { width: 100%; }
  select { min-height: 44px; font-size: 16px; }
  .map-wrap > svg { height: 330px; }
  .table-controls { align-items: stretch; flex-direction: column; }
  .table-controls select { width: 100%; }
  th, td { padding: 10px; }
  .distribution-chart { height: 190px; }
  .chat-panel { padding: 18px 16px; }
  .dataset-panel { padding: 18px 16px; }
  .dataset-panel dl { grid-template-columns: 1fr; gap: 14px; }
  .dataset-panel dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { transition: none !important; scroll-behavior: auto !important; } }

.chart-data { margin: 8px 0 20px; font-size: 14px; }
.chart-data > h4 { margin: 0; padding: 4px 0; color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.4; }
.chart-data > .table-scroll { margin-top: 8px; margin-bottom: 0; }
.chart-data caption { text-align: left; padding: 12px; color: var(--muted); font-size: 13px; }
.chart-data tbody th { position: static; background: white; font-weight: 400; color: var(--ink); border-bottom: 1px solid #e9ebef; }
.chart-data tr:last-child th { border-bottom: 0; }

/* Analytical figures: exact values stay readable independently of plot size. */
:root { --chart-before: #bdd7ee; --chart-after: var(--primary); --chart-grid: #e2e7ef; }
.viz-card { border: 1px solid var(--line); border-radius: 10px; background: white; min-width: 0; }
.viz-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.viz-header h3 { margin: 0; font-size: 20px; line-height: 1.4; }
.viz-header p:not(.viz-eyebrow) { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.viz-eyebrow { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 1px; margin: 0 0 6px; }
.geographic-viz { margin-top: 24px; }
.geographic-viz .geography-header { margin: 0 0 18px; align-items: center; }
.geography-layout { gap: 20px; align-items: start; margin-bottom: 28px; }
@container results (min-width: 650px) { .geography-layout { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); } }
.map-card { overflow: visible; }
.map-card-header { padding: 16px 18px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.map-card-header > span:first-child { font-size: 10px; font-weight: 600; letter-spacing: .7px; color: var(--muted); }
.map-count { background: var(--secondary); border-radius: 4px; color: var(--muted); padding: 3px 7px; font-size: 11px; white-space: nowrap; }
.map-canvas { position: relative; margin: 0 10px; background: #f7f9fc; border-radius: 6px; }
.map-canvas svg { display: block; width: 100%; height: 340px; }
/* Province focus uses the geographic stroke below instead of a rectangular SVG outline. */
.map-canvas path { stroke: white; stroke-width: .65; cursor: pointer; transition: opacity .12s; outline: none; }
.map-canvas path.selected, .map-canvas path:focus-visible { stroke: var(--primary); stroke-width: 1.8; paint-order: stroke fill; opacity: 1; outline: none; }
/* The tooltip previews a province without changing the clicked selection. */
.province-tooltip { position: absolute; z-index: 5; top: 12px; right: 12px; width: 208px; max-width: calc(100vw - 24px); padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-top: 2px solid var(--primary); border-radius: 6px; box-shadow: 0 4px 14px rgb(35 48 72 / 12%); pointer-events: none; line-height: 1.4; } /* taste-skill-ignore: floating tooltip. */
.province-tooltip-name { display: block; color: var(--ink); font-size: 15px; font-weight: 650; margin-bottom: 5px; }
.province-tooltip-metric { display: block; color: var(--muted); font-size: 12px; }
.province-tooltip-value { display: flex; align-items: baseline; gap: 8px; color: var(--primary); font-size: 22px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; margin: 2px 0; }
.province-tooltip-value small { font-size: 10px; font-weight: 400; color: var(--muted); }
.province-tooltip-unit { display: block; font-size: 11px; color: var(--muted); }
.province-tooltip-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.province-tooltip-comparison span, .province-tooltip-comparison strong { display: block; }
.province-tooltip-comparison span { color: var(--muted); margin-bottom: 3px; }
.province-tooltip-comparison strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.sea-label { fill: #65778d; font-size: 9px; letter-spacing: 1px; }
.map-scale { padding: 14px 20px 16px; }
.map-scale-caption, .map-scale-ticks { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.map-scale-caption { margin-bottom: 8px; }
.map-scale-gradient { height: 7px; border-radius: 3px; background: linear-gradient(90deg, #e0ebf8, var(--primary)); } /* taste-skill-ignore: continuous choropleth data legend, not decorative surface. */
.map-scale-ticks { margin-top: 6px; }
.map-detail { padding: 14px 18px 16px; border-top: 1px solid #e3e7ef; background: #fafbfc; }
.map-detail select { width: 100%; background: white; font-size: 14px; font-weight: 600; }
.map-detail-values { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 12px; margin-top: 14px; }
.map-detail-values > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.map-detail-values span { font-size: 12px; color: var(--muted); }
.map-detail-values strong { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.map-source { padding: 10px 12px; margin: 0; font-size: 11px; color: var(--muted); text-align: center; border-top: 1px solid #e3e7ef; }
.comparison-card { padding: 18px; }
.comparison-header { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.comparison-header h4 { font-size: 17px; }
.comparison-header p { color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.comparison-header select { width: 100%; }
.region-legend { margin: 16px 0 8px; font-size: 12px; }
.comparison-card .table-scroll { border: 0; border-radius: 0; margin-top: 8px; max-height: 420px; }
.comparison-card th { padding: 10px 6px; font-size: 12px; }
.comparison-card td { padding: 15px 6px; font-size: 13px; }
.comparison-card td:first-child, .comparison-card th:first-child { min-width: 76px; }
.region-name { font-weight: 600; display: block; }
.region-mini { display: flex; flex-direction: column; gap: 3px; width: 64px; margin-top: 7px; }
.region-mini i { display: block; height: 4px; border-radius: 2px; background: var(--chart-before); }
.region-mini i:last-child { background: var(--chart-after); }
.comparison-card .table-note { font-size: 12px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #e3e7ef; }
.income-viz { margin-top: 24px; padding: 22px; }
.chart-switch { display: inline-flex; background: var(--secondary); border: 1px solid #e2e5eb; border-radius: 7px; padding: 3px; flex-shrink: 0; }
.chart-switch button { background: transparent; border: 1px solid transparent; border-radius: 5px; font-size: 12px; font-weight: 500; min-height: 34px; padding: 6px 12px; color: var(--muted); }
.chart-switch button.active { border-color: var(--line); background: white; color: var(--primary); font-weight: 600; }
.plot-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: 24px 0 4px; font-size: 12px; color: var(--muted); }
.plot-meta .chart-legend { margin: 0; font-size: 12px; gap: 16px; }
.chart-legend i, .series-label i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.legend-baseline { background: var(--chart-before); border: 1px solid #92b5d5; }
.legend-reform { background: var(--chart-after); }
.income-viz .distribution-chart { position: relative; height: 284px; margin: 0 0 16px; }
.plot-grid, .chart-columns { position: absolute; inset: 28px 8px 40px 44px; }
.plot-grid { pointer-events: none; }
.plot-tick { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--chart-grid); }
.plot-tick.zero { border-top: 1px solid #c6cedb; }
.plot-tick > span { position: absolute; right: calc(100% + 10px); top: 0; transform: translateY(-50%); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-columns { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.bar-group { position: relative; background: transparent; border: 0; border-radius: 6px 6px 0 0; padding: 0; min-width: 0; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .bar-group:hover { background: #f4f6fa; } }
.bar-group:focus-visible { outline-offset: 2px; }
.bar-plot { position: absolute; inset: 0 6px; }
.bar { position: absolute; bottom: 0; width: 34%; max-width: 28px; border-radius: 4px 4px 0 0; }
.baseline-bar { left: 12%; background: var(--chart-before); border: 1px solid #9cbedb; border-bottom: 0; }
.reform-bar { right: 12%; background: var(--chart-after); }
.bar-value { position: absolute; left: 50%; transform: translate(-50%, -7px); font-size: 11px; font-weight: 600; color: var(--chart-after); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-label { position: absolute; top: calc(100% + 12px); left: -3px; right: -3px; font-size: 12px; text-align: center; white-space: nowrap; }
.bar-group.selected .bar-label { color: var(--primary); font-weight: 600; }
.delta-bar { position: absolute; left: 25%; width: 50%; max-width: 40px; border-radius: 4px 4px 0 0; background: var(--chart-after); }
.delta-bar.negative { background: #9ebbd8; border: 1px solid #678cb2; border-radius: 0 0 4px 4px; }
.delta-value { transform: translate(-50%, -110%); }
.delta-value.below { transform: translate(-50%, 4px); }
.chart-readout { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr; gap: 12px; padding: 16px; border: 1px solid #e1e6ef; border-radius: 7px; background: #f7f9fc; }
.chart-readout > div { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.chart-readout span { font-size: 12px; color: var(--muted); }
.chart-readout strong { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-readout .readout-category strong { font-size: 15px; }
.series-label { display: flex; align-items: center; gap: 6px; }
.readout-delta { color: var(--chart-after); }
.chart-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 11px; }
.income-viz .chart-data { padding-top: 12px; border-top: 1px solid #e5e9ef; margin: 16px 0 0; }
.chart-empty { color: var(--muted); font-size: 13px; padding: 8px 12px; background: var(--secondary); border-radius: 6px; margin-bottom: 16px; }
.catalog-chart { height: auto; max-width: none; }
@media (max-width: 720px) {
  .income-viz { padding: 16px 12px; }
  .viz-header h3 { font-size: 18px; }
  .chart-switch { width: 100%; }
  .chart-switch button { flex: 1; min-height: 40px; }
  .income-viz .distribution-chart { height: 264px; }
  .bar-plot { inset-inline: 1px; }
  .bar-value, .bar-label { font-size: 11px; }
  .chart-readout { grid-template-columns: 1fr 1fr; padding: 12px; gap: 16px 12px; }
  .chart-readout strong { font-size: 16px; }
  .chart-footer > span:last-child { display: none; }
  .map-canvas svg { height: 340px; }
  .map-detail-values strong { font-size: 15px; }
  .comparison-card { padding: 16px 12px; }
  .geographic-viz .select-label { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .map-canvas path { transition: none; } }
@container results (max-width: 600px) {
  .chart-readout { grid-template-columns: 1fr 1fr; }
  .chart-readout strong { overflow-wrap: anywhere; }
  .income-viz .chart-switch { width: 100%; }
  .income-viz .chart-switch button { flex: 1; }
}

/* Consistent analytical cards for the remaining result tabs. */
.detail-heading { margin: 2px 0 24px; }
.detail-heading h2 { margin: 0 0 8px; font-size: 25px; }
.detail-heading > p:last-child { color: var(--muted); font-size: 14px; margin: 0; }
.detail-card { padding: 22px; margin-bottom: 20px; }
.pair-legend { font-size: 12px; margin: 20px 0 12px; }
.pair-axis { display: flex; justify-content: space-between; padding-right: 90px; margin: 16px 0 6px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.pair-list { max-height: 440px; overflow-y: auto; padding: 3px; margin: 0 -3px; }
.pair-row { display: block; width: 100%; padding: 14px 0 16px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid #e5e9ef; border-radius: 0; }
.pair-row:last-child { border-bottom: 0; }
@media (hover: hover) and (pointer: fine) { .pair-row:hover { background: #f7f9fc; } }
.pair-row:focus-visible { outline-offset: -2px; }
.pair-row-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.pair-row-heading strong { font-size: 14px; font-weight: 600; }
.pair-row-heading > span { color: var(--chart-after); font-size: 12px; font-variant-numeric: tabular-nums; }
.pair-series { display: flex; align-items: center; gap: 16px; margin: 6px 0; }
.pair-rail { position: relative; height: 10px; background: #f0f3f8; flex: 1; border-radius: 3px; min-width: 0; }
.pair-fill { position: absolute; top: 0; height: 100%; border-radius: 3px; }
.pair-fill.before { background: var(--chart-before); border: 1px solid #85a8c7; }
.pair-fill.after { background: var(--chart-after); }
.pair-zero { position: absolute; top: -2px; bottom: -2px; width: 1px; background: #aebbd0; }
.pair-number { width: 74px; flex-shrink: 0; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.pair-readout { margin-top: 16px; }
.pair-readout .readout-category strong { font-size: 14px; }
.paired-chart > .chart-footer { margin-bottom: 0; }
.detail-data { margin: 20px 0 0; padding-top: 12px; border-top: 1px solid #e3e7ef; }
.detail-table-card > h3 { margin: 0 0 6px; }
.detail-table-card > .muted { margin: 0; }
.detail-table-card .detail-data { margin-top: 12px; }
.detail-data .table-scroll { max-height: 500px; }
.gini-score, .poverty-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; padding: 24px 0 8px; }
.score-main, .score-reference { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.score-main > span:first-child, .score-reference > span { color: var(--muted); font-size: 13px; }
.score-main > strong { font-size: 38px; line-height: 1.15; letter-spacing: -.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.score-reference > strong { font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.score-reference > p { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.score-change { color: var(--chart-after); padding: 3px 7px; border-radius: 4px; background: #edf3fa; font-size: 12px; font-variant-numeric: tabular-nums; }
.gini-scale { grid-column: 1 / -1; margin-top: 8px; }
.gini-track { position: relative; height: 10px; background: #eaf0f7; border-radius: 5px; margin: 12px 9px 14px; }
.gini-before { position: absolute; top: -8px; height: 26px; width: 3px; background: #7e9fbd; transform: translateX(-50%); }
.gini-after { position: absolute; top: -3px; width: 16px; height: 16px; border-radius: 50%; background: var(--chart-after); border: 2px solid white; box-shadow: 0 0 0 1px var(--chart-after); transform: translateX(-50%); } /* taste-skill-ignore: chart mark outline or segment separator. */
.gini-scale-labels { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; font-size: 12px; color: var(--muted); }
.gini-scale-labels > span:last-child { text-align: right; }
.poverty-structure { margin: 24px 0; display: flex; flex-direction: column; gap: 16px; }
.poverty-stack-row > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.poverty-stack { display: flex; height: 34px; border-radius: 6px; overflow: hidden; }
.poverty-stack > span { display: flex; align-items: center; justify-content: center; flex-basis: 0; min-width: 0; font-size: 12px; font-weight: 600; overflow: hidden; box-shadow: inset -1px 0 #ffffffb3; white-space: nowrap; } /* taste-skill-ignore: chart mark outline or segment separator. */
.poverty-ipl { background: var(--primary); color: white; }
.poverty-lmic { background: #3b6b9f; color: white; }
.poverty-umic { background: #9ebcd8; color: #233c56; }
.poverty-above { background: #e0ebf5; color: #31333f; }
.poverty-categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.poverty-category { border: 1px solid #e1e6ee; border-radius: 7px; padding: 16px; min-width: 0; }
.poverty-category h4 { display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 10px; }
.poverty-category h4 i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; border: 1px solid #738ca8; }
.poverty-category > strong { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.poverty-category > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.analysis-note { font-size: 13px; line-height: 1.65; padding: 12px 14px; border-left: 3px solid var(--primary); background: var(--secondary); color: var(--muted); border-radius: 0 6px 6px 0; margin: 20px 0 0; }
@container results (max-width: 600px) {
  .detail-card { padding: 18px 16px; }
  .detail-card .select-label { width: 100%; }
}
@media (max-width: 720px) {
  .detail-heading h2 { font-size: 23px; }
  .detail-card { padding: 18px 14px; }
  .score-main > strong { font-size: 34px; }
  .score-reference > strong { font-size: 22px; }
  .gini-score, .poverty-summary { gap: 16px; }
  .poverty-category { padding: 12px; }
  .poverty-category > strong { font-size: 23px; }
  .pair-series { gap: 12px; }
  .pair-number { width: 66px; font-size: 12px; }
  .pair-axis { padding-right: 78px; }
}
@container results (max-width: 600px) {
  .poverty-category h4 { min-height: 38px; }
}

/* Workspace and dataset catalog use the same analytical-card vocabulary. */
.catalog-heading { margin-bottom: 24px; }
.practice-start { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.practice-feature { padding: 28px; display: flex; flex-direction: column; }
.tool-card-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.tool-icon { display: inline-grid; place-items: center; width: 46px; height: 46px; flex-shrink: 0; border: 1px solid #e0e5ef; border-radius: 9px; background: var(--secondary); color: var(--primary); }
.tool-icon .icon { width: 23px; height: 23px; }
.tool-status { display: inline-flex; align-items: center; gap: 6px; border-radius: 4px; padding: 4px 8px; background: var(--secondary); color: var(--muted); font-size: 12px; white-space: nowrap; }
.tool-status.live { background: #edf2fa; color: var(--primary); }
.tool-status i { display: inline-block; height: 5px; width: 5px; border-radius: 50%; background: currentColor; }
.practice-feature h2 { font-size: 28px; margin: 0 0 12px; line-height: 1.25; }
.tool-description { color: var(--muted); font-size: 16px; max-width: 58ch; margin-bottom: 18px; }
.topic-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.topic-tags > span { font-size: 12px; padding: 4px 9px; background: #f7f9fc; color: var(--muted); border: 1px solid #e3e7ef; border-radius: 4px; }
.tool-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: auto; padding-top: 24px; }
.tool-card-footer p { color: var(--ink); margin: 0; font-size: 14px; }
.tool-card-footer p > span { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.button.primary-link { background: var(--primary); color: white; border-color: var(--primary); }
.button.primary-link:hover { background: var(--primary-hover); color: white; border-color: var(--primary-hover); }
.button.primary-link:active { background: var(--primary-active); }
.practice-guide { padding: 26px 24px; background: #fafbfc; }
.practice-guide h2 { font-size: 19px; margin: 0 0 24px; }
.practice-guide ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 24px; }
.practice-guide li { display: flex; gap: 12px; }
.practice-guide li > span { display: inline-grid; place-items: center; height: 26px; width: 26px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 50%; font-size: 12px; color: var(--primary); background: white; }
.practice-guide strong { font-size: 14px; font-weight: 600; }
.practice-guide li p { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 4px 0 0; }
.practice-more { margin-top: 32px; }
.section-heading { margin-bottom: 18px; }
.section-heading h2 { font-size: 21px; margin: 0 0 6px; }
.section-heading p { font-size: 14px; color: var(--muted); margin: 0; }
.practice-secondary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.secondary-tool { padding: 24px; display: flex; flex-direction: column; align-items: stretch; }
.secondary-tool .tool-card-top { margin-bottom: 18px; }
.secondary-tool h3 { font-size: 21px; margin: 0 0 10px; }
.secondary-tool > p { color: var(--muted); font-size: 14px; flex: 1; margin: 0 0 20px; }
.tool-text-link { display: inline-flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--primary); font-size: 14px; font-weight: 500; min-height: 36px; }
.tool-text-link .icon { width: 17px; height: 17px; }
.workspace-help { display: flex; align-items: center; gap: 16px; padding: 22px 24px; margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: #fafbfc; }
.workspace-help > div { flex: 1; min-width: 0; }
.workspace-help h2 { margin: 0 0 4px; font-size: 17px; }
.workspace-help p { color: var(--muted); font-size: 14px; margin: 0; }
.workspace-help .button { flex-shrink: 0; }
.dataset-overview { padding: 26px; margin-bottom: 24px; }
.dataset-title-row { display: flex; align-items: center; gap: 14px; }
.dataset-title-row > div { flex: 1; min-width: 0; }
.dataset-title-row .viz-eyebrow { margin-bottom: 4px; }
.dataset-title-row h2 { font-size: 24px; margin: 0; line-height: 1.35; }
.dataset-description { max-width: 85ch; color: var(--muted); margin: 18px 0 22px; font-size: 15px; }
.dataset-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; background: var(--secondary); border-radius: 7px; margin: 0 0 22px; padding: 18px 20px; }
.dataset-facts dt { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.dataset-facts dd { margin: 0; font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.3; }
.dataset-facts dd small { font-size: 13px; font-weight: 400; color: var(--muted); }
.dataset-bottom { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; }
.dataset-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dataset-actions .button { font-size: 14px; }
.data-layout { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(235px, 1fr); gap: 24px; align-items: start; }
.data-preview { min-width: 0; container: preview / inline-size; }
.data-preview .catalog-chart { margin: 0; }
.data-preview .income-viz { margin-top: 0; }
.data-notes { padding: 24px 20px; }
.data-notes h2 { margin: 0 0 22px; font-size: 19px; }
.data-note { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 22px; }
.note-icon { color: var(--primary); display: inline-flex; flex-shrink: 0; margin-top: 2px; }
.note-icon .icon { width: 16px; height: 16px; }
.data-note h3 { font-size: 14px; font-weight: 600; margin: 0 0 5px; }
.data-note p { font-size: 13px; line-height: 1.65; color: var(--muted); margin: 0; }
.data-notes .tool-text-link { width: 100%; padding-top: 12px; border-top: 1px solid #e5e9ef; }
.data-access-note { display: flex; align-items: center; gap: 6px; padding-top: 14px; margin: 8px 0 0; font-size: 11px; color: var(--muted); }
.data-access-note .icon { width: 13px; height: 13px; }
.catalog-loading, .catalog-error { padding: 24px; color: var(--muted); font-size: 14px; }
.catalog-loading { min-height: 520px; display: grid; place-items: center; background: #fafbfc; }
.catalog-error p { margin-bottom: 16px; }
.chart-readout.preview-readout { grid-template-columns: 1fr 1fr; }

/* A constant, small inner gap keeps each comparison visibly paired. */
.bar-plot { --bar-width: clamp(6px, 26%, 28px); }
.bar { width: var(--bar-width); max-width: none; }
.baseline-bar { left: calc(50% - var(--bar-width) - 2px); }
.reform-bar { left: calc(50% + 2px); right: auto; }
.preview-bar { left: 50%; transform: translateX(-50%); background: var(--chart-after); }
@container preview (max-width: 520px) {
  .income-viz { padding: 18px 12px; }
  .plot-meta { margin-top: 18px; }
  .plot-meta .chart-legend { width: 100%; }
}
@media (max-width: 1100px) {
  .practice-start { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .practice-feature { padding: 24px; }
  .tool-card-footer { flex-wrap: wrap; gap: 16px; }
  .data-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 20px; }
  .dataset-title-row { flex-wrap: wrap; }
  .dataset-title-row .tool-status { margin-left: 60px; }
}
@media (max-width: 900px) {
  .practice-start, .data-layout { grid-template-columns: 1fr; }
  .practice-guide { padding: 24px; }
  .practice-guide ol { gap: 18px; }
  .dataset-facts { grid-template-columns: 1fr 1fr; gap: 20px; }
  .data-notes { padding: 24px; }
}
@media (max-width: 720px) {
  .practice-feature, .secondary-tool { padding: 22px 18px; }
  .practice-feature h2 { font-size: 26px; }
  .tool-description { font-size: 15px; }
  .tool-card-top { gap: 12px; }
  .tool-card-footer { align-items: stretch; flex-direction: column; }
  .tool-card-footer .button { width: 100%; }
  .practice-guide { padding: 22px 18px; }
  .practice-secondary { grid-template-columns: 1fr; gap: 16px; }
  .secondary-tool h3 { font-size: 20px; }
  .workspace-help { padding: 20px 18px; flex-wrap: wrap; align-items: flex-start; }
  .workspace-help > .tool-icon { display: none; }
  .workspace-help > .button { width: 100%; }
  .dataset-overview { padding: 22px 16px; }
  .dataset-title-row { gap: 12px; }
  .dataset-title-row > .tool-icon { width: 40px; height: 40px; }
  .dataset-title-row > div { min-width: 190px; }
  .dataset-title-row h2 { font-size: 21px; }
  .dataset-title-row .tool-status { margin-left: 52px; }
  .dataset-description { font-size: 14px; }
  .dataset-facts { padding: 16px; gap: 20px 12px; }
  .dataset-facts dd { font-size: 20px; }
  .dataset-actions { width: 100%; }
  .dataset-actions .button { width: 100%; min-height: 44px; }
  .data-note p { font-size: 14px; }
  .data-notes { padding: 22px 18px; }
}
.delta-bar { left: 50%; transform: translateX(-50%); }

/* Shared blue research pages: contact destinations remain contact-only. */
.contact-page { max-width: 1200px; }
.contact-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.contact-feature, .contact-guide { padding: 28px; }
.contact-feature > .tool-icon { margin-bottom: 22px; }
.contact-feature h2 { font-size: 26px; line-height: 1.35; margin: 0 0 12px; }
.contact-description { max-width: 60ch; font-size: 15px; color: var(--muted); margin: 0 0 22px; }
.contact-callout { border: 1px solid var(--line); background: var(--secondary); border-radius: 8px; padding: 20px; }
.contact-callout h3 { margin: 0 0 6px; font-size: 16px; }
.contact-callout p { font-size: 14px; color: var(--muted); margin: 0 0 16px; }
.contact-destination { display: block; font-size: 12px; color: var(--muted); margin-top: 10px; }
.contact-guide { background: #fafbfc; }
.contact-guide h2 { font-size: 20px; line-height: 1.4; margin: 0 0 22px; }
.contact-guide ol { list-style: none; margin: 0; padding: 0; }
.contact-guide li { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; border-top: 1px solid var(--line); }
.contact-guide li > span { font-size: 12px; color: var(--primary); font-variant-numeric: tabular-nums; padding-top: 2px; }
.contact-guide li p { font-size: 14px; margin: 0; }
.contact-guide-note { display: flex; gap: 8px; margin-top: 18px; color: var(--muted); }
.contact-guide-note .icon { width: 16px; margin-top: 3px; color: var(--primary); }
.contact-guide-note p { font-size: 13px; margin: 0; }
.contact-explore { margin-top: 32px; }
.contact-related { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.contact-related-link { display: flex; align-items: center; gap: 16px; padding: 20px; color: var(--ink); }
.contact-related-link:hover { text-decoration: none; background: var(--primary-tint); border-color: var(--primary); }
.contact-related-link > span:nth-child(2) { flex: 1; min-width: 0; }
.contact-related-link strong, .contact-related-link small { display: block; }
.contact-related-link strong { font-size: 15px; font-weight: 600; }
.contact-related-link small { font-size: 13px; color: var(--muted); margin-top: 4px; }
.contact-related-link > .icon { color: var(--primary); }

/* Readable methodology, keeping all model assumptions visible on expansion. */
.method-note { padding: 0; border: 1px solid var(--line); border-radius: 8px; background: white; overflow: hidden; }
.method-note > summary { display: flex; align-items: center; gap: 12px; list-style: none; padding: 18px; }
.method-note > summary::-webkit-details-marker { display: none; }
.method-summary-icon { display: inline-flex; color: var(--primary); }
.method-note summary strong { display: block; color: var(--ink); font-size: 14px; font-weight: 600; }
.method-note summary small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.method-chevron { margin-left: auto; display: inline-flex; color: var(--muted); }
.method-note[open] .method-chevron { transform: rotate(90deg); }
.method-content { padding: 0 18px 18px; }
.method-provenance { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px; background: var(--secondary); border-radius: 6px; }
.method-provenance span { font-size: 11px; color: var(--muted); }
.method-provenance strong { display: block; margin-top: 4px; color: var(--ink); font-size: 12px; font-weight: 600; }
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 20px; padding: 24px 0 18px; }
.method-grid article { display: flex; align-items: flex-start; gap: 10px; }
.method-index { color: var(--primary); font-size: 11px; padding-top: 2px; }
.method-grid h3 { font-size: 14px; margin: 0 0 7px; }
.method-note .method-grid p { font-size: 13px; margin: 0; line-height: 1.7; }
.method-note .method-footnote { display: flex; align-items: flex-start; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; margin: 0; }
.method-footnote .icon { width: 15px; margin-top: 2px; }

/* Assistant: explicit roles, suggested questions and a quiet unavailable state. */
.chat-panel { padding: 18px; }
.assistant-heading { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.assistant-heading .tool-icon { width: 36px; height: 36px; border-radius: 7px; }
.assistant-heading .viz-eyebrow { font-size: 9px; letter-spacing: .5px; margin-bottom: 3px; }
.assistant-heading h2 { font-size: 18px; line-height: 1.3; }
.chat-status { display: flex; align-items: flex-start; gap: 7px; padding: 10px; font-size: 12px; margin-bottom: 18px; }
.chat-status-dot { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: #858d9a; margin-top: 6px; }
.chat-status.ready .chat-status-dot { background: var(--primary); }
.chat-empty strong { display: block; font-size: 14px; font-weight: 600; }
.chat-empty p { margin: 6px 0 12px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.chat-prompts { display: grid; gap: 7px; margin-bottom: 18px; }
.chat-prompts button { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; border: 1px solid var(--line); border-radius: 6px; background: white; padding: 9px 10px; font-size: 12px; line-height: 1.5; min-height: 44px; }
.chat-prompts button:hover:not(:disabled) { color: var(--primary); background: var(--primary-tint); border-color: var(--primary); }
.chat-prompts button:disabled { opacity: 1; color: var(--muted); background: #fafbfc; }
#chat-history { max-height: 420px; }
.chat-message { border: 1px solid var(--line); border-radius: 7px; padding: 12px; margin: 0 0 12px; background: white; }
.chat-message.user-message { background: var(--primary-tint); border-color: #d5e2f2; }
.chat-message-role { display: block; color: var(--primary); font-size: 11px; font-weight: 600; margin-bottom: 5px; }
#chat-history .chat-message p { margin: 0; padding: 0; background: transparent; color: var(--ink); font-size: 13px; line-height: 1.7; border-radius: 0; }
.chat-busy { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.chat-busy > span { color: var(--primary); letter-spacing: 2px; }
#chat-form { gap: 8px; }
#chat-form label { font-size: 12px; font-weight: 600; }
#chat-question { width: 100%; min-height: 86px; max-height: 220px; resize: vertical; font: inherit; font-size: 13px; padding: 10px; border-radius: 6px; line-height: 1.6; }
#chat-question:disabled { opacity: 1; color: var(--muted); cursor: not-allowed; }
#chat-form .button { align-self: stretch; justify-content: space-between; }
.chat-privacy { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.chat-privacy summary { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 11px; }
.chat-privacy summary .icon { width: 13px; height: 13px; }
.chat-privacy p { margin: 8px 0 0; font-size: 11px; line-height: 1.65; }
@media (max-width: 1000px) { .contact-layout { grid-template-columns: minmax(0, 1.2fr) minmax(240px, 1fr); gap: 20px; } }
@media (max-width: 720px) {
  .contact-layout, .contact-related { grid-template-columns: 1fr; }
  .contact-feature, .contact-guide { padding: 20px; }
  .contact-feature h2 { font-size: 23px; }
  .contact-related-link { padding: 16px; }
  .method-grid { grid-template-columns: 1fr; gap: 20px; }
  .method-provenance { grid-template-columns: 1fr; }
  .method-provenance span { display: flex; justify-content: space-between; gap: 12px; }
  .method-provenance strong { margin: 0; }
}
@media (max-width: 1000px) { .contact-layout { grid-template-columns: 1fr; } }
.method-note > summary:focus-visible { outline-offset: -3px; }
@container results (max-width: 600px) {
  .method-grid { grid-template-columns: 1fr; }
  .method-provenance { grid-template-columns: 1fr; }
  .method-provenance span { display: flex; justify-content: space-between; gap: 12px; }
  .method-provenance strong { margin: 0; }
}

/* Compact research workspace: the existing Source Sans 3 and blue theme stay.
   At 1440px: 232px sidebar + 8px edge + 1200px sheet; minus its border
   and 48px padding, 1150px = 3 × 372.6667px + 2 × 16px. */
:root { --radius: 4px; --workspace-gap: 16px; }
body { background: var(--secondary); }
h1 { font-size: 26px; }
.sidebar { border-right: 0; padding-top: 20px; }
.brand { margin-bottom: 24px; }
.sidebar nav { gap: 4px; }
.nav-item, .subnav, .practice-navigation summary { border-radius: 4px; }
.main-shell > main { max-width: none; width: calc(100% - 8px); margin: 0 8px 8px 0; padding: 22px 24px 32px; border: 1px solid #e1e5eb; border-radius: 4px; background: white; }
.page-heading, .catalog-heading { margin-bottom: 16px; gap: 16px; }
.page-heading h1 { margin-bottom: 6px; }
.page-intro { font-size: 15px; }
.eyebrow, .viz-eyebrow { font-size: 11px; letter-spacing: 0; text-transform: none; } /* taste-skill-ignore: existing section breadcrumb, no decorative badge. */
.page-footer { padding: 12px 24px 18px; }
.viz-card, .policy-panel, .chat-panel, .dataset-facts, .contact-callout, .workspace-help { border-radius: 4px; }
.button, input, select, textarea { border-radius: 4px; }
.viz-header { padding: 16px 18px; }
.viz-header h3 { font-size: 18px; }
.field-columns { gap: 24px; }
.policy-panel { padding: 20px; }
.panel-heading h2 { font-size: 20px; }
.policy-tab-content { padding-top: 16px; }
.dataset-meta { margin-bottom: 16px; }
.kpi-grid { gap: 0; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.kpi-card { border: 0; border-right: 1px solid var(--line); border-radius: 0; padding: 14px 16px; }
.kpi-card:last-child { border-right: 0; }
.kpi-label { min-height: 0; margin-bottom: 8px; font-size: 13px; }
.kpi-value { font-size: 28px; }
.kpi-bottom { margin-top: 8px; gap: 4px; }
.results-layout { gap: 16px; }
.geographic-viz { margin-top: 16px; }
.geography-layout { gap: 16px; margin-bottom: 16px; }
.map-card-header { padding: 12px 16px; }
.map-canvas, .map-detail select { border-radius: 3px; }
.map-detail { padding: 12px 16px; }
.income-viz { margin-top: 16px; }
.dataset-overview { padding: 20px; margin-bottom: 16px; }
.dataset-description { margin: 12px 0 16px; }
.dataset-facts { padding: 14px 16px; margin-bottom: 16px; }
.data-layout, .contact-layout, .contact-related { gap: 16px; }
.data-notes { padding: 20px; }
.data-note { margin-bottom: 16px; }
.contact-feature, .contact-guide { padding: 20px; }
.contact-feature h2 { font-size: 22px; }
.contact-explore { margin-top: 24px; }
.contact-related-link { padding: 16px; }
.tool-icon { width: 28px; height: 28px; border: 0; background: transparent; border-radius: 0; }
.tool-icon .icon { width: 20px; height: 20px; }
.workspace-help { padding: 16px 20px; margin-top: 16px; }
/* Three peer tools use every column. The steps below carry no duplicate cards. */
.practice-tools { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; }
.lab-tool { padding: 20px; display: flex; flex-direction: column; }
.lab-tool header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 16px; }
.lab-tool header > .icon { color: var(--primary); width: 22px; height: 22px; }
.lab-tool h2 { font-size: 21px; margin: 0 0 10px; }
.lab-tool > p { color: var(--muted); font-size: 14px; margin-bottom: 16px; flex: 1; }
.lab-tool dl { margin: 0 0 20px; font-size: 13px; }
.lab-tool dl > div { display: flex; flex-direction: column; gap: 3px; padding: 9px 0; border-top: 1px solid #e9ecf1; }
.lab-tool dt { color: var(--muted); }
.lab-tool dd { margin: 0; }
.lab-tool .button { font-size: 14px; justify-content: space-between; }
.lab-workflow { margin-top: 24px; }
.lab-workflow h2 { font-size: 18px; margin: 0 0 14px; }
.lab-workflow ol { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; list-style-position: inside; padding: 0; margin: 0; }
.lab-workflow li { font-size: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.lab-workflow li::marker { color: var(--muted); }
.lab-workflow p { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
/* DSGE: 380px input + 16px gutter + the remaining result column = canvas. */
.macro-layout { display: grid; grid-template-columns: 380px minmax(0,1fr); gap: 16px; align-items: start; }
.macro-layout h2 { font-size: 17px; line-height: 1.4; margin: 0; }
.macro-panel-heading { padding: 16px 18px 12px; }
.macro-panel-heading p { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.shock-table-wrap { padding: 0 16px; }
.shock-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.shock-table thead th { font-size: 12px; color: var(--muted); font-weight: 400; padding: 8px 0; text-align: right; }
.shock-table thead th:first-child { text-align: left; }
.shock-table tbody th { text-align: left; width: 48%; padding: 12px 8px 12px 0; font-weight: 500; }
.shock-table tbody tr { border-top: 1px solid #e9ecf1; }
.shock-table th small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 2px; }
.shock-table td { text-align: right; padding: 8px 0 8px 10px; font-variant-numeric: tabular-nums; }
.shock-table td > small { color: var(--muted); margin-left: 2px; }
.shock-input { display: flex; align-items: center; border: 1px solid #cdd2db; border-radius: 4px; background: var(--secondary); width: 88px; }
.shock-input input { width: 62px; min-width: 0; height: 34px; padding: 6px 4px 6px 8px; border: 0; background: transparent; text-align: right; font-size: 14px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.shock-input input::-webkit-inner-spin-button { appearance: none; }
.shock-input span { font-size: 12px; color: var(--muted); padding-right: 8px; margin-left: 3px; }
.shock-input:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.shock-table .edited .shock-input { border-color: var(--primary); background: var(--primary-tint); }
.shock-presets { display: flex; gap: 8px; padding: 14px 16px 12px; border-top: 1px solid #e9ecf1; }
.shock-presets .button { font-size: 12px; min-height: 32px; padding: 6px 10px; flex: 1; }
.shock-hint { font-size: 12px; color: var(--muted); margin: 0; padding: 0 16px 16px; }
.shock-submit { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 14px 16px; border-top: 1px solid var(--line); background: #fafbfc; }
.shock-submit .button { font-size: 14px; padding: 8px 12px; min-height: 38px; }
.shock-dirty { font-size: 12px; color: var(--muted); }
.macro-error { font-size: 13px; padding: 10px 16px; margin: 0; color: var(--negative); background: #fff4f4; }
.macro-results { min-width: 0; }
.macro-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; margin: 0 0 10px; }
.macro-result-heading h2 { font-size: 14px; font-weight: 600; }
.macro-result-heading span { font-size: 12px; color: var(--muted); }
.macro-kpis { display: grid; grid-template-columns: 1fr 1fr; }
.macro-kpi { padding: 14px 18px; }
.macro-kpi + .macro-kpi { border-left: 1px solid var(--line); }
.macro-kpi h3 { font-size: 13px; color: var(--muted); font-weight: 400; margin: 0 0 10px; }
.macro-kpi strong { font-size: 28px; line-height: 1.15; font-weight: 600; font-variant-numeric: tabular-nums; }
.macro-kpi.lead strong { font-size: 32px; }
.macro-kpi strong small { font-size: 17px; margin-left: 4px; }
.macro-kpi p { font-size: 12px; margin: 8px 0 0; font-variant-numeric: tabular-nums; color: var(--muted); }
.macro-kpi p.positive { color: var(--positive); }
.macro-kpi p.negative { color: var(--negative); }
.macro-kpi p span { color: var(--muted); }
.macro-verdict { font-size: 13px; margin: 10px 0 16px; }
.decomposition { margin-bottom: 16px; }
.macro-table-scroll { padding: 0 18px 12px; overflow: auto; }
.macro-table-scroll table { width: 100%; font-size: 13px; border-collapse: collapse; white-space: nowrap; }
.macro-table-scroll th, .macro-table-scroll td { padding: 10px 8px; text-align: right; font-variant-numeric: tabular-nums; border-top: 1px solid #e9ecf1; }
.macro-table-scroll th:first-child { text-align: left; padding-left: 0; }
.macro-table-scroll td:last-child, .macro-table-scroll th:last-child { padding-right: 0; }
.macro-table-scroll thead th { font-size: 12px; color: var(--muted); font-weight: 400; border-top: 0; }
.macro-table-scroll tbody th { font-weight: 400; }
.macro-table-scroll .macro-total > * { border-top: 1px solid var(--line); font-weight: 600; }
.effect-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; padding: 0 18px 4px; }
.effect-list { padding: 0 18px 14px; }
.effect-row { display: grid; grid-template-columns: 135px minmax(40px,1fr) 74px; gap: 12px; align-items: center; min-height: 32px; font-size: 12px; }
.effect-row strong { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.effect-track { position: relative; height: 22px; }
.effect-track:before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: #d0d6df; }
.effect-track i { position: absolute; height: 6px; top: 8px; background: var(--primary); }
.dsge-method { margin-top: 16px; }
.dsge-method-content { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 16px 0; }
.dsge-method-content h2 { font-size: 16px; margin: 0 0 8px; }
.dsge-method-content p { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.macro-loading { padding: 20px; font-size: 13px; color: var(--muted); }
.loading-value { background: var(--secondary); width: 140px; height: 32px; margin: 8px 0 24px; }
@media (max-width: 1200px) { .macro-layout { grid-template-columns: 340px minmax(0,1fr); } .macro-kpi { padding: 14px; } .effect-row { grid-template-columns: 115px minmax(30px,1fr) 66px; gap: 8px; } }
@media (max-width: 1080px) { .macro-layout { grid-template-columns: 1fr; } .shock-panel { max-width: none; } .shock-table tbody th { width: auto; } .shock-input { width: 120px; } .shock-input input { width: 94px; } .practice-tools { grid-template-columns: 1fr; } .lab-tool dl { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .lab-tool > p { max-width: 65ch; } }
@media (max-width: 760px) {
  .main-shell > main { width: 100%; margin: 0; border: 0; border-radius: 0; padding: 20px 16px 28px; }
  .sidebar { border-bottom: 1px solid var(--line); }
  h1 { font-size: 24px; }
  .kpi-card:nth-child(2) { border-right: 0; }
  .kpi-card:nth-child(n+3) { border-top: 1px solid var(--line); }
  .lab-workflow ol, .dsge-method-content { grid-template-columns: 1fr; gap: 16px; }
  .macro-page > .page-heading { display: block; }
  .macro-page > .page-heading > a { margin-top: 6px; }
  .macro-kpi.lead strong { font-size: 28px; }
  .macro-kpi strong { font-size: 24px; }
  .macro-kpi h3 { min-height: 38px; }
  .macro-table-scroll { padding: 0 12px 12px; }
  .macro-table-scroll table { font-size: 12px; }
  .macro-table-scroll th, .macro-table-scroll td { padding: 10px 6px; }
  .effect-row { grid-template-columns: 120px minmax(30px,1fr) 66px; }
  .effect-list, .effect-axis { padding-left: 12px; padding-right: 12px; }
  .shock-input { width: 100px; } .shock-input input { width: 74px; min-height: 44px; }
  .shock-presets .button { min-height: 44px; }
  .shock-submit .button { min-height: 44px; }
}
/* New model tables use their own neutral rules; global sticky row headers do
   not apply to an editable form or a four-row decomposition. */
.macro-page th { position: static; background: transparent; border-bottom: 0; }
.macro-page tbody tr:hover td { background: transparent; }
.macro-page tbody td { border-bottom: 0; }
.macro-panel-heading { padding: 12px 16px 10px; }
.macro-table-scroll th, .macro-table-scroll td { padding-top: 8px; padding-bottom: 8px; }
.macro-verdict { margin-bottom: 12px; }
.decomposition { margin-bottom: 12px; }
.effect-row { min-height: 28px; }
.shock-submit .button { color: white; background: var(--primary); border-color: var(--primary); }
.shock-submit .button:hover:not(:disabled) { background: var(--primary-hover); color: white; }
.shock-submit .button:active:not(:disabled) { background: var(--primary-active); }
.lab-tool:first-child > .button { color: white; background: var(--primary); border-color: var(--primary); }
.lab-tool:first-child > .button:hover { background: var(--primary-hover); }
.mobile-menu-toggle { display: none; }
@media (max-width: 1080px) {
  :root { --sidebar: 0px; }
  .sidebar { position: relative; inset: auto; width: 100%; padding: 10px 20px; overflow: visible; border: 0; display: block; }
  .sidebar .brand { width: 138px; margin: 0; padding: 0 6px; }
  .sidebar .brand img { height: 48px; }
  .mobile-menu-toggle { display: inline-flex; position: absolute; right: 20px; top: 12px; min-height: 44px; padding: 8px 14px; }
  .sidebar:not(.menu-open) nav, .sidebar:not(.menu-open) .sidebar-contact { display: none; }
  .sidebar nav { display: flex; flex-direction: column; margin-top: 12px; gap: 4px; }
  .sidebar .practice-links { display: flex; flex-direction: column; gap: 0; margin: 0 0 8px 20px; padding-left: 10px; border-left: 1px solid #cdd1da; }
  .sidebar .sidebar-contact { position: static; padding: 12px; margin-top: 0; min-height: 44px; }
  .main-shell { margin-left: 0; }
  .main-shell > main { width: calc(100% - 16px); margin: 0 8px 8px; }
}
@media (max-width: 720px) {
  .main-shell > main { width: 100%; margin: 0; }
  .sidebar { padding: 10px 16px; }
  .mobile-menu-toggle { right: 16px; }
  .shock-table tbody th { width: auto; }
}

/* Micro overview: the shorter comparison table shares a column with the income
   chart. The map uses the available column height for its geographic content. */
.geography-analysis { display: grid; gap: 16px; min-width: 0; align-content: start; container: geography-analysis / inline-size; }
.geography-analysis > .income-viz { margin: 0; padding: 16px; }
.geography-analysis > .income-viz > .viz-header { padding: 0; gap: 12px; }
.geography-analysis > .income-viz .viz-eyebrow { display: none; }
.geography-analysis > .income-viz .viz-header h3 { font-size: 17px; }
.geography-analysis > .income-viz .plot-meta { margin-top: 12px; gap: 6px 12px; }
.geography-analysis > .income-viz .distribution-chart { height: 196px; margin-bottom: 12px; }
.geography-analysis > .income-viz .chart-readout { padding: 12px; gap: 8px; }
.geography-analysis > .income-viz .chart-readout strong { font-size: 15px; }
.geography-analysis > .income-viz .chart-readout .readout-category strong { font-size: 14px; }
.geography-analysis > .income-viz .chart-data { margin-top: 12px; padding-top: 8px; }
.geography-analysis > .comparison-card { padding: 16px; }
.geography-analysis .comparison-header { gap: 8px; }
.geography-analysis .comparison-header p { display: none; }
.geography-analysis .region-legend { margin-top: 12px; }
.geography-analysis .comparison-card td { padding-top: 10px; padding-bottom: 10px; }
.geography-analysis .comparison-card .table-scroll { max-height: 300px; }
@media (hover: hover) and (pointer: fine) {
  .geography-analysis > .income-viz .chart-footer { display: none; }
}
@container geography-analysis (max-width: 540px) {
  .geography-analysis > .income-viz > .viz-header { flex-wrap: wrap; }
  .geography-analysis > .income-viz .chart-readout { grid-template-columns: 1fr 1fr; }
  .geography-analysis > .income-viz .chart-switch { width: auto; }
}
@container results (min-width: 950px) {
  .geography-layout { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); align-items: stretch; }
  .geography-layout > .map-card { display: flex; flex-direction: column; min-height: 0; }
  .geography-layout > .map-card > .map-canvas { flex: 1; min-height: 340px; }
  .geography-layout > .map-card > .map-canvas svg { position: absolute; inset: 0; height: 100%; width: 100%; }
}
@container results (max-width: 949px) {
  .geography-layout { grid-template-columns: minmax(0, 1fr); }
  .geography-analysis { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1500px) {
  #output-stage .results-layout { grid-template-columns: minmax(0, 1fr); }
  #output-stage .chat-panel { position: static; max-width: none; }
}

/* Density pass: use one card padding, content-sized sections and compact data
   groups rather than stretching a few figures over large empty surfaces. */
:root { --workspace-gap: 12px; }
.main-shell > main { padding: 16px 20px 20px; flex: 0 0 auto; }
.page-footer { padding: 10px 20px 16px; }
h1 { font-size: 24px; }
.page-heading, .catalog-heading { margin-bottom: 12px; }
.page-heading h1 { margin-bottom: 4px; }
.page-intro { font-size: 14px; line-height: 1.5; }
.eyebrow { margin-bottom: 4px; }
.dataset-meta { padding: 9px 0; margin-bottom: 12px; gap: 8px 20px; }
.result-heading { margin-bottom: 12px; }
.kpi-grid { margin-bottom: 12px; }
.kpi-card { padding: 10px 14px; }
.kpi-label { margin-bottom: 5px; }
.kpi-value { font-size: 26px; }
.kpi-bottom { margin-top: 6px; gap: 3px; }
.results-layout, .geography-layout, .geography-analysis { gap: 12px; }
.detail-tabs, .policy-tabs { gap: 20px; }
.detail-tabs button, .policy-tabs button { min-height: 40px; padding-block: 9px; font-size: 14px; }
.metric-explanation, .scenario-insight { padding: 10px 12px; margin-block: 12px; }
.viz-header { padding: 0; gap: 12px; }
.viz-header h3 { font-size: 17px; }
.viz-header p:not(.viz-eyebrow) { margin-top: 3px; }
.geographic-viz { margin-top: 12px; }
.geographic-viz .geography-header { margin-bottom: 12px; }
.income-viz, .geography-analysis > .income-viz { padding: 14px; }
.income-viz .distribution-chart { height: 232px; }
.plot-meta { margin-top: 12px; }
.chart-readout { padding: 10px 12px; gap: 10px; border-radius: 4px; }
.chart-readout > div { gap: 4px; }
.chart-readout strong { font-size: 15px; }
.chart-readout .readout-category strong { font-size: 14px; }
.chart-data, .income-viz .chart-data { margin-top: 10px; padding-top: 8px; }
.chart-footer { margin-top: 8px; }
/* One national poverty KPI already exists above the tabs. Four mutually
   exclusive categories now share a compact strip instead of four large tiles. */
.result-detail { padding-top: 12px; }
.detail-heading { margin-bottom: 12px; }
.detail-heading > .viz-eyebrow { display: none; }
.detail-heading h2 { font-size: 20px; margin-bottom: 4px; }
.detail-card { padding: 14px 16px; margin-bottom: 12px; }
.detail-card > .viz-header { padding: 0; }
.pair-legend { margin: 12px 0 8px; }
.pair-axis { margin: 10px 0 4px; }
.pair-list { max-height: 320px; }
.pair-row { padding: 9px 0 10px; }
.pair-row-heading { margin-bottom: 6px; gap: 4px 12px; }
.pair-series { margin: 4px 0; gap: 12px; }
.pair-rail { height: 8px; }
.pair-readout { margin-top: 10px; }
.detail-data { margin-top: 12px; padding-top: 8px; }
.detail-data .table-scroll { max-height: 360px; }
.score-main > strong { font-size: 28px; }
.score-reference > strong { font-size: 24px; }
.gini-score { padding: 12px 0 4px; gap: 16px; }
.score-main, .score-reference { gap: 4px; }
.gini-scale { margin-top: 0; }
.gini-track { margin-top: 10px; margin-bottom: 10px; }
.poverty-structure { margin: 14px 0; gap: 12px; }
.poverty-stack { height: 26px; border-radius: 3px; }
.poverty-stack-row > span { margin-bottom: 5px; font-size: 12px; }
.poverty-categories { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 0; border: 1px solid #e1e6ee; border-radius: 4px; overflow: hidden; }
.poverty-category { padding: 10px 12px; border: 0; border-right: 1px solid #e1e6ee; border-radius: 0; }
.poverty-category:last-child { border-right: 0; }
.poverty-category h4 { margin-bottom: 6px; }
.poverty-category > strong { font-size: 24px; line-height: 1.2; }
.poverty-category > div { margin-top: 6px; gap: 3px 8px; }
.analysis-note { padding: 8px 10px; margin-top: 12px; }
@container results (min-width: 850px) {
  .budget-detail { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; align-items: start; }
  .budget-detail > .detail-heading, .budget-detail > .detail-table-card { grid-column: 1 / -1; }
  .budget-detail > .detail-heading, .budget-detail > .detail-card { margin: 0; }
}
@container results (max-width: 720px) {
  .poverty-categories { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .poverty-category:nth-child(2) { border-right: 0; }
  .poverty-category:nth-child(n+3) { border-top: 1px solid #e1e6ee; }
  .poverty-category h4 { min-height: 0; }
}
/* A disabled assistant needs only its explanation, not a rail of empty fields. */
.results-layout:has(> .chat-panel.inactive) { grid-template-columns: minmax(0,1fr); }
.chat-panel.inactive { position: static; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; padding: 10px 14px; }
.chat-panel.inactive .assistant-heading { margin: 0; }
.chat-panel.inactive .assistant-heading .viz-eyebrow { display: none; }
.chat-panel.inactive #chat-status { margin: 0; padding: 6px 10px; flex: 1; font-size: 12px; }
.chat-panel.inactive .chat-empty, .chat-panel.inactive .chat-prompts, .chat-panel.inactive #chat-form, .chat-panel.inactive .chat-privacy { display: none; }
.chat-panel:not(.inactive) { padding: 14px; }
.assistant-heading { margin-bottom: 12px; }
.chat-prompts { gap: 8px; }
/* Remove duplicate inner gutters in the policy form. */
.policy-panel { padding: 14px 16px; }
.panel-heading { padding: 0; gap: 12px; }
.panel-heading h2 { font-size: 18px; }
.panel-heading p { margin-top: 3px; font-size: 13px; }
.policy-tabs { margin: 10px 0 0; }
.policy-tab-content { padding: 12px 0 0; }
.field-hint { margin-bottom: 12px; padding: 8px 10px; font-size: 13px; }
.field-group-title { margin-bottom: 10px; padding-bottom: 7px; }
.field { margin-bottom: 10px; gap: 4px; font-size: 14px; }
.field-columns { gap: 20px; }
.input-wrap input { height: 36px; padding-block: 6px; font-size: 15px; }
.policy-actions { padding: 12px 0 0; margin-top: 6px; }
/* Catalog and contact pages use their content height, with no tall hero area. */
.practice-tools { gap: 12px; }
.lab-tool { padding: 14px 16px; }
.lab-tool header { margin-bottom: 12px; }
.lab-tool h2 { font-size: 20px; margin-bottom: 8px; }
.lab-tool > p { margin-bottom: 12px; }
.lab-tool dl { margin-bottom: 12px; }
.lab-tool dl > div { padding-block: 7px; }
.lab-workflow { margin-top: 16px; }
.lab-workflow h2 { margin-bottom: 10px; }
.lab-workflow ol { gap: 16px; }
.workspace-help { margin-top: 12px; padding: 12px 16px; }
.contact-page { max-width: none; }
.contact-layout, .contact-related { gap: 12px; }
.contact-feature, .contact-guide { padding: 16px; }
.contact-feature > .tool-icon, .contact-feature > .viz-eyebrow { display: none; }
.contact-feature h2 { font-size: 20px; margin-bottom: 8px; }
.contact-description { margin-bottom: 12px; font-size: 14px; }
.contact-callout { padding: 12px; border-radius: 4px; }
.contact-callout p { margin-bottom: 10px; }
.contact-guide h2 { margin-bottom: 12px; font-size: 18px; }
.contact-guide li { padding: 10px 0; gap: 10px; }
.contact-guide-note { margin-top: 12px; }
.contact-explore { margin-top: 16px; }
.section-heading { margin-bottom: 10px; }
.section-heading h2 { font-size: 18px; margin-bottom: 4px; }
.contact-related-link { padding: 12px; gap: 12px; }
@media (min-width: 1600px) {
  .contact-page { display: grid; grid-template-columns: 1.15fr 1fr .85fr; gap: 12px; align-items: start; }
  .contact-page > .page-heading { grid-column: 1 / -1; margin: 0; }
  .contact-layout { display: contents; }
  .contact-explore { margin: 0; }
  .contact-related { grid-template-columns: minmax(0,1fr); }
}
/* Data: metadata beside its preview, then three short explanatory columns. */
.dataset-overview { padding: 16px; margin-bottom: 12px; }
.dataset-title-row { gap: 10px; flex-wrap: wrap; }
.dataset-title-row h2 { font-size: 20px; }
.dataset-description { font-size: 14px; margin: 10px 0 12px; }
.dataset-facts { padding: 12px; margin-bottom: 12px; gap: 12px; }
.dataset-facts dt { margin-bottom: 4px; }
.dataset-facts dd { font-size: 20px; }
.dataset-bottom { gap: 12px; }
.data-notes { padding: 14px 16px; }
.data-notes h2 { font-size: 18px; margin-bottom: 12px; }
.data-note { margin-bottom: 12px; }
.data-note p { line-height: 1.5; }
@media (min-width: 1200px) {
  .data-page { display: grid; grid-template-columns: 340px minmax(0,1fr); gap: 12px; align-items: start; }
  .data-page > .page-heading { grid-column: 1 / -1; margin: 0; }
  .data-page > .dataset-overview { margin: 0; }
  .data-layout { display: contents; }
  .data-preview { min-width: 0; }
  .dataset-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dataset-title-row .tool-icon { display: none; }
  .dataset-title-row > .tool-status { margin-left: 0; }
  .dataset-bottom, .dataset-actions { align-items: stretch; flex-direction: column; }
  .data-notes { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px 20px; }
  .data-notes > h2 { grid-column: 1 / -1; margin: 0; }
  .data-notes > .viz-eyebrow { display: none; }
  .data-note { margin: 0; }
  .data-notes > .tool-text-link { grid-column: 1 / 3; padding-top: 6px; }
  .data-access-note { margin: 0; padding-top: 6px; justify-self: end; }
}
/* The five-shock form and its reports keep compact desktop row spacing. */
.macro-layout { grid-template-columns: 340px minmax(0,1fr); gap: 12px; }
.macro-result-heading { min-height: 26px; margin-bottom: 8px; }
.macro-panel-heading { padding: 10px 14px 8px; }
.macro-kpi { padding: 12px 14px; }
.macro-kpi.lead strong { font-size: 28px; }
.macro-kpi strong { font-size: 26px; }
.shock-table tbody th { padding-block: 9px; }
.shock-presets { padding: 10px 14px; }
.shock-hint { padding: 0 14px 12px; }
.shock-submit { padding: 10px 14px; }
.dsge-method { margin-top: 12px; }
@media (min-width: 1800px) {
  .macro-results { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; align-items: start; }
  .macro-result-heading, .macro-kpis, .macro-verdict, .macro-loading { grid-column: 1 / -1; margin: 0; }
  .macro-results > .decomposition { margin-bottom: 0; }
}
@media (max-width: 1080px) { .macro-layout { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 720px) {
  .main-shell > main { padding: 14px 16px 18px; }
  .policy-tabs button, .detail-tabs button { min-height: 44px; }
  .input-wrap input { height: 44px; }
  .field { margin-bottom: 12px; }
  .detail-card { padding: 12px; }
  .chart-readout { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .gini-score { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .score-main > strong { font-size: 28px; }
  .score-reference > strong { font-size: 24px; }
  .poverty-category { padding: 10px; }
  .poverty-category h4 { min-height: 36px; }
  .chat-panel.inactive { align-items: flex-start; }
  .chat-panel.inactive #chat-status { flex-basis: 100%; }
  .lab-tool { padding: 14px; }
}
/* Pair the row label with its two aligned bars instead of adding a separate
   title line to every region. The common scale still matches both series. */
.paired-chart { container: paired / inline-size; }
.pair-series-stack { display: block; min-width: 0; }
@container paired (min-width: 480px) {
  .pair-row { display: grid; grid-template-columns: 160px minmax(0,1fr); gap: 12px; align-items: center; padding-block: 7px; }
  .pair-row-heading { flex-direction: column; align-items: flex-start; gap: 3px; margin: 0; }
  .pair-series { margin-block: 2px; }
  .pair-axis { padding-left: 172px; padding-right: 86px; }
}
.gini-score .score-reference > p { display: none; }
.gini-score { grid-template-columns: max-content max-content minmax(0,1fr); align-items: center; gap: 32px; padding: 14px 0 4px; }
.gini-score .score-main { display: grid; grid-template-columns: max-content max-content; align-items: center; column-gap: 10px; }
.gini-score .score-main > span:first-child { grid-column: 1 / -1; }
.gini-score .score-main .score-change { justify-self: start; white-space: nowrap; }
.gini-score .score-reference > strong { font-size: 28px; line-height: 1.15; }
.gini-score .gini-scale { grid-column: auto; min-width: 0; }
.inequality-detail > .detail-card:first-of-type > .viz-header { align-items: center; margin-bottom: 0; }
.inequality-detail > .detail-card:first-of-type .select-label { flex-direction: row; align-items: center; gap: 10px; }
.inequality-detail > .detail-card:first-of-type .select-label select { min-width: 152px; }
.inequality-detail > .detail-card:first-of-type > .pair-legend { justify-content: flex-end; margin: 8px 0 0; }
@container results (max-width: 719px) {
  .gini-score { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: 14px 20px; }
  .gini-score .gini-scale { grid-column: 1 / -1; }
  .gini-score .score-main { grid-template-columns: minmax(0,1fr); }
  .gini-score .score-main > span:first-child { grid-column: auto; }
  .inequality-detail > .detail-card:first-of-type > .viz-header { align-items: flex-start; gap: 12px; }
  .inequality-detail > .detail-card:first-of-type .select-label { flex-wrap: wrap; gap: 4px 10px; }
  .inequality-detail > .detail-card:first-of-type .select-label select { min-height: 44px; }
}
@media (min-width: 1280px) {
  #policy-panel-benefits .field-columns > div,
  #policy-panel-tax .tax-columns > div,
  #policy-panel-education .field-columns > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 16px; align-content: start; }
  .field-columns .field-group-title, #policy-panel-education .field-pair { grid-column: 1 / -1; }
}
@media (min-width: 1081px) {
  .sidebar { padding-top: 16px; }
  .brand { margin-bottom: 18px; }
  .brand img { height: 60px; }
  .nav-item, .practice-navigation summary, .subnav { min-height: 40px; padding-block: 8px; }
}
.data-note, .data-note > div { min-width: 0; }
.geography-analysis .region-legend { margin: 8px 0 4px; }
.geography-analysis .comparison-card .table-scroll { margin-top: 4px; }
.geography-analysis .comparison-card td { padding-block: 8px; }
.geography-analysis .comparison-card th { padding-block: 8px; }
.geography-analysis .comparison-card .table-note { margin-top: 8px; padding-top: 8px; }
.geography-analysis .region-mini { width: 50px; gap: 2px; margin-top: 5px; }
.geography-analysis .region-mini i { height: 3px; }

/* Screen-sized research workspace. Long source tables retain their own scroll
   regions; the current report stays alongside its summary and navigation. */
#result-panel-distribution > .income-viz { margin-top: 12px; }
@media (min-width: 1081px) and (min-height: 650px) {
  .main-shell { height: 100dvh; min-height: 0; }
  .page-footer { flex: 0 0 26px; padding: 3px 20px; font-size: 12px; }
  .main-shell > main { flex: 1 1 0; min-height: 0; padding: 12px 16px; margin-bottom: 0; overflow: auto; }
  .persistent-page:not([hidden]) { height: 100%; min-height: 0; }
  #output-stage:not([hidden]) { height: 100%; display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: auto auto auto minmax(0,1fr); gap: 8px 20px; }
  #output-stage > .page-heading { margin: 0; }
  #output-stage > .page-heading .eyebrow, #output-stage > .page-heading .page-intro, #output-stage .workflow { display: none; }
  #output-stage > .page-heading h1 { margin: 0; }
  #output-stage > .result-heading { margin: 0; gap: 12px; }
  #output-stage .results-toolbar { flex: none; }
  #output-stage > .dataset-meta { grid-column: 1 / -1; padding: 0; margin: 0; border: 0; font-size: 12px; }
  #output-stage > .kpi-grid { grid-column: 1 / -1; gap: 10px; margin: 0; }
  #output-stage .kpi-card { padding: 8px 12px; }
  #output-stage .kpi-label { min-height: 0; font-size: 13px; margin-bottom: 3px; }
  #output-stage .kpi-value { font-size: 25px; }
  #output-stage .kpi-bottom { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; }
  #output-stage .kpi-bottom small { font-size: 11px; }
  #output-stage > .results-layout { grid-column: 1 / -1; min-height: 0; height: 100%; gap: 8px; grid-template-rows: minmax(0,1fr); align-items: stretch; }
  #output-stage > .results-layout:has(.chat-panel.inactive) { grid-template-rows: minmax(0,1fr) auto; }
  .results-main { min-height: 0; display: flex; flex-direction: column; position: relative; }
  .results-main > .detail-tabs { flex: 0 0 auto; margin: 0; gap: 24px; }
  .results-main > [role="tabpanel"]:not([hidden]) { flex: 1 1 0; min-height: 0; overflow: auto; padding: 0 2px 4px; }
  .chat-panel.inactive { padding: 5px 12px; gap: 8px 16px; }
  .chat-panel.inactive .assistant-heading h2 { font-size: 14px; }
  .chat-panel.inactive #chat-status { background: transparent; padding: 0; }
  .chat-panel.inactive .tool-icon { width: 20px; height: 20px; }
  .chat-panel:not(.inactive) { min-height: 0; max-height: 100%; overflow: auto; }
  #result-panel-geography { display: flex; flex-direction: column; }
  #result-panel-geography > .metric-explanation { order: 2; margin: 6px 0 0; padding: 5px 10px; font-size: 12px; }
  #result-panel-geography > .scenario-insight { order: 3; margin: 4px 0 0; padding: 0 10px; font-size: 12px; }
  .geographic-viz { margin-top: 8px; flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
  .geographic-viz .geography-header { margin-bottom: 8px; }
  .geography-header .viz-eyebrow, .geography-header h3 + p { display: none; }
  .geography-header .select-label { flex-direction: row; align-items: center; gap: 10px; }
  .geography-layout { grid-template-columns: minmax(0,.9fr) minmax(0,1.1fr); margin: 0; align-items: stretch; flex: 1 1 0; min-height: 0; }
  .geography-layout > .map-card { display: grid; grid-template-columns: minmax(0,1fr) 166px; grid-template-rows: auto auto minmax(0,1fr) auto; min-height: 0; }
  .geography-layout > .map-card > .map-canvas { grid-column: 1; grid-row: 1 / 4; min-height: 180px; margin: 8px 0 0 8px; }
  .map-card > .map-card-header, .map-card > .map-scale, .map-card > .map-detail { grid-column: 2; min-width: 0; }
  .map-card > .map-card-header { flex-wrap: wrap; gap: 2px; padding: 8px; }
  .map-card > .map-scale { padding-inline: 8px; }
  .map-card > .map-scale .map-scale-caption > span:first-child { max-width: none; white-space: nowrap; font-size: 10px; }
  .map-card > .map-scale .map-scale-caption > span:last-child { display: none; }
  .map-card > .map-detail { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; border-top: 0; background: transparent; }
  .map-card > .map-detail .map-detail-values { display: flex; flex-direction: column; gap: 6px; }
  .map-card > .map-detail .map-detail-values > div { flex-direction: row; justify-content: space-between; gap: 4px; }
  .map-card > .map-source { grid-column: 1 / -1; }
  .geography-layout > .map-card > .map-canvas svg { position: absolute; inset: 0; height: 100%; width: 100%; }
  .geography-analysis { display: flex; min-height: 0; }
  .geography-analysis > .comparison-card { flex: 1; min-height: 0; padding: 12px; }
  .map-card-header { padding: 6px 12px; }
  .map-canvas svg { height: clamp(170px,calc(100dvh - 530px),430px); }
  .map-scale { padding: 6px 12px; }
  .map-scale-caption { margin-bottom: 4px; }
  .map-scale-ticks { margin-top: 3px; }
  .map-detail { display: grid; grid-template-columns: minmax(120px,.8fr) minmax(0,1.2fr); align-items: center; gap: 12px; padding: 8px 12px; }
  .map-detail-values { margin: 0; gap: 8px; }
  .map-detail-values strong { font-size: 14px; }
  .map-source { padding: 4px 8px; }
  .comparison-card { height: 100%; display: flex; flex-direction: column; padding: 12px; }
  .comparison-header { flex-direction: row; justify-content: space-between; align-items: center; gap: 12px; }
  .comparison-header p { display: none; }
  .comparison-header select { width: auto; min-width: 160px; }
  .geography-analysis .comparison-card .table-scroll { flex: 1 1 0; min-height: 0; max-height: none; }
  .geography-analysis .comparison-card td { padding-block: 6px; }
  .geography-analysis .region-name { display: inline-block; vertical-align: middle; }
  .geography-analysis .region-mini { display: inline-flex; flex-direction: column; vertical-align: middle; width: 30px; margin: 0 0 0 8px; }
  .geography-analysis .comparison-card .table-note { font-size: 11px; }
  #result-panel-distribution .income-viz { margin-top: 8px; padding: 12px 14px; }
  #result-panel-distribution .distribution-chart { height: clamp(140px,calc(100dvh - 620px),360px); margin-bottom: 8px; }
  #result-panel-distribution .viz-eyebrow { display: none; }
  #result-panel-distribution .chart-footer { display: none; }
  #result-panel-distribution .chart-readout { padding: 6px 10px; }
  .results-main .chart-data { margin-top: 6px; padding-top: 4px; }
  .result-detail { padding-top: 8px; }
  .detail-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; padding: 0; }
  .detail-heading h2 { font-size: 17px; margin-bottom: 2px; }
  .detail-heading > p:last-child { font-size: 12px; }
  .detail-card { padding: 12px; margin-bottom: 8px; }
  .budget-detail { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; align-items: start; }
  .budget-detail > .detail-heading, .budget-detail > .detail-table-card { grid-column: 1 / -1; margin: 0; }
  .budget-detail .pair-list { max-height: clamp(130px,calc(100dvh - 580px),320px); }
  .budget-detail .pair-row { display: grid; grid-template-columns: 140px minmax(0,1fr); align-items: center; gap: 12px; padding-block: 5px; }
  .budget-detail .pair-row-heading { flex-direction: column; align-items: flex-start; margin: 0; gap: 3px; }
  .budget-detail .pair-axis { padding-left: 152px; padding-right: 86px; }
  .budget-detail .pair-readout, .inequality-detail .pair-readout { display: none; }
  .budget-detail .chart-footer, .inequality-detail .paired-chart > .chart-footer { display: none; }
  .result-detail .pair-legend { margin-block: 4px; }
  .result-detail .pair-axis { margin-block: 4px; }
  .budget-detail > .detail-table-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 20px; }
  .budget-detail > .detail-table-card > h3, .budget-detail > .detail-table-card > p { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }
  .budget-detail > .detail-table-card > .chart-data { grid-column: 1 / -1; margin-top: 4px; padding-top: 4px; }
  .inequality-detail { display: grid; grid-template-columns: minmax(290px,.8fr) minmax(0,1.2fr); gap: 8px; align-items: start; }
  .inequality-detail > .detail-heading { grid-column: 1 / -1; margin: 0; }
  .inequality-detail .detail-card { margin: 0; }
  .inequality-detail .viz-header .select-label { flex-direction: row; align-items: center; gap: 8px; }
  .inequality-detail > .detail-card:first-of-type > .viz-header { flex-wrap: wrap; gap: 10px; }
  .inequality-detail > .detail-card:first-of-type .select-label { width: 100%; justify-content: space-between; }
  .inequality-detail .gini-score { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 12px; align-items: start; }
  .inequality-detail .gini-score .score-main { grid-template-columns: max-content; }
  .inequality-detail .gini-score .score-main > span:first-child { grid-column: auto; }
  .inequality-detail .gini-scale { grid-column: 1 / -1; }
  .inequality-detail .pair-list { max-height: clamp(120px,calc(100dvh - 620px),320px); }
  .inequality-detail .pair-row { padding-block: 5px; }
  .inequality-detail .pair-row-heading { margin-bottom: 3px; }
  .inequality-detail .pair-series { margin-block: 2px; }
  .inequality-detail .pair-legend { margin-top: 8px; }
  .inequality-detail .detail-data { margin-top: 6px; padding-top: 6px; }
  .inequality-detail .pair-readout { margin-top: 6px; }
  .poverty-structure { margin: 8px 0; gap: 6px; }
  .poverty-structure .poverty-stack { height: 22px; }
  .poverty-stack-row > span { margin-bottom: 3px; }
  .poverty-category { padding-block: 8px; }
  .poverty-detail .analysis-note { padding-block: 5px; }
  .poverty-detail .detail-card { margin-bottom: 0; }
  .analysis-note { margin-top: 8px; }
  #input-stage:not([hidden]) { height: 100%; display: flex; flex-direction: column; }
  #input-stage > .page-heading { flex: 0 0 auto; margin-bottom: 8px; }
  #input-stage > .dataset-meta { flex: 0 0 auto; padding: 0; margin-bottom: 8px; border: 0; font-size: 12px; }
  #policy-form { min-height: 0; flex: 1 1 0; display: flex; flex-direction: column; margin: 0; }
  #policy-form > .policy-tab-content:not([hidden]) { min-height: 0; flex: 1 1 0; overflow: auto; }
  #policy-form .policy-actions { flex: 0 0 auto; }
  #policy-form .field { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 8px; }
  #policy-form .field > label { flex: 1; }
  #policy-form .input-wrap { width: 140px; flex: 0 0 140px; }
  #policy-form .field-pair { grid-template-columns: minmax(0,1fr); gap: 0; }
  #policy-form .field-columns > div { display: block; }
  #policy-form .field-columns { gap: 24px; }
  .macro-page { height: 100%; display: flex; flex-direction: column; }
  .macro-page > .page-heading { flex: 0 0 auto; margin-bottom: 10px; }
  .macro-layout { min-height: 0; flex: 1 1 0; grid-template-columns: 320px minmax(0,1fr); align-items: start; overflow: auto; }
  .macro-results { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; align-items: start; }
  .macro-result-heading, .macro-kpis, .macro-verdict, .macro-loading { grid-column: 1 / -1; margin: 0; }
  .macro-results > .decomposition { margin: 0; }
  .effect-row { grid-template-columns: minmax(90px,1fr) minmax(30px,1fr) 62px; gap: 6px; }
  .effect-row > span { font-size: 12px; }
  .macro-table-scroll { padding-inline: 10px; }
  .macro-table-scroll th, .macro-table-scroll td { padding-inline: 4px; font-size: 12px; }
  .dsge-method { flex: 0 0 auto; margin-top: 8px; }
  .dsge-method > summary { padding: 8px 12px; }
  .dsge-method[open] { max-height: 45%; overflow: auto; }
  .practice-tools { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .lab-tool dl > div { flex-direction: row; justify-content: space-between; gap: 8px; }
  .lab-tool dl > div dd { text-align: right; }
  .lab-workflow { margin-top: 12px; }
  .workspace-help { margin-top: 10px; padding: 10px 14px; }
  .contact-page { display: grid; grid-template-columns: 1.15fr 1fr .85fr; gap: 12px; align-items: start; }
  .contact-page > .page-heading { grid-column: 1 / -1; margin: 0; }
  .contact-layout { display: contents; }
  .contact-explore { margin: 0; }
  .contact-related { grid-template-columns: minmax(0,1fr); }
}

/* Native macro engines share one navigation, theme and viewport workspace. */
.abm-page { min-width: 0; }
.abm-layout { display: grid; grid-template-columns: 280px minmax(0,1fr); gap: 12px; align-items: start; }
.abm-inputs { min-width: 0; overflow: hidden; }
.abm-inputs h2, .abm-result-heading h2 { font-size: 17px; margin: 0; }
.abm-fields { padding: 4px 14px 12px; }
.abm-fields > label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; color: var(--muted); font-size: 13px; }
.abm-fields input, .abm-fields select { min-width: 0; width: 112px; flex: 0 0 112px; min-height: 38px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--secondary); color: var(--ink); font: inherit; font-size: 14px; font-variant-numeric: tabular-nums; }
.abm-fields input { text-align: right; }
.abm-input-hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 10px 0; }
.abm-error { padding: 10px 14px; margin: 0; color: var(--negative); background: #fff4f4; font-size: 13px; }
.abm-run { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: #fafbfc; }
.abm-run > span { font-size: 12px; color: var(--muted); }
.abm-run > button { background: var(--primary); color: white; border-color: var(--primary); }
.abm-run > button:hover:not(:disabled) { color: white; background: var(--primary-hover); }
.abm-results { min-width: 0; }
.abm-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.abm-result-heading > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.abm-result-heading span { color: var(--muted); font-size: 12px; }
.abm-kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border: 1px solid var(--line); border-radius: 4px; margin-bottom: 8px; }
.abm-kpi { min-width: 0; padding: 9px 12px; }
.abm-kpi + .abm-kpi { border-left: 1px solid var(--line); }
.abm-kpi h3 { margin: 0 0 4px; font-size: 12px; color: var(--muted); font-weight: 400; min-height: 18px; }
.abm-kpi > strong { font-size: 25px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.abm-kpi > div { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: 4px; color: var(--primary); font-size: 12px; }
.abm-kpi small { font-size: 11px; color: var(--muted); }
.abm-report-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.abm-report-toolbar .detail-tabs { gap: 18px; margin: 0; }
.abm-report-toolbar .detail-tabs button { min-height: 38px; padding-block: 7px; font-size: 13px; }
.abm-report-toolbar > select { min-height: 34px; font-size: 12px; padding: 5px 25px 5px 8px; }
.abm-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 16px; font-size: 12px; color: var(--muted); margin: 8px 0; }
.abm-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.abm-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; }
.abm-legend small { margin-left: auto; font-size: 11px; }
.abm-report { min-width: 0; }
.abm-chart-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.abm-chart { min-width: 0; margin: 0; padding: 10px 12px; display: flex; flex-direction: column; }
.abm-chart figcaption { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.abm-chart h3 { font-size: 14px; margin: 0; }
.abm-chart figcaption > span { font-size: 12px; color: var(--primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.abm-chart figcaption > span small { font-size: 11px; color: var(--muted); }
.abm-chart figcaption > span strong { font-weight: 600; }
.abm-chart-canvas { position: relative; height: 160px; min-width: 0; }
.abm-plot { position: absolute; inset: 12px 12px 24px 44px; }
.abm-line-chart { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.abm-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.abm-line.before { stroke: #9abbd9; stroke-width: 3; }
.abm-line.after { stroke: var(--primary); }
.abm-grid-row { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--chart-grid); pointer-events: none; }
.abm-grid-row > span { position: absolute; right: calc(100% + 8px); top: 0; transform: translateY(-50%); color: var(--muted); font-size: 11px; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.abm-x-axis { position: absolute; top: calc(100% + 10px); left: 0; right: 0; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; line-height: 1; font-variant-numeric: tabular-nums; pointer-events: none; }
.abm-point { position: absolute; width: 18px; height: 18px; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; box-shadow: none; transform: translate(-50%,-50%); cursor: crosshair; outline: none; }
.abm-point::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; border: 1px solid white; border-radius: 50%; background: var(--primary); transform: translate(-50%,-50%); }
.abm-point.active::after { width: 8px; height: 8px; }
.abm-point:hover { background: transparent; }
.abm-point:focus-visible::after { outline: 2px solid var(--primary); outline-offset: 2px; background: white; }
.abm-chart-readout { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.abm-chart-readout > span:first-child { margin-right: auto; }
.abm-chart-readout strong { color: var(--ink); font-weight: 600; }
.abm-provenance { font-size: 11px; color: var(--muted); margin-top: 8px; }
.abm-loading { margin: 10px 0; padding: 16px; color: var(--muted); font-size: 14px; background: var(--secondary); border-radius: 4px; }
.abm-data-card { height: 100%; display: flex; flex-direction: column; min-width: 0; }
.abm-table-heading { padding: 12px 14px 8px; }
.abm-table-heading h3 { font-size: 15px; margin: 0 0 3px; }
.abm-table-heading p { font-size: 12px; color: var(--muted); margin: 0; }
.abm-data-card > .table-scroll { flex: 1; min-height: 0; margin: 0 12px 10px; border: 0; max-height: 440px; }
.abm-data-card table { font-size: 12px; white-space: nowrap; }
.abm-data-card td, .abm-data-card th { padding: 8px 7px; text-align: right; font-variant-numeric: tabular-nums; }
.abm-data-card th:first-child { text-align: left; }
.abm-data-card tbody th { background: transparent; font-weight: 500; border-bottom: 1px solid #e8ebf1; }
.abm-method { margin-top: 12px; }
.abm-method > summary { padding: 8px 12px; font-size: 13px; }
.abm-method-content { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; padding: 12px 16px; }
.abm-method-content h2 { font-size: 16px; margin: 0 0 8px; }
.abm-method-content p { font-size: 13px; margin: 8px 0; }
.abm-method-content a { font-size: 13px; }
@media (min-width: 1081px) and (min-height: 650px) {
  .abm-page { height: 100%; display: flex; flex-direction: column; min-height: 0; }
  .abm-page > .page-heading { flex: 0 0 auto; margin-bottom: 10px; }
  .abm-layout { flex: 1 1 0; min-height: 0; align-items: stretch; }
  .abm-inputs { display: flex; flex-direction: column; min-height: 0; }
  .abm-fields { flex: 1; min-height: 0; overflow: auto; }
  .abm-run { flex: 0 0 auto; }
  .abm-results { display: flex; flex-direction: column; min-height: 0; }
  .abm-result-heading, .abm-kpis, .abm-report-toolbar, .abm-legend, .abm-provenance { flex: 0 0 auto; }
  .abm-report:not([hidden]) { flex: 1 1 0; min-height: 0; overflow: auto; }
  .abm-report > .abm-chart-grid { height: 100%; min-height: 260px; grid-template-rows: repeat(2,minmax(0,1fr)); }
  .abm-report > .trade-charts { grid-template-rows: minmax(0,1fr); }
  .abm-chart { min-height: 0; }
  .abm-chart-canvas { flex: 1 1 0; min-height: 70px; height: auto; }
  .abm-data-card > .table-scroll { max-height: none; }
  .abm-method { flex: 0 0 auto; margin-top: 8px; }
  /* Give the guide the report pane while open. Squeezing a two-row chart
     grid below its labels otherwise lets it cover the guide's close control. */
  .abm-page:has(> .abm-method[open]) > .abm-layout { display: none; }
  .abm-page > .abm-method[open] { flex: 1 1 0; min-height: 0; max-height: none; margin-top: 0; overflow: auto; }
  .abm-method[open] > summary { position: sticky; top: 0; z-index: 1; background: white; }
  .abm-method[open] > summary::after { content: "Đóng hướng dẫn để xem kết quả"; color: var(--primary); font-size: 12px; }
}
@media (max-width: 1200px) and (min-width: 1081px) {
  .abm-layout { grid-template-columns: 250px minmax(0,1fr); }
  .abm-result-heading > div { display: block; }
  .abm-report-toolbar .detail-tabs { gap: 12px; }
  .abm-report-toolbar { gap: 4px; }
  .abm-kpi { padding: 8px; }
  .abm-kpi > strong { font-size: 22px; }
}
@media (max-width: 1080px) {
  .abm-layout { grid-template-columns: minmax(0,1fr); }
  .abm-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 24px; }
  .abm-input-hint { grid-column: 1 / -1; }
  .abm-run { flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (max-width: 720px) {
  .abm-page > .page-heading, .macro-page > .page-heading { flex-wrap: wrap; }
  .abm-fields { display: block; }
  .abm-fields input, .abm-fields select { min-height: 44px; }
  .abm-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .abm-kpi:nth-child(3) { border-left: 0; }
  .abm-kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .abm-kpi h3 { min-height: 36px; }
  .abm-chart-grid, .abm-method-content { grid-template-columns: minmax(0,1fr); }
  .abm-report-toolbar .detail-tabs { width: 100%; max-width: 100%; gap: 18px; overflow-x: auto; flex-wrap: nowrap; }
  .abm-report-toolbar .detail-tabs button { min-height: 44px; }
  .abm-report-toolbar > select { min-height: 44px; width: 100%; }
  .abm-legend small { margin-left: 0; flex-basis: 100%; }
  .abm-result-heading { align-items: flex-start; }
  .abm-result-heading > div { display: block; }
  .abm-run { align-items: stretch; flex-direction: column; }
  .abm-data-card > .table-scroll { max-height: 400px; }
}

/* Complete ABM reports: compact peer tabs, explicit units and local tables. */
.abm-report-toolbar .detail-tabs { width: 100%; min-width: 0; gap: 14px; flex-wrap: nowrap; overflow-x: auto; }
.abm-report-toolbar .detail-tabs button { flex: 0 0 auto; font-size: 12px; }
.abm-legend { min-height: 32px; margin-block: 4px; gap: 4px 12px; }
.abm-legend > select { min-height: 30px; padding: 4px 24px 4px 8px; font-size: 12px; }
.abm-chart-unit { display: block; color: var(--muted); font-size: 10px; line-height: 1.2; margin-top: 2px; }
.abm-line.before { stroke-dasharray: 5 3; }
.abm-table-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.abm-table-controls > div { min-width: 0; }
.abm-table-controls > label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.abm-table-controls select { min-height: 36px; max-width: 260px; font-size: 13px; }
.abm-balance-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; align-items: start; }
.abm-balance-card { height: auto; }
.abm-balance-card .abm-table-heading { padding: 10px 10px 6px; }
.abm-balance-card .abm-table-heading h3 { font-size: 14px; }
.abm-balance-card .abm-table-heading p { font-size: 11px; }
.abm-balance-card > .table-scroll { margin-inline: 8px; flex: 0 1 auto; max-height: none; }
.abm-balance-card td, .abm-balance-card th { padding: 7px 4px; font-size: 11px; }
.abm-balance-card tbody th { min-width: 90px; max-width: 130px; white-space: normal; line-height: 1.4; }
@media (min-width: 1081px) and (min-height: 650px) {
  .abm-report > .abm-chart-grid { min-height: 260px; }
  .abm-table-controls { flex: 0 0 auto; }
}
@media (max-width: 720px) {
  .abm-report-toolbar .detail-tabs { gap: 16px; }
  .abm-legend > select { min-height: 44px; width: 100%; }
  .abm-balance-grid { grid-template-columns: minmax(0,1fr); }
  .abm-table-controls { flex-direction: column; align-items: stretch; }
  .abm-table-controls > label { justify-content: space-between; }
  .abm-table-controls select { min-height: 44px; max-width: 100%; flex: 1; min-width: 0; }
}

/* Shared navigation: a quiet brand, clear groups and one current destination. */
.sidebar { padding: 16px 12px 14px; border-right: 1px solid var(--line); }
.sidebar > .brand { width: 100%; margin: 0 0 14px; padding: 6px 14px 20px; border-bottom: 1px solid var(--line); border-radius: 0; }
.sidebar > .brand img { width: 156px; max-width: 100%; height: 62px; object-position: left center; }
.sidebar nav { gap: 0; flex: 1 1 auto; min-height: 0; overflow-y: auto; align-items: stretch; padding: 4px; }
.sidebar .nav-item, .macro-navigation > summary { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px; margin: 2px 0; border-radius: 6px; color: var(--muted); font-size: 14px; font-weight: 500; line-height: 1.4; }
.sidebar .nav-item > .icon, .macro-navigation > summary > .icon:first-child { width: 18px; height: 18px; }
.sidebar .nav-item > span, .macro-navigation > summary > span { min-width: 0; }
.sidebar .nav-item:hover, .macro-navigation > summary:hover, .sidebar .subnav:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.sidebar .nav-item[aria-current="page"], .sidebar .subnav[aria-current="page"], .sidebar-contact[aria-current="page"] { background: var(--primary); color: white; font-weight: 600; }
.sidebar-section-label { margin: 16px 12px 6px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 1px; line-height: 1.5; text-transform: uppercase; }
.sidebar-explore { margin-top: 14px; border-top: 1px solid var(--line); }
.sidebar-explore .sidebar-section-label { margin-top: 16px; }
.macro-navigation > summary { list-style: none; cursor: pointer; }
.macro-navigation > summary::-webkit-details-marker { display: none; }
.macro-navigation > summary > .icon:last-child { width: 14px; height: 14px; margin-left: auto; }
.macro-navigation[open] > summary > .icon:last-child { transform: rotate(90deg); }
.macro-navigation.current-branch > summary { color: var(--primary); font-weight: 600; }
.macro-nav-links { margin: 4px 0 8px 21px; padding-left: 12px; border-left: 1px solid var(--line); }
.sidebar .macro-nav-links .subnav { min-height: 38px; padding: 8px 10px; margin: 2px 0; gap: 9px; color: var(--muted); font-size: 13px; border-radius: 5px; }
.sidebar .macro-nav-links .subnav:hover { color: var(--primary); }
.sidebar .macro-nav-links .subnav[aria-current="page"] { color: white; }
.nav-branch-dot { width: 4px; height: 4px; flex: 0 0 4px; border-radius: 50%; background: currentColor; }
.sidebar-footer { flex: 0 0 auto; margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--line); }
.sidebar .sidebar-contact { position: static; display: flex; gap: 10px; min-height: 44px; padding: 10px 12px; margin: 0; border-radius: 6px; color: var(--muted); font-size: 14px; }
.sidebar-contact > span { margin-right: auto; }
.sidebar-contact > .icon { width: 17px; height: 17px; }
.sidebar-contact > .icon:last-child { width: 14px; height: 14px; }
.sidebar .sidebar-contact:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.sidebar .sidebar-contact[aria-current="page"] { background: var(--primary); color: white; }
@media (max-width: 1080px) {
  .sidebar { padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar > .brand { width: 132px; padding: 0 4px; margin: 0; border: 0; }
  .sidebar > .brand img { width: 124px; height: 48px; }
  .sidebar .mobile-menu-toggle { gap: 8px; }
  .mobile-menu-toggle .icon { width: 17px; height: 17px; }
  .sidebar:not(.menu-open) .sidebar-footer { display: none; }
  .sidebar nav { max-height: calc(100dvh - 150px); margin-top: 12px; padding: 4px; }
  .sidebar .macro-nav-links .subnav { min-height: 44px; }
  .sidebar-footer { margin-top: 12px; }
}

/* Finite report pages: charts and visible data share the viewport. */
.data-pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.data-pagination .page-count { margin-right: auto; font-variant-numeric: tabular-nums; }
.data-pagination button, .data-pagination select { min-height: 30px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--primary); font: inherit; padding: 3px 8px; }
.data-pagination button { min-width: 30px; font-size: 18px; line-height: 1; }
.data-pagination button:hover:not(:disabled) { background: var(--primary-soft); }
.data-pagination label { display: flex; }
.abm-data-card > .data-pagination { flex: 0 0 auto; margin: 0 12px 10px; }
@media (min-width: 1081px) and (min-height: 650px) {
  .results-main > [role="tabpanel"]:not([hidden]) { overflow: visible; }
  .results-main .table-scroll { max-height: none; overflow: visible; }
  .results-main .chart-data { margin: 0; padding: 0; min-width: 0; border-top: 0; }
  .results-main .chart-data > h4 { font-size: 13px; padding: 0 0 4px; }
  .results-main .chart-data table { font-size: 12px; }
  .results-main .chart-data th, .results-main .chart-data td { padding: 5px 7px; line-height: 1.4; }
  .results-main .chart-data th:first-child, .results-main .chart-data td:first-child { white-space: normal; }
  .results-main .chart-data .table-scroll { margin: 4px 0 0; }
  .result-detail { height: 100%; min-height: 0; }
  .budget-detail, .inequality-detail { display: grid; grid-template-columns: minmax(200px,.8fr) minmax(230px,1fr) minmax(300px,1.35fr); gap: 8px; align-items: start; }
  .budget-detail > .detail-table-card, .inequality-detail > .gini-data-card { grid-column: auto; display: block; }
  .budget-detail > .detail-table-card > .chart-data { margin: 0; padding: 0; }
  .budget-detail .detail-card, .inequality-detail .detail-card { margin: 0; padding: 10px; min-width: 0; }
  .budget-detail .pair-list, .inequality-detail .pair-list { max-height: none; overflow: visible; }
  .budget-detail .pair-row { display: block; padding: 5px 0; }
  .budget-detail .pair-row-heading { flex-direction: row; align-items: baseline; gap: 6px; }
  .budget-detail .pair-axis { padding-left: 0; padding-right: 68px; }
  .result-detail .viz-header { padding: 0; margin-bottom: 6px; }
  .result-detail .viz-header h3 { font-size: 14px; margin: 0 0 3px; }
  .result-detail .viz-header p { font-size: 12px; margin: 0; }
  .result-detail .pair-row-heading { font-size: 12px; }
  .result-detail .pair-number { width: 62px; font-size: 12px; }
  .inequality-detail .gini-score { gap: 12px; margin-top: 12px; }
  .inequality-detail .gini-score strong { font-size: 24px; }
  .inequality-detail .pair-row { padding: 4px 0; }
  .inequality-detail .pair-series { margin-block: 1px; }
  .inequality-detail .detail-data { padding: 0; margin: 0; }
  .geography-analysis .comparison-card .table-scroll { flex: 0 0 auto; }
  .geography-analysis .comparison-card td { padding-block: 5px; font-size: 12px; }
  #result-panel-distribution > .income-viz { height: 100%; margin: 0; display: grid; grid-template-columns: minmax(0,1.15fr) minmax(300px,.85fr); grid-template-rows: auto auto minmax(80px,1fr) auto; gap: 6px 16px; align-content: start; }
  #result-panel-distribution .income-viz > :not(.chart-data) { grid-column: 1; }
  #result-panel-distribution .income-viz > .chart-data { grid-column: 2; grid-row: 1 / -1; margin: 0; padding: 0 0 0 14px; border: 0; border-left: 1px solid var(--line); }
  #result-panel-distribution .distribution-chart { height: auto; min-height: 80px; margin: 0 0 16px; }
  #result-panel-distribution .chart-readout { margin: 0; gap: 8px; }
  #result-panel-distribution .chart-data caption { padding: 6px 7px; font-size: 12px; }
  #result-panel-distribution .viz-header { padding: 0; margin: 0; }
  #result-panel-distribution .viz-header h3 { font-size: 15px; }
  #result-panel-distribution .viz-header p { margin: 0; font-size: 12px; }
  .poverty-detail > .detail-card { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(300px,.85fr); gap: 6px 16px; align-items: start; }
  .poverty-detail .detail-card > :not(.chart-data) { grid-column: 1; }
  .poverty-detail .detail-card > .chart-data { grid-column: 2; grid-row: 1 / 5; padding-left: 14px; border-left: 1px solid var(--line); }
  .poverty-detail .poverty-structure { margin: 0; }
  .poverty-detail .poverty-stack { height: 18px; }
  .poverty-detail .poverty-category { padding: 6px; }
  .poverty-detail .poverty-category h4 { font-size: 11px; line-height: 1.3; }
  .poverty-detail .poverty-category > strong { font-size: 21px; margin: 5px 0; }
  .poverty-detail .poverty-category > div { flex-wrap: wrap; gap: 2px; font-size: 11px; }
  .poverty-detail .analysis-note { margin: 0; font-size: 12px; }
  .abm-fields > label { margin-block: 6px; }
  .abm-fields input, .abm-fields select { min-height: 34px; }
  .abm-input-hint { margin-block: 6px; }
  .abm-report:not([hidden]) { overflow: visible; }
  .abm-data-card > .table-scroll { flex: 0 0 auto; overflow: visible; }
  .abm-data-card td, .abm-data-card th { padding-block: 5px; font-size: 12px; }
  .abm-data-card { height: auto; }
  .abm-layout, .macro-layout { overflow: visible; }
  #policy-form .tax-columns { grid-template-columns: repeat(3,minmax(0,1fr)); }
  #policy-form .tax-columns > div:first-child { grid-column: auto; display: block; }
  #policy-form .field { margin-bottom: 5px; }
  #policy-form .input-wrap { width: 120px; flex-basis: 120px; }
}
@media (max-width: 1080px) {
  .data-pagination button, .data-pagination select { min-height: 44px; }
  .data-pagination button { min-width: 44px; }
}
@media (min-width: 1081px) and (min-height: 650px) {
  #input-stage .page-heading h1, .abm-page .page-heading h1, .macro-page .page-heading h1 { font-size: 25px; margin-bottom: 4px; }
  #input-stage .page-intro { font-size: 13px; margin: 0; }
  #policy-form .panel-heading { padding: 10px 16px 0; }
  #policy-form .panel-heading h2 { font-size: 18px; }
  #policy-form .panel-heading p { font-size: 12px; }
  #policy-form .policy-tabs { padding-inline: 16px; }
  #policy-form .policy-tabs button { min-height: 34px; padding-block: 5px; }
  #policy-form .policy-tab-content { padding: 10px 16px 6px; overflow: visible; }
  #policy-form .field-hint { margin-bottom: 8px; padding: 5px 8px; font-size: 12px; }
  #policy-form .field { gap: 6px; margin-bottom: 3px; font-size: 13px; line-height: 1.35; }
  #policy-form .field-group-title { font-size: 13px; margin-bottom: 6px; padding-bottom: 5px; }
  #policy-form .input-wrap { width: 152px; flex: 0 0 152px; }
  #policy-form .input-wrap input { height: 34px; padding: 5px 6px; font-size: 14px; }
  #policy-form .step-button { width: 28px; height: 34px; font-size: 18px; }
  #policy-form .input-unit { margin-right: 5px; font-size: 11px; }
  #policy-form .policy-actions { padding: 8px 16px; }
  #policy-form .policy-actions .action-hint { font-size: 12px; }
  .shock-table-wrap { padding-inline: 12px; }
  .shock-table tbody th { padding-block: 6px; }
  .shock-table th small { display: none; }
  .shock-table td { padding-block: 5px; }
  .shock-panel .macro-panel-heading { padding: 12px; }
  .shock-presets { padding: 8px 12px; gap: 8px; }
  .shock-submit { padding: 10px 12px; }
  .macro-table-scroll { overflow: visible; }
  .macro-table-scroll table { table-layout: fixed; }
  .macro-table-scroll th, .macro-table-scroll td { white-space: normal; overflow-wrap: anywhere; }
}
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  .page-footer { flex-basis: 20px; padding-block: 0; }
  .main-shell > main { padding: 8px 12px; }
  .sidebar > .brand { margin-bottom: 8px; padding-bottom: 10px; }
  .sidebar > .brand img { height: 50px; }
  .sidebar .nav-item, .macro-navigation > summary { min-height: 38px; padding-block: 7px; font-size: 13px; }
  .sidebar-section-label { margin-top: 8px; margin-bottom: 4px; }
  .sidebar-explore { margin-top: 8px; }
  .sidebar-explore .sidebar-section-label { margin-top: 8px; }
  .sidebar .macro-nav-links .subnav { min-height: 32px; padding-block: 6px; }
  .sidebar-footer { margin-top: 10px; }
  .abm-kpi { padding: 5px 8px; }
  .abm-kpi > strong { font-size: 21px; }
  .abm-kpi > div { font-size: 11px; margin-top: 2px; }
  .abm-kpi small { font-size: 10px; }
  .abm-kpi h3 { margin-bottom: 2px; }
  .abm-inputs .macro-panel-heading { padding: 10px 12px; }
  .abm-fields { padding: 0 12px 8px; }
  .abm-fields > label { margin-block: 4px; }
  .abm-fields input, .abm-fields select { min-height: 30px; padding-block: 4px; }
  .abm-run { padding: 8px 12px; gap: 4px; }
  .abm-run .button { min-height: 36px; padding-block: 6px; }
  .practice-page .page-heading { margin-bottom: 10px; }
  .practice-page .lab-tool { padding: 12px; }
  .practice-page .lab-tool h2 { font-size: 18px; }
  .practice-page .lab-tool > p { font-size: 12px; margin-bottom: 8px; }
  .practice-page .lab-tool dl { margin-bottom: 10px; }
  .practice-page .lab-workflow { margin-top: 8px; }
}
@media (min-width: 1081px) and (min-height: 650px) {
  #policy-form .input-options { flex-direction: row; align-items: center; gap: 12px; }
  .inequality-detail .viz-header p { display: none; }
  .inequality-detail .viz-header .select-label { width: 100%; font-size: 12px; gap: 6px; justify-content: space-between; }
  .inequality-detail .select-label select { min-height: 30px; max-width: 145px; padding: 4px 8px; font-size: 12px; }
  .inequality-detail .pair-row { display: grid; grid-template-columns: minmax(72px,.8fr) minmax(0,1.2fr); gap: 6px; align-items: center; padding: 3px 0; }
  .inequality-detail .pair-row-heading { display: block; margin: 0; }
  .inequality-detail .pair-row-heading strong { display: block; font-size: 12px; line-height: 1.3; }
  .inequality-detail .pair-row-heading > span { font-size: 11px; }
  .inequality-detail .pair-series { gap: 5px; line-height: 16px; }
  .inequality-detail .pair-number { width: 48px; }
  .results-main .chart-data th, .results-main .chart-data td { padding-block: 4px; line-height: 1.3; }
  .inequality-detail .gini-data-card { padding: 8px; }
}
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  #policy-form .field-hint, .abm-input-hint { display: none; }
  #policy-form .field { margin-bottom: 2px; }
  #policy-form .tax-columns > div:nth-child(2) { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px 8px; align-content: start; }
  #policy-form .tax-columns > div:nth-child(2) > h3 { grid-column: 1 / -1; }
  #policy-form .tax-columns > div:nth-child(2) .field { flex-direction: column; align-items: stretch; gap: 3px; }
  #policy-form .tax-columns > div:nth-child(2) .input-wrap { width: 100%; flex-basis: auto; }
  #policy-form .tax-columns > div:nth-child(2) .input-wrap input { height: 28px; padding-block: 3px; }
  #policy-form .tax-columns > div:nth-child(2) .step-button { height: 28px; }
  .abm-page > .page-heading .page-intro { display: none; }
  .abm-provenance { margin-top: 3px; line-height: 1.3; }
  .abm-data-card { display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: auto auto; }
  .abm-data-card > .abm-table-heading { grid-column: 1; grid-row: 1; padding: 5px 8px; }
  .abm-data-card > .data-pagination { grid-column: 2; grid-row: 1; align-self: center; margin: 0 8px 0 0; }
  .abm-data-card > .table-scroll { grid-column: 1 / -1; grid-row: 2; margin: 0 8px 8px; }
  .abm-data-card td, .abm-data-card th { padding-block: 3px; line-height: 1.3; }
  .abm-data-card .abm-table-heading h3 { font-size: 13px; margin: 0; }
  .abm-data-card .abm-table-heading p { font-size: 11px; line-height: 1.3; }
  .abm-table-controls { gap: 6px; }
  .abm-table-controls > label { font-size: 11px; gap: 4px; }
  .abm-table-controls select { max-width: 140px; min-height: 28px; font-size: 12px; }
  .geography-analysis .comparison-card { padding: 8px; }
  .geography-analysis .comparison-header h3 { font-size: 13px; }
  .geography-analysis .comparison-header select { min-height: 28px; min-width: 130px; padding: 3px 6px; font-size: 12px; }
  .geography-analysis .region-legend, .geography-analysis #region-note { display: none; }
  .geography-analysis .comparison-card th, .geography-analysis .comparison-card td { padding: 3px 6px; font-size: 12px; line-height: 1.3; }
  .geography-analysis .data-pagination { margin-top: 4px; }
  .geography-analysis .comparison-card .table-scroll { margin-bottom: 0; }
}

/* Native Monte Carlo controls and run-dispersion bands. */
.abm-mode { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 3px; margin-top: 6px; padding: 3px; background: var(--secondary); border: 1px solid var(--line); border-radius: 5px; }
.abm-mode button { min-height: 28px; border: 0; border-radius: 3px; padding: 4px 6px; color: var(--muted); background: transparent; font-size: 12px; }
.abm-mode button.active { background: white; color: var(--primary); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.abm-random-inputs > label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0; font-size: 13px; color: var(--muted); }
.abm-random-inputs.multiple { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.abm-random-inputs.multiple > label { flex-direction: column; align-items: stretch; gap: 2px; font-size: 12px; }
.abm-random-inputs.multiple input { width: 100%; flex: 0 0 auto; }
.abm-actions { display: flex; gap: 6px; }
.abm-actions > button:first-child { flex: 1; min-width: 0; color: white; background: var(--primary); border-color: var(--primary); }
.abm-actions > button:first-child:hover:not(:disabled) { color: white; background: var(--primary-hover); }
.abm-actions > button { padding-inline: 10px; font-size: 13px; }
.abm-run { position: relative; }
.mc-progress { position: absolute; top: 0; left: 0; width: 100%; height: 3px; border: 0; appearance: none; background: var(--primary-soft); }
.mc-progress::-webkit-progress-bar { background: var(--primary-soft); }
.mc-progress::-webkit-progress-value { background: var(--primary); }
.mc-progress::-moz-progress-bar { background: var(--primary); }
.abm-band.before { fill: #9abbd9; fill-opacity: .2; stroke: none; }
.abm-band.after { fill: var(--primary); fill-opacity: .12; stroke: none; }
.abm-chart-unit { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.abm-chart-unit > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.abm-chart-unit .mc-range { max-width: 60%; font-size: 10px; }
.mc-band-toggle { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; white-space: nowrap; cursor: pointer; }
.mc-band-toggle input { width: 13px; height: 13px; margin: 0; }
.abm-provenance { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mc-diagnostics { position: relative; flex: 0 0 auto; }
.mc-diagnostics > summary { color: var(--primary); cursor: pointer; white-space: nowrap; }
.mc-diagnostics-panel { position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 25; width: min(560px,calc(100vw - 32px)); padding: 12px; border: 1px solid var(--line); border-radius: 5px; background: white; box-shadow: 0 4px 24px #153f7b20; color: var(--muted); font-size: 12px; line-height: 1.5; }
.mc-diagnostics-panel h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.mc-diagnostics-panel table { margin-top: 8px; table-layout: fixed; }
.mc-diagnostics-panel th, .mc-diagnostics-panel td { padding: 4px 6px; font-size: 11px; white-space: normal; overflow-wrap: anywhere; }
.mc-diagnostics-panel th:first-child { width: 64px; }
.mc-diagnostics-panel th:nth-child(2) { width: 78px; }
@media (max-width: 1080px) {
  .abm-mode button { min-height: 40px; }
  .abm-random-inputs { min-width: 0; }
  .abm-random-inputs.multiple { grid-column: 1 / -1; }
  .mc-band-toggle { min-height: 40px; }
  .abm-provenance { flex-wrap: wrap; }
}

@media (min-width: 1081px) and (min-height: 650px) {
  .abm-fields { padding-bottom: 6px; }
  .abm-random-inputs > label { margin-block: 3px; }
  .abm-mode { margin-top: 4px; }
}

/* ABM calibration groups: all edits persist when switching groups. */
.abm-group-selector { display: block; padding: 0 14px 8px; color: var(--muted); font-size: 12px; }
.abm-group-selector > span { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.abm-group-selector small { color: var(--primary); font-size: 11px; }
.abm-group-selector select { width: 100%; min-width: 0; padding: 6px 8px; min-height: 34px; border: 1px solid var(--line); background: var(--secondary); color: var(--ink); border-radius: 4px; font: inherit; font-size: 13px; }
.abm-control-group > label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; color: var(--muted); font-size: 13px; }
.abm-control-group[hidden] { display: none; }
.abm-parameter-label { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.abm-parameter-label small { margin-top: 2px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.abm-parameter-value { display: flex; align-items: center; flex: 0 0 94px; width: 94px; min-width: 0; position: relative; }
.abm-parameter-value input { width: 100%; flex-basis: 100%; padding-right: 20px; }
.abm-parameter-value > span { position: absolute; right: 7px; font-size: 11px; pointer-events: none; }
.abm-parameter-field.edited input { border-color: var(--primary); background: var(--primary-soft); }
.abm-parameter-reset { display: flex; align-items: center; justify-content: space-between; gap: 6px; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; font-size: 10px; color: var(--muted); }
.abm-parameter-reset button, .abm-calibration-error button { padding: 3px 0; font: inherit; font-size: 12px; color: var(--primary); background: transparent; border: 0; text-align: left; }
.abm-parameter-reset button:disabled { opacity: .5; cursor: default; }
.abm-calibration-error { font-size: 12px; margin: 4px 0; }
@media (min-width: 1081px) and (min-height: 650px) {
  .abm-control-group > label { margin-block: 6px; }
  .abm-group-selector { padding-bottom: 4px; }
  .abm-parameter-hint { font-size: 11px; line-height: 1.4; margin: 8px 0 6px; }
}
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  .abm-group-selector { padding-inline: 12px; font-size: 11px; }
  .abm-group-selector select { min-height: 30px; padding-block: 4px; }
  .abm-control-group > label { margin-block: 4px; font-size: 12px; }
  .abm-parameter-reset { margin-top: 6px; padding-top: 4px; }
}
@media (max-width: 1080px) {
  .abm-group-selector select { min-height: 44px; }
  .abm-control-group { grid-column: 1 / -1; }
  .abm-parameter-hint, .abm-parameter-reset, .abm-calibration-error { grid-column: 1 / -1; }
  .abm-parameter-reset button { min-height: 44px; }
}
@media (min-width: 1081px) and (min-height: 650px) {
  .abm-parameter-hint:not([hidden]) { display: block; }
  .abm-report > .abm-chart-grid { min-height: 0; }
}
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  .abm-inputs .macro-panel-heading { padding-block: 8px; }
  .abm-mode { padding: 2px; }
  .abm-mode button { min-height: 26px; padding-block: 2px; }
  .abm-group-selector > span { line-height: 1.3; margin-bottom: 3px; }
  .abm-run { padding-block: 6px; gap: 3px; }
  .abm-run > span { font-size: 11px; line-height: 1.3; }
  .abm-result-heading { margin-bottom: 4px; }
  .abm-result-heading > div { display: flex; }
  .abm-kpis { margin-bottom: 4px; }
  .abm-report-toolbar .detail-tabs button { min-height: 30px; padding-block: 4px; }
  .abm-legend { margin-block: 4px; }
  .abm-chart { padding: 6px 8px; }
  .abm-chart-canvas { min-height: 50px; }
}

.abm-inputs { position: relative; }
@media (min-width: 1081px) and (min-height: 650px) {
  .abm-error:not([hidden]) { position: absolute; bottom: 76px; left: 8px; right: 8px; z-index: 20; padding: 8px 10px; border: 1px solid #eccdcd; border-radius: 4px; box-shadow: 0 3px 12px #153f7b15; font-size: 12px; line-height: 1.4; }
}
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  .abm-parameter-label { line-height: 1.3; }
  .abm-parameter-label small { line-height: 1.1; margin-top: 1px; }
  .abm-kpi { padding-block: 3px; }
  .abm-kpi > div { line-height: 1.2; gap: 1px 6px; }
  .abm-kpi small { line-height: 1.2; }
  .abm-plot { inset-block: 9px 18px; }
  .abm-x-axis { top: calc(100% + 7px); }
}
@media (min-width: 1081px) and (min-height: 650px) {
  .abm-error:not([hidden]) { position: static; margin: 3px 12px 5px; padding: 6px 8px; box-shadow: none; }
  .abm-inputs:has(> .abm-error:not([hidden])) .abm-input-hint { display: none; }
  .abm-inputs:has(> .abm-error:not([hidden])) .abm-control-group > label { margin-block: 2px; }
}

/* DSGE reports follow Python's welfare/moment outputs, independent of ABM. */
.macro-results.dsge-results { display: flex; flex-direction: column; min-height: 0; gap: 0; }
.dsge-results > .macro-result-heading { flex: 0 0 auto; margin-bottom: 6px; min-height: 24px; }
.dsge-results > .macro-kpis { flex: 0 0 auto; margin-bottom: 8px; }
.dsge-results .macro-kpi { padding: 10px 14px; }
.dsge-results .macro-kpi h3 { margin-bottom: 5px; }
.dsge-results .macro-kpi > strong { font-size: 28px; }
.dsge-results .macro-kpi p { margin-top: 5px; }
.dsge-report-tabs { flex: 0 0 auto; margin: 0 0 6px; gap: 14px; white-space: nowrap; overflow-x: auto; }
.dsge-report-tabs button { padding-inline: 2px; font-size: 12px; }
.dsge-report:not([hidden]) { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; }
.dsge-legend, .dsge-curve-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 11px; color: var(--muted); min-height: 20px; flex: 0 0 auto; }
.dsge-legend > span, .dsge-curve-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.dsge-legend i { width: 8px; height: 8px; border-radius: 1px; border: 1px solid #8aafcf; }
.dsge-legend .legend-baseline { background: #bfd7ee; }
.dsge-legend .legend-reform { background: var(--primary); border-color: var(--primary); }
.dsge-report-note { margin: 0; font-size: 12px; color: var(--muted); min-height: 20px; }
.dsge-card-note { margin: 6px 0 0; font-size: 11px; line-height: 1.4; color: var(--muted); flex: 0 0 auto; }
.dsge-welfare-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; min-height: 0; }
.dsge-welfare-grid > section { min-width: 0; padding: 10px 12px; }
.dsge-report h3 { font-size: 14px; line-height: 1.35; margin: 0; }
.dsge-report header > p { margin: 4px 0 8px; font-size: 11px; color: var(--muted); }
.dsge-report table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12px; }
.dsge-report th, .dsge-report td { border-bottom: 1px solid var(--line); padding: 7px 5px; text-align: right; line-height: 1.3; font-variant-numeric: tabular-nums; font-weight: 400; overflow-wrap: anywhere; }
.dsge-report th:first-child { text-align: left; width: 37%; }
.dsge-report thead th { color: var(--muted); font-size: 11px; }
.dsge-report tbody th small { display: inline; margin-left: 5px; color: var(--muted); font-size: 10px; }
.dsge-report .macro-total th, .dsge-report .macro-total td { font-weight: 600; }
.dsge-component-card tbody th { font-size: 11px; }
.dsge-delta-track { height: 7px; position: relative; margin-top: 5px; border-left: 1px solid transparent; background: linear-gradient(to right,transparent calc(50% - .5px),var(--line) calc(50% - .5px),var(--line) calc(50% + .5px),transparent calc(50% + .5px)); }
.dsge-delta-track i { position: absolute; top: 0; height: 7px; background: var(--primary); border-radius: 1px; }
.dsge-effect-card .effect-axis { padding: 2px 0 5px; }
.dsge-effect-card .effect-list { padding: 0; }
.dsge-effect-card .effect-row { grid-template-columns: minmax(88px,1fr) minmax(30px,.9fr) 62px; gap: 8px; padding-block: 6px; font-size: 12px; }
.dsge-effect-card .effect-row strong { font-size: 11px; }
.dsge-pair-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; min-width: 0; min-height: 0; }
.dsge-pair-card { margin: 0; padding: 10px 12px; display: flex; flex-direction: column; min-width: 0; min-height: 150px; }
.dsge-pair-card figcaption small { display: block; color: var(--muted); font-size: 10px; line-height: 1.4; margin-top: 3px; }
.dsge-pair-body { flex: 1; min-height: 52px; display: grid; grid-template-rows: repeat(2,minmax(24px,1fr)); gap: 4px; margin-block: 6px; }
.dsge-pair-row { display: grid; grid-template-columns: 54px minmax(0,1fr) 76px; gap: 6px; align-items: center; font-size: 11px; color: var(--muted); }
.dsge-pair-row strong { font-weight: 600; color: var(--ink); text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dsge-pair-track { height: 17px; position: relative; border-block: 1px solid var(--chart-grid); }
.dsge-pair-track > i { position: absolute; top: 0; height: 100%; border-radius: 2px; }
.dsge-pair-track > i.before { background: #bfd7ee; border: 1px solid #8aafcf; }
.dsge-pair-track > i.after { background: var(--primary); }
.dsge-pair-track > i.dsge-zero { width: 1px; background: var(--line); }
.dsge-pair-axis { display: flex; justify-content: space-between; margin-left: 60px; margin-right: 82px; color: var(--muted); font-size: 10px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.dsge-volatility-grid { grid-template-columns: minmax(0,1fr); }
.dsge-volatility-grid .dsge-pair-card { display: grid; grid-template-columns: minmax(140px,.8fr) minmax(0,1.6fr); grid-template-rows: minmax(0,1fr) auto; column-gap: 16px; min-height: 100px; }
.dsge-volatility-grid figcaption { grid-column: 1; grid-row: 1 / -1; align-self: center; }
.dsge-volatility-grid .dsge-pair-body { margin: 0; }
.dsge-volatility-grid .dsge-pair-axis { grid-column: 2; margin-top: 4px; }
.dsge-sensitivity { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.dsge-sensitivity-toolbar, .dsge-data-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; flex: 0 0 auto; }
.dsge-sensitivity-toolbar > span { color: var(--muted); font-size: 11px; }
.dsge-shock-selector, .dsge-data-toolbar > label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.dsge-shock-selector select, .dsge-data-toolbar select { max-width: 220px; min-height: 32px; padding: 4px 25px 4px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--secondary); color: var(--ink); font: inherit; }
.dsge-reference-swatch, .dsge-response-swatch { width: 18px; height: 0; border-top: 2px solid var(--primary); }
.dsge-reference-swatch { border-top-color: #9abbd9; border-top-style: dashed; }
.dsge-curve-grid-layout { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; min-height: 0; }
.dsge-curve { margin: 0; min-width: 0; padding: 10px 12px; display: flex; flex-direction: column; }
.dsge-curve figcaption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 8px; }
.dsge-curve figcaption > span { color: var(--muted); font-size: 11px; }
.dsge-curve figcaption strong { color: var(--primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.dsge-curve > p, .dsge-curve > small { font-size: 10px; color: var(--muted); margin: 3px 0 0; }
.dsge-curve-canvas { position: relative; min-width: 0; height: 220px; }
.dsge-curve-plot { position: absolute; inset: 15px 10px 24px 68px; }
.dsge-curve-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.dsge-reference-line { stroke: #9abbd9; stroke-width: 2; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; fill: none; }
.dsge-response-line { stroke: var(--primary); stroke-width: 2; vector-effect: non-scaling-stroke; fill: none; stroke-linejoin: round; }
.dsge-curve-grid { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--chart-grid); pointer-events: none; }
.dsge-curve-grid > span { position: absolute; right: calc(100% + 7px); top: 0; transform: translateY(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; line-height: 1; font-variant-numeric: tabular-nums; }
.dsge-curve-point { position: absolute; width: 18px; height: 18px; min-height: 0; min-width: 0; border: 0; padding: 0; border-radius: 50%; transform: translate(-50%,-50%); background: transparent; outline: none; }
.dsge-curve-point::after { content: ""; position: absolute; inset: calc(50% - 2px); border-radius: 50%; background: var(--primary); }
.dsge-curve-point:hover { background: transparent; }
.dsge-curve-point:focus-visible::after { outline: 2px solid var(--primary); outline-offset: 3px; }
.dsge-curve-point.active::after { inset: calc(50% - 3px); }
.dsge-scenario-dot { position: absolute; width: 8px; height: 8px; border: 1px solid white; border-radius: 50%; background: var(--primary); transform: translate(-50%,-50%); pointer-events: none; }
.dsge-curve-x { display: flex; justify-content: space-between; position: absolute; top: calc(100% + 9px); left: 0; right: 0; font-size: 10px; line-height: 1; color: var(--muted); }
.dsge-curve-readout { font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums; }
.dsge-data-card, .dsge-change-card { padding: 10px 12px; min-height: 0; }
.dsge-data-body { margin-top: 8px; }
.dsge-data-card td, .dsge-data-card th, .dsge-change-card td, .dsge-change-card th { padding-block: 6px; }
.dsge-data-card th:first-child { width: 42%; }
.dsge-change-card > header { margin-bottom: 8px; }
@media (min-width: 1081px) and (min-height: 650px) {
  .macro-page .macro-layout { grid-template-columns: 300px minmax(0,1fr); align-items: stretch; overflow: visible; }
  .macro-page .shock-panel { display: flex; flex-direction: column; min-height: 0; }
  .macro-page .shock-submit { margin-top: auto; }
  .dsge-report:not([hidden]) { flex: 1 1 0; }
  .dsge-welfare-grid, .dsge-pair-grid, .dsge-sensitivity, .dsge-curve-grid-layout { flex: 1 1 0; }
  .dsge-pair-grid { grid-template-rows: repeat(2,minmax(0,1fr)); }
  .dsge-volatility-grid { grid-template-rows: repeat(3,minmax(0,1fr)); }
  .dsge-pair-card { min-height: 0; }
  .dsge-volatility-grid .dsge-pair-card { min-height: 0; padding-block: 6px; }
  .dsge-volatility-grid .dsge-pair-body { min-height: 0; }
  .dsge-curve-canvas { flex: 1; min-height: 70px; height: auto; }
  .dsge-component-card th, .dsge-component-card td { padding-block: 6px; font-size: 11px; }
  .dsge-effect-card .effect-row { padding-block: 5px; }
  .dsge-report-tabs button { min-height: 32px; padding-block: 5px; }
}
@media (min-width: 1081px) and (max-width: 1200px) {
  .macro-page .macro-layout { grid-template-columns: 280px minmax(0,1fr); }
}
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  .dsge-results .macro-kpi { padding: 7px 10px; }
  .dsge-results .macro-kpi > strong { font-size: 25px; }
  .dsge-results .macro-kpi h3 { margin-bottom: 3px; font-size: 12px; }
  .dsge-results .macro-kpi p { margin-top: 3px; font-size: 11px; }
  .dsge-results > .macro-result-heading { min-height: 20px; margin-bottom: 4px; }
  .dsge-pair-card { padding: 7px 10px; }
  .dsge-pair-card figcaption h3, .dsge-report h3 { font-size: 13px; }
  .dsge-pair-body { margin-block: 4px; min-height: 45px; }
  .dsge-welfare-grid > section { padding: 8px 10px; }
  .dsge-data-card, .dsge-change-card { padding: 8px 10px; }
  .dsge-data-card th, .dsge-data-card td { padding-block: 5px; }
}
@media (max-width: 1080px) {
  .dsge-report-tabs button { min-height: 44px; }
  .dsge-curve-grid-layout { grid-template-columns: minmax(0,1fr); }
  .dsge-shock-selector select, .dsge-data-toolbar select { min-height: 44px; }
  .dsge-report-tabs { margin-top: 10px; }
}
@media (max-width: 720px) {
  .dsge-welfare-grid, .dsge-pair-grid { grid-template-columns: minmax(0,1fr); }
  .dsge-volatility-grid .dsge-pair-card { display: flex; }
  .dsge-pair-card { min-height: 150px; }
  .dsge-pair-row { grid-template-columns: 54px minmax(0,1fr) 76px; }
  .dsge-data-toolbar { flex-direction: column; align-items: stretch; }
  .dsge-shock-selector, .dsge-data-toolbar > label { justify-content: space-between; width: 100%; }
  .dsge-data-card th:first-child, .dsge-change-card th:first-child { width: 32%; }
  .dsge-report th, .dsge-report td { font-size: 11px; padding-inline: 3px; }
}
.macro-results.dsge-results { align-items: stretch; }
.dsge-report { width: 100%; }
/* Group all 27 DSGE inputs without lengthening the desktop workspace. */
.dsge-parameter-group { display: block; padding: 0 12px 6px; color: var(--muted); font-size: 12px; }
.dsge-parameter-group > span { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.dsge-parameter-group small { font-size: 10px; color: var(--primary); }
.dsge-parameter-group select { width: 100%; min-height: 34px; padding: 5px 8px; font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 4px; background: var(--secondary); }
.shock-panel .shock-table-wrap[hidden] { display: none; }
.structural-table .shock-input.coefficient input { width: 100%; padding-right: 8px; }
.structural-table .shock-input.coefficient > span { display: none; }
.structural-table tbody th { font-size: 12px; line-height: 1.35; }
.dsge-parameter-hint { margin: 6px 12px 8px; font-size: 11px; line-height: 1.4; color: var(--muted); }
.dsge-structural-effect { border-top: 1px solid var(--line); margin-top: 3px; font-weight: 600; }
@media (min-width: 1081px) and (min-height: 650px) {
  .shock-panel .macro-panel-heading { padding-bottom: 8px; }
  .shock-panel .shock-table thead th { padding-block: 5px; }
  .shock-panel .structural-table tbody th { padding-block: 5px; width: 42%; }
  .shock-panel .shock-presets { padding-block: 7px; }
  .shock-panel .macro-error { font-size: 11px; padding: 6px 12px; line-height: 1.4; }
}
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  .dsge-parameter-group { padding-bottom: 3px; font-size: 11px; }
  .dsge-parameter-group select { min-height: 30px; padding-block: 4px; }
  .dsge-parameter-hint { font-size: 10px; margin-block: 4px 6px; }
  .shock-panel .shock-table tbody th { padding-block: 4px; font-size: 12px; }
  .shock-panel .shock-table td { padding-block: 4px; }
  .shock-panel .shock-input input { height: 30px; padding-block: 4px; }
  .shock-panel .macro-panel-heading { padding: 6px 12px; }
  .shock-panel .macro-panel-heading h2 { font-size: 16px; }
  .shock-panel .macro-panel-heading p { margin-top: 0; font-size: 11px; line-height: 1.4; }
  .shock-panel .shock-table thead th { padding-block: 3px; font-size: 11px; }
  .shock-panel .shock-table td { padding-block: 2px; }
  .shock-panel .shock-input input { height: 28px; }
  .shock-panel .shock-presets { padding-block: 4px; }
  .shock-panel .shock-presets .button { min-height: 30px; padding-block: 4px; }
  .shock-panel .shock-submit { padding: 6px 12px; flex-wrap: nowrap; gap: 6px; }
  .shock-panel .shock-dirty { font-size: 11px; }
  .shock-panel .shock-submit .button { min-height: 34px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
  .shock-panel:has(> .macro-error:not([hidden])) .dsge-parameter-hint { display: none; }
  .dsge-effect-card .effect-row { min-height: 24px; padding-block: 2px; }
  .dsge-effect-card .effect-track { height: 16px; }
  .dsge-effect-card .effect-track i { top: 5px; }
  .dsge-change-card th, .dsge-change-card td { padding-block: 4px; font-size: 11px; }
  .dsge-change-card > header { margin-bottom: 4px; }
}
@media (max-width: 1080px) {
  .dsge-parameter-group select { min-height: 44px; }
}

/* Results use the desktop workspace; long tables fill it with finite pages. */
@media (min-width: 1081px) and (min-height: 650px) {
  .main-shell > main:has(> .persistent-page:not([hidden]) > #output-stage:not([hidden])) {
    flex: 1 1 0;
    max-height: none;
  }
  .persistent-page:has(> #output-stage:not([hidden])) { height: 100%; }
  #output-stage:not([hidden]) { height: 100%; grid-template-rows: auto auto auto minmax(0,1fr); }
  #output-stage > .results-layout { height: 100%; grid-template-rows: minmax(0,1fr); align-items: stretch; }
  #output-stage > .results-layout:has(.chat-panel.inactive) { grid-template-rows: minmax(0,1fr) auto; }
  #output-stage .results-main > [role="tabpanel"]:not([hidden]) { flex: 1 1 0; }
  #output-stage .result-detail { height: 100%; }
  #output-stage .geographic-viz, #output-stage .geography-layout { flex: 1 1 0; }
  .geography-analysis .comparison-header select { min-height: 32px; padding-block: 4px; font-size: 12px; }
  .geography-analysis .comparison-card .table-scroll { margin-bottom: 0; }
  .geography-analysis .region-legend { margin: 6px 0 2px; }
  .geography-analysis .comparison-card .table-note { margin-top: 6px; padding-top: 6px; }
  .geography-analysis .data-pagination { margin-top: 6px; }
  #output-stage .geography-layout > .map-card > .map-canvas { min-height: 140px; height: auto; }
  #result-panel-distribution > .income-viz { height: 100%; grid-template-rows: auto auto minmax(80px,1fr) auto; }
  #result-panel-distribution .plot-meta { margin: 4px 0; }
  #result-panel-distribution .distribution-chart { height: auto; }
}
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  #output-stage .kpi-card { padding: 6px 10px; }
  #output-stage .results-main > .detail-tabs button { min-height: 34px; padding-block: 5px; }
  .budget-detail .detail-card { padding: 8px; }
  .budget-detail .pair-legend { margin-block: 6px; }
  .budget-detail .pair-axis { margin-top: 6px; }
  .budget-detail .pair-row { display: grid; grid-template-columns: minmax(72px,.85fr) minmax(0,1.15fr); gap: 6px; align-items: center; padding-block: 3px; }
  .budget-detail .pair-row-heading { display: flex; flex-direction: column; align-items: flex-start; margin: 0; gap: 1px; }
  .budget-detail .pair-row-heading strong { font-size: 12px; line-height: 1.3; }
  .budget-detail .pair-row-heading > span { font-size: 11px; line-height: 1.3; }
  .budget-detail .pair-series { margin-block: 2px; gap: 5px; line-height: 16px; }
  .budget-detail .pair-number { font-size: 11px; width: 50px; }
  #result-panel-distribution .chart-readout strong { font-size: 14px; }
  #output-stage .geographic-viz { margin-top: 4px; }
  #output-stage .geography-header .select-label select { min-height: 30px; padding-block: 4px; font-size: 12px; }
  #output-stage .geography-header h3 { font-size: 15px; }
  #output-stage .map-card-header { padding: 3px 6px; display: block; line-height: 1.2; }
  #output-stage .map-card-header > span { display: block; font-size: 10px; }
  #output-stage .map-scale { padding: 3px 6px; }
  #output-stage .map-scale-caption, #output-stage .map-scale-ticks { line-height: 1.2; }
  #output-stage .map-detail { padding: 4px 6px; gap: 4px; }
  #output-stage .map-detail select { min-height: 28px; padding: 4px 6px; font-size: 12px; }
  #output-stage .map-detail-values { gap: 3px; }
  #output-stage .map-detail-values > div { line-height: 18px; }
  #output-stage .map-detail-values strong { font-size: 12px; }
  #output-stage .map-source { padding-block: 3px; font-size: 10px; line-height: 1.3; }
  .geography-analysis .comparison-header select { min-height: 28px; padding-block: 3px; }
  .inequality-detail .viz-header { gap: 4px; margin-bottom: 4px; }
  .inequality-detail .pair-legend { margin: 2px 0; }
  .inequality-detail .pair-axis { margin: 2px 0; }
  .inequality-detail .pair-series { margin-block: 0; line-height: 15px; }
  .inequality-detail .pair-row { padding-block: 2px; }
  .inequality-detail .data-pagination { margin-top: 2px; }
  .inequality-detail .gini-score { grid-template-columns: max-content minmax(0,1fr); padding-top: 6px; gap: 8px; margin-top: 8px; }
  .inequality-detail .gini-score .score-main { grid-template-columns: max-content max-content; gap: 0 5px; }
  .inequality-detail .gini-score .score-main > span:first-child { grid-column: 1 / -1; }
  .inequality-detail .score-change { font-size: 11px; padding: 2px 4px; }
  .inequality-detail .gini-track { margin-block: 6px; }
  .poverty-detail > .detail-card { padding: 8px; row-gap: 4px; }
  .poverty-detail .poverty-structure { gap: 6px; }
  .poverty-detail .poverty-category { padding: 4px; }
  .poverty-detail .poverty-category h4 { margin-bottom: 3px; }
  .poverty-detail .poverty-category > div { margin-top: 3px; }
  .poverty-detail .analysis-note { padding: 4px 8px; font-size: 11px; line-height: 1.4; }
  .poverty-detail .viz-header p { font-size: 11px; line-height: 1.4; }
}

/* Methodology is a peer report, so opening it never overlays a chart. */
.methodology-report { margin-top: 8px; padding: 14px; }
.methodology-report > header h2 { font-size: 17px; margin: 0 0 4px; }
.methodology-report > header p { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.5; }
.methodology-layout { display: grid; grid-template-columns: 200px minmax(0,1fr); gap: 16px; margin-top: 12px; align-items: start; }
.methodology-report .method-provenance { grid-template-columns: minmax(0,1fr); gap: 12px; padding: 12px; }
.methodology-report .method-grid { padding: 0; gap: 16px; }
.methodology-report .method-grid h3 { font-size: 13px; margin: 0 0 4px; }
.methodology-report .method-grid p { font-size: 13px; line-height: 1.6; margin: 0; color: var(--muted); }
.methodology-reading { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.methodology-reading h3 { font-size: 13px; margin: 0 0 6px; }
.methodology-reading > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.methodology-reading p { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 0; }
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  .methodology-report { padding: 8px; }
  .methodology-report > header h2 { font-size: 16px; margin-bottom: 0; }
  .methodology-layout { grid-template-columns: 150px minmax(0,1fr); margin-top: 6px; gap: 12px; }
  .methodology-report .method-provenance { padding: 8px; gap: 8px; }
  .methodology-report .method-grid { gap: 10px 14px; }
  .methodology-report .method-grid p { font-size: 12px; line-height: 1.5; }
  .methodology-reading { margin-top: 6px; padding-top: 6px; }
}
@media (max-width: 1080px) {
  .methodology-layout { grid-template-columns: minmax(0,1fr); }
  .methodology-report .method-provenance { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .methodology-report .method-provenance, .methodology-report .method-grid, .methodology-reading > div { grid-template-columns: minmax(0,1fr); }
}
@media (min-width: 1081px) and (max-width: 1150px) and (min-height: 650px) {
  .inequality-detail { grid-template-columns: minmax(240px,.9fr) minmax(220px,1fr) minmax(300px,1.3fr); }
  .inequality-detail .select-label select { min-width: 0; width: 145px; }
  .poverty-detail > .detail-card { grid-template-columns: minmax(0,1fr) minmax(340px,.85fr); }
}

/* Numeric readouts need breathing room at the frame edge. Increase horizontal
   insets without adding vertical space to the viewport workspaces. */
:root { --numeric-inset: 12px; --map-rail-inset: 16px; }
.poverty-category { padding-inline: var(--numeric-inset); }
.structural-table .shock-input.coefficient input { padding-inline-end: var(--numeric-inset); }
.abm-fields input[type="number"] { padding-inline-end: var(--numeric-inset); }
.results-main .table-scroll th:last-child,
.results-main .table-scroll td:last-child { padding-inline-end: var(--numeric-inset); }
@media (min-width: 1081px) and (min-height: 650px) {
  #output-stage > .kpi-grid { column-gap: 0; }
  #output-stage .geography-layout > .map-card { grid-template-columns: minmax(0,1fr) 184px; }
  #output-stage .map-card > .map-card-header,
  #output-stage .map-card > .map-scale,
  #output-stage .map-card > .map-detail { padding-inline: var(--map-rail-inset); }
  #output-stage .budget-detail .detail-card,
  #output-stage .inequality-detail .detail-card { padding-inline: var(--numeric-inset); }
  #output-stage .poverty-category { padding-inline: var(--numeric-inset); }
}
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  #output-stage .kpi-card { padding-inline: var(--numeric-inset); }
  .abm-chart, .abm-kpi { padding-inline: var(--numeric-inset); }
  .dsge-results .macro-kpi,
  .dsge-welfare-grid > section,
  .dsge-pair-card,
  .dsge-data-card,
  .dsge-change-card { padding-inline: var(--numeric-inset); }
}

/* Viewport-fitted reports: use extra height for data, rather than an empty
   sheet below short cards. Pagination observes these bounded regions in Rust. */
@media (min-width: 1081px) and (min-height: 650px) {
  #output-stage .budget-detail, #output-stage .inequality-detail { align-items: stretch; }
  #output-stage .budget-detail .detail-card,
  #output-stage .inequality-detail .detail-card { display: flex; flex-direction: column; min-height: 0; }
  #output-stage .budget-detail > .detail-table-card { align-items: stretch; }
  #output-stage .detail-card > .chart-data { flex: 1 1 0; display: flex; flex-direction: column; min-height: 0; }
  #output-stage .detail-card .chart-data > h4 { flex: 0 0 auto; }
  #output-stage .detail-card .chart-data > .table-scroll,
  .geography-analysis .comparison-card .table-scroll { flex: 1 1 0; min-height: 0; }
  [data-page-viewport] { --page-row-height: 28; }
  #output-stage .detail-data [data-page-viewport] tbody > tr { height: 28px; }
  #output-stage .paired-chart { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
  #output-stage .paired-chart > .pair-list { flex: 1 1 0; min-height: 0; max-height: none; overflow: visible; --page-row-height: 44; }
  #output-stage .paired-chart .pair-row { min-height: 44px; }
  #output-stage .budget-detail .pair-list { --page-row-height: 64; }
  #output-stage .budget-detail .pair-row { min-height: 64px; }
  #output-stage .budget-detail .pair-list { display: flex; flex-direction: column; justify-content: space-evenly; }
  #output-stage .paired-chart > .data-pagination,
  #output-stage .chart-data > .data-pagination { flex: 0 0 auto; padding-top: 6px; border-top: 1px solid var(--line); }
  .geography-analysis .comparison-card [data-page-viewport] { --page-row-height: 36; }
  .geography-analysis .comparison-card [data-page-viewport] tbody > tr { height: 36px; }
  .geography-analysis .comparison-card table { table-layout: fixed; width: 100%; }
  .geography-analysis .comparison-card th:first-child { width: 34%; }
  #result-panel-distribution .chart-data { display: flex; flex-direction: column; min-height: 0; }
  #result-panel-distribution .chart-data > .table-scroll { flex: 1 1 0; min-height: 0; }
  #result-panel-distribution .chart-data table { height: 100%; }
  #result-panel-distribution .chart-data thead { height: 30px; }
  #result-panel-distribution .chart-data caption { text-align: left; }
  /* The chart title already describes the table. Keep its caption available
     to assistive technology without adding a second table wrapper height. */
  #result-panel-distribution .chart-data caption { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); }
  #output-stage .poverty-detail > .detail-card { height: 100%; min-height: 0; grid-template-rows: auto minmax(0,1fr) auto; align-items: stretch; }
  #output-stage .poverty-detail .poverty-structure { display: flex; flex-direction: column; justify-content: space-evenly; gap: 12px; }
  #output-stage .poverty-detail .poverty-stack { height: clamp(22px,4dvh,38px); }
  #output-stage .poverty-detail .chart-data { display: flex; flex-direction: column; min-height: 0; grid-row: 1 / -1; }
  #output-stage .poverty-detail .chart-data .table-scroll { flex: 1; min-height: 0; }
  #output-stage .poverty-detail .chart-data table { height: 100%; }
  #output-stage .poverty-detail .chart-data thead { height: 30px; }
  .abm-report > .abm-data-card { height: 100%; min-height: 0; }
  .abm-report > .abm-data-card > .table-scroll { flex: 1 1 0; min-height: 0; }
  .abm-data-card [data-page-viewport] { --page-row-height: 30; }
  .abm-data-card [data-page-viewport] tbody > tr { height: 30px; }
  .abm-report > .abm-balance-grid { height: 100%; min-height: 0; align-items: stretch; grid-template-columns: minmax(0,1fr); }
  .abm-balance-card { height: 100%; min-height: 0; display: flex; }
  .abm-balance-card > .table-scroll { flex: 1 1 0; min-height: 0; }
  .abm-balance-card table { height: 100%; }
  .abm-balance-card thead { height: 28px; }
  .abm-balance-card td, .abm-balance-card th { padding-block: 3px; line-height: 1.3; }
  .dsge-data-card, .dsge-change-card { flex: 1 1 0; display: flex; flex-direction: column; min-height: 0; }
  .dsge-data-body { flex: 1 1 0; min-height: 0; --page-row-height: 44; }
  .dsge-data-body tbody > tr { height: 44px; }
  .dsge-welfare-grid > section { display: flex; flex-direction: column; min-height: 0; }
  .dsge-component-card table { flex: 1; }
  .dsge-component-card thead { height: 28px; }
  .dsge-effect-card .effect-list { flex: 1; min-height: 0; display: grid; grid-auto-rows: minmax(0,1fr); align-items: center; }
  .methodology-report { height: calc(100% - 8px); display: flex; flex-direction: column; min-height: 0; }
  .methodology-layout { flex: 1; align-items: stretch; }
  .methodology-layout .method-grid { align-content: space-evenly; }
  .methodology-layout .method-provenance { align-content: space-evenly; }
}
@media (min-width: 1081px) and (max-width: 1200px) and (min-height: 650px) {
  #abm-panel-sectors table { width: 100%; table-layout: fixed; white-space: normal; }
  #abm-panel-sectors th:first-child { width: 25%; }
  #abm-panel-sectors th, #abm-panel-sectors td { padding-inline: 4px; font-size: 11px; overflow-wrap: anywhere; }
  #abm-panel-sectors td { white-space: nowrap; }
  .dsge-effect-card .effect-row { min-height: 0; padding-block: 2px; grid-template-columns: minmax(0,1fr) minmax(14px,.3fr) 46px; gap: 6px; font-size: 11px; line-height: 1.3; }
}
@media (min-width: 1081px) and (min-height: 650px) and (max-height: 740px) {
  .abm-balance-card td, .abm-balance-card th { padding-block: 2px; }
}
@media (min-width: 1081px) and (min-height: 850px) {
  #output-stage .budget-detail, #output-stage .inequality-detail {
    grid-template-columns: minmax(260px,.95fr) minmax(0,1.65fr);
    grid-template-rows: auto minmax(0,1fr);
    gap: 10px;
  }
  #output-stage .budget-detail > .detail-card:nth-of-type(1),
  #output-stage .inequality-detail > .detail-card:nth-of-type(1) { grid-column: 1; grid-row: 1; }
  #output-stage .budget-detail > .detail-card:nth-of-type(2),
  #output-stage .inequality-detail > .detail-card:nth-of-type(2) { grid-column: 1; grid-row: 2; }
  #output-stage .budget-detail > .detail-table-card,
  #output-stage .inequality-detail > .gini-data-card { grid-column: 2; grid-row: 1 / -1; }
  #output-stage .budget-detail .pair-row { min-height: 44px; display: grid; grid-template-columns: minmax(100px,1fr) minmax(0,1.4fr); gap: 8px; align-items: center; }
  #output-stage .budget-detail .pair-list { --page-row-height: 44; }
  #output-stage .budget-detail > .detail-card:nth-of-type(1) .paired-chart,
  #output-stage .budget-detail > .detail-card:nth-of-type(1) .pair-list { flex: 0 0 auto; }
  #output-stage .inequality-detail .gini-score { gap: 4px 12px; margin-top: 4px; padding-top: 4px; }
  #output-stage .inequality-detail .gini-score .score-main { grid-template-columns: max-content max-content; column-gap: 8px; }
  #output-stage .inequality-detail .gini-score .score-main > span:first-child { grid-column: 1 / -1; }
  #output-stage .inequality-detail > .detail-card:first-of-type > .viz-header { gap: 6px; }
  #output-stage .inequality-detail .gini-score .gini-track { margin-block: 10px; }
  #output-stage .inequality-detail > .detail-card:first-of-type > .pair-legend { margin-top: 4px; }
}

/* LPAS and CEPM share the platform identity; preserve both original logo files. */
.sidebar > .co-brand { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 0 16px; }
.partner-logos { display: grid; grid-template-columns: minmax(0,1fr) 1px minmax(0,1fr); align-items: center; gap: 8px; width: 100%; height: 48px; }
.sidebar > .co-brand .partner-logos img { display: block; width: 100%; max-width: 100%; height: 44px; object-position: center; mix-blend-mode: darken; }
.sidebar > .co-brand .partner-logos .lpas-logo { object-fit: cover; }
.sidebar > .co-brand .partner-logos .cepm-logo { object-fit: contain; }
.partner-divider { height: 28px; background: var(--line); }
.brand-caption { color: var(--primary); font-size: 11px; font-weight: 600; letter-spacing: .06em; line-height: 1.3; }
.co-brand:hover { text-decoration: none; }
.contact-partner-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (min-width: 1081px) and (max-height: 740px) {
  .sidebar > .co-brand { gap: 3px; padding-bottom: 10px; }
  .sidebar > .co-brand .partner-logos { height: 40px; }
  .sidebar > .co-brand .partner-logos img { height: 38px; }
}
@media (max-width: 1080px) {
  .sidebar > .co-brand { width: 190px; margin: 0; padding: 0; border: 0; gap: 0; }
  .sidebar > .co-brand .partner-logos { height: 34px; }
  .sidebar > .co-brand .partner-logos img { height: 34px; }
  .sidebar > .co-brand .brand-caption { font-size: 10px; }
  .partner-divider { height: 24px; }
}
