:root {
  color-scheme: light;
  --bg: #103a63;
  --surface: #ffffff;
  --surface2: #f5f9ff;
  --border: #c7d8e8;
  --text: #142d46;
  --muted: #526c85;
  --blue: #1769aa;
  --blue2: #2f86cf;
  --blue-light: #e5f1fc;
  --navy: #0d2d4d;
  --gold: #9a6900;
  --red: #b54747;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
/* Release history and the shared current-version link. */
body:has(.version-badge) { padding-bottom: 64px; }
.version-badge { position: fixed; right: max(16px,env(safe-area-inset-right)); bottom: max(14px,env(safe-area-inset-bottom)); z-index: 6; padding: 8px 13px; border: 1px solid #8ab3d4; border-radius: 8px; background: #0c3154; color: #f4f8fc; font-size: 12px; font-weight: 600; text-decoration: none; box-shadow: 0 3px 12px #071e3440; }
.version-badge:hover { background: #174c79; }
.version-badge:focus-visible { outline: 3px solid #f0c05a; outline-offset: 3px; }
.updates-main { width: min(820px,calc(100% - 40px)); margin: 48px auto 32px; }
.updates-heading { margin-bottom: 32px; color: #e1edf7; }
.updates-heading img { object-fit: contain; margin-bottom: 18px; }
.updates-heading .eyebrow { color: #b9d9f4; }
.updates-heading h1 { margin: 10px 0; color: #fff; font-size: clamp(30px,5vw,44px); }
.updates-heading p { line-height: 1.7; }
.release-card { padding: clamp(22px,4vw,36px); margin-bottom: 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: 0 12px 32px #071e3530; }
.release-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.release-version { font-weight: 700; color: var(--navy); font-size: 17px; }
.release-current { padding: 5px 9px; background: var(--blue-light); color: var(--navy); border-radius: 6px; font-size: 11px; }
.release-card h2 { margin: 24px 0 12px; font-size: 24px; }
.release-card h3 { margin-top: 24px; font-size: 14px; }
.release-card p,.release-card li { line-height: 1.75; }
.release-card ul { padding-left: 22px; }
.release-card li + li { margin-top: 8px; }
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(ellipse at 48% -30%, #28618f 0, transparent 48%), var(--bg); color: var(--text); font: 14px var(--sans); min-width: 330px; }
#particles { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
.topbar { height: 70px; padding: 0 max(24px,calc((100% - 1440px)/2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: #0c3154; color: #f4f8fc; position: sticky; top: 0; z-index: 5; backdrop-filter: blur(12px); box-shadow: 0 2px 12px #071e3470; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-logo { display: block; width: 42px; height: 42px; object-fit: contain; flex: 0 0 42px; }
.brand strong { font: 700 14px var(--display); letter-spacing: .09em; color: #ffffff; }
.brand small { display: block; color: #c4d8e9; font: 9px var(--mono); letter-spacing: .07em; margin-top: 3px; }
.clock,.clock-actions { display: flex; align-items: center; gap: 12px; }
.clock { font: 11px var(--mono); color: #c4d8e9; }
.clock b { font-size: 14px; color: #a9d5ff; padding-left: 8px; }
.live-dot,.live-label i { width: 7px; height: 7px; background: #21864b; border-radius: 50%; box-shadow: 0 0 8px #21864b48; }
.button,select { border: 1px solid #cbd9e8; border-radius: 6px; background: white; color: var(--text); padding: 8px 11px; font: 11px var(--sans); cursor: pointer; text-decoration: none; }
.menu-btn { font-weight: 650; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.button:hover,select:hover { border-color: var(--blue2); background: #f3f8fe; }
.button:focus-visible,select:focus-visible,input:focus-visible { outline: 2px solid #368bd0; outline-offset: 2px; }
.button.primary { background: var(--blue); color: white; border-color: var(--blue); font-weight: 700; }
.button.primary:hover { background: #0f578f; }
.button.danger { color: var(--red); }
.speed { font: 10px var(--mono); color: #d0e0ee; }
.speed select { margin-left: 5px; padding: 6px; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; margin: 31px 0 21px; color: #f4f8fc; }
.hero-row .eyebrow { color: #d0e2f2; }
.hero-row .eyebrow span { color: #a9d5ff; }
.hero-row h1 { color: #ffffff; }
.hero-row h1 span { color: #b9d9f4; }
.hero-row .muted { color: #deebf6; }
.diagnostics-link { margin-top: 12px; background: #f4f8fc; color: var(--navy); border-color: #a9c5dc; font-weight: 650; }
.diagnostics-link:hover { background: #e2f0fc; }
#replay-heading { scroll-margin-top: 88px; }
.eyebrow { font: 10px var(--mono); letter-spacing: .08em; color: #526d88; }
.hero-row .eyebrow span { margin-left: 9px; color: #a9d5ff; }
h1,h2,h3,p { margin: 0; }
h1 { font: 650 36px var(--display); letter-spacing: -.04em; margin: 6px 0; color: #163b60; }
h1 span { color: #6485a7; }
h2 { font: 650 17px var(--display); margin-top: 4px; color: #1a3c5e; }
.muted { color: var(--muted); font-size: 12px; }
.baseline-badge { display: flex; align-items: center; gap: 10px; border: 1px solid #d6c38b; background: #fff9e8; padding: 10px 13px; border-radius: 7px; }
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: #bf8a16; }
.baseline-badge b,.baseline-badge small { display: block; }
.baseline-badge b { font: 10px var(--mono); color: #775600; }
.baseline-badge small { font-size: 10px; color: #7b6d46; margin-top: 4px; }
.kpis { display: grid; grid-template-columns: repeat(6,1fr); gap: 10px; margin-bottom: 15px; }
.kpi { border: 1px solid var(--border); background: linear-gradient(145deg,#fff,#f6faff); border-radius: 8px; padding: 12px 14px; min-height: 84px; box-shadow: 0 2px 8px #24486a08; }
.kpi .label { font: 9px var(--mono); letter-spacing: .035em; color: var(--muted); text-transform: uppercase; }
.kpi .value { font: 650 21px var(--display); margin-top: 8px; color: #163b60; }
.kpi .unit { font: 10px var(--mono); color: #657e97; margin-left: 5px; }
.layout { display: grid; grid-template-columns: minmax(310px,.77fr) minmax(480px,1.55fr); gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 17px; box-shadow: 0 3px 12px #26486a0a; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading select { font-size: 10px; }
.map-wrap { position: relative; margin-top: 13px; background: #eaf4fc; border: 1px solid #d2e4f3; border-radius: 7px; overflow: hidden; }
.world-map { width: 100%; height: auto; display: block; min-height: 196px; }
.country-shape { fill: #d4e5f2; stroke: #fff; stroke-width: .12; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .14s ease; }
.country-shape:hover { fill: #9ec6e5; }
.country-shape.partner { fill: #a8cce8; }
.country-shape.finland { fill: #1769aa; stroke: #fff; stroke-width: .28; }
.country-shape.selected { fill: #f0b94f; }
.country-shape.finland.selected { fill: #1769aa; }
.trade-line { stroke: #1769aa; stroke-width: .24; stroke-dasharray: 1 1.1; fill: none; opacity: .58; vector-effect: non-scaling-stroke; pointer-events: none; }
.map-legend { display: flex; gap: 12px; position: absolute; left: 12px; bottom: 9px; color: #385875; font: 9px var(--mono); background: #ffffffdd; border: 1px solid #dbe7f0; border-radius: 4px; padding: 5px 7px; }
.map-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }
.legend-fin { background: var(--blue); }.legend-partner { background: #81afd5; }.legend-link { background: #3f88c0; }
.map-note { position: absolute; right: 10px; bottom: 9px; color: #47627d; font: 8px var(--mono); background: #ffffffdd; padding: 5px; border-radius: 4px; }
.country-card { display: flex; align-items: center; gap: 11px; margin-top: 11px; padding: 10px; border: 1px solid #d1e1ef; border-radius: 7px; background: #f7fbff; }
.country-icon { height: 34px; width: 38px; display: grid; place-items: center; border-radius: 5px; background: #dceeff; color: #174c7b; font: 700 13px var(--mono); }
.country-info { flex: 1; }.country-info h3,.selected-country h3 { font: 650 15px var(--display); margin: 3px 0; color: #1a3c5e; }
.country-info p,.selected-country p { color: var(--muted); font-size: 10px; }.country-info .eyebrow { font-size: 8px; }.country-card .button { white-space: nowrap; }
.selected-country { padding: 11px 2px 0; display: none; }.selected-country.visible { display: block; }.trade-meter { font: 10px var(--mono); color: var(--blue); margin-top: 7px; }
.chart-tools { display: flex; gap: 9px; color: var(--muted); font: 10px var(--mono); }.chart-tools label { display: flex; align-items: center; gap: 4px; }.chart-tools input { width: 108px; padding: 5px; border: 1px solid var(--border); border-radius: 4px; background: white; color: var(--text); font: 10px var(--mono); }
.chart-selectors { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: 15px 0 8px; }
.series-chip { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; max-width: 100%; padding: 7px 10px; border: 1px solid #ccdbea; border-radius: 6px; background: #f8fbff; font: 500 11px/1.25 var(--sans); letter-spacing: 0; white-space: nowrap; color: #294761; cursor: pointer; }
.series-chip:hover { border-color: #75a9d3; background: #edf6fe; }.series-chip:has(input:checked) { border-color: #83add1; background: #eaf4fd; color: #174d7c; }
.series-chip input { accent-color: var(--blue); width: 13px; height: 13px; margin: 0; flex: none; }
.chart-area { border: 1px solid #d7e3ee; border-radius: 6px; background: #fbfdff; padding: 10px 10px 7px; }
.chart-title { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: #294761; padding: 1px 5px 3px; }.chart-title span { font: 9px var(--mono); color: var(--muted); }
#chart { display: block; width: 100%; height: 250px; overflow: visible; }.chart-grid { stroke: #e2ecf5; stroke-width: 1; stroke-dasharray: 2 2; }.chart-axis { fill: #263f58; font: 11px var(--mono); font-weight: 500; }.chart-line { fill: none; stroke-width: 2.15; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 3px 5px 0; font-size: 10px; color: #38536c; }.chart-legend i { width: 8px; height: 3px; display: inline-block; vertical-align: middle; margin-right: 5px; }
.chart-foot { display: flex; justify-content: space-between; color: #62778d; font: 8px var(--mono); padding: 8px 2px 0; }
.lower-grid { display: grid; grid-template-columns: minmax(460px,1.4fr) minmax(310px,.8fr); gap: 14px; margin-top: 14px; }.live-label { font: 9px var(--mono); color: #476a89; }.live-label i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; }
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 22px; margin-top: 12px; }.control-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 9px 1px; border-bottom: 1px solid #e7edf3; }
.control-row b { display: block; font-size: 11px; font-weight: 600; }.control-row small { display: block; font-size: 9px; color: var(--muted); margin-top: 3px; }.control-row em { font-style: normal; color: #54728d; }.control-row input { grid-column: 1/2; width: 100%; accent-color: var(--blue); height: 12px; }.control-row output { grid-column: 2; grid-row: 1/3; min-width: 58px; text-align: right; color: var(--blue); font: 11px var(--mono); }
.assumption-note { margin-top: 13px; padding: 10px; background: #fff8e8; border: 1px solid #ead9aa; border-radius: 6px; color: #635736; font-size: 9px; line-height: 1.55; }.assumption-note b { color: #765b18; margin-right: 5px; }
.status-tag { font: 8px var(--mono); color: #526d88; border: 1px solid var(--border); padding: 5px 7px; border-radius: 4px; }.sector-list { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px 13px; }
.sector { padding: 6px 0; border-bottom: 1px solid #e7edf3; }.sector-top { display: flex; justify-content: space-between; font-size: 9px; }.sector-top span:last-child { font: 9px var(--mono); color: #216aa8; }.bar { height: 3px; background: #e3edf6; margin-top: 5px; border-radius: 3px; overflow: hidden; }.bar i { height: 100%; display: block; background: linear-gradient(90deg,#3d8ccc,#83b5df); }
.events-heading { display: flex; justify-content: space-between; margin: 15px 0 5px; color: #526d88; font-size: 10px; }.event-list { max-height: 115px; overflow: auto; }.event { border-left: 1px solid #4b91c6; margin: 7px 0; padding-left: 8px; font-size: 9px; color: #38536c; }.event time { font: 8px var(--mono); color: #71869a; display: block; margin-bottom: 2px; }
footer { display: flex; justify-content: space-between; color: #d0e0ee; font: 8px var(--mono); padding: 18px 2px 25px; }footer i { font-style: normal; color: #b9d9f4; margin-left: 8px; }
@media(max-width:1050px) { .kpis { grid-template-columns: repeat(3,1fr); }.layout { grid-template-columns: 1fr; }.lower-grid { grid-template-columns: 1fr; }.world-map { min-height: 240px; }.topbar { padding: 0 18px; }.clock-actions { gap: 5px; } }
@media(max-width:650px) { .topbar { height: auto; min-height: 64px; flex-wrap: wrap; padding: 10px 13px; gap: 8px; }.brand strong { font-size: 11px; }.clock { font-size: 9px; }.clock-actions { width: 100%; justify-content: space-between; }.button { padding: 7px; }.hero-row { align-items: flex-start; flex-direction: column; gap: 12px; margin-top: 20px; }h1 { font-size: 30px; }.baseline-badge { width: 100%; }.kpis { grid-template-columns: repeat(2,1fr); }.layout,.lower-grid { display: block; }.layout>.panel,.lower-grid>.panel { margin-bottom: 12px; }.controls-grid { grid-template-columns: 1fr; }.chart-tools { flex-direction: column; gap: 4px; }.chart-foot { flex-direction: column; gap: 4px; }.map-note { right: 5px; bottom: 5px; font-size: 7px; }.map-legend { left: 5px; bottom: 5px; gap: 6px; font-size: 7px; }.country-card { flex-wrap: wrap; }.country-card .button { margin-left: 49px; }.world-map { min-height: 195px; }footer { gap: 7px; flex-direction: column; } }

.replay-panel { margin-top: 14px; }
.replay-description { margin-top: 10px; color: var(--muted); font-size: 11px; }
.replay-series-label { color: var(--muted); font-size: 10px; display: flex; align-items: center; gap: 7px; }
.replay-controls { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin: 13px 0 8px; color: #38536c; font-size: 10px; }
.replay-controls input { width: 100%; accent-color: var(--blue); }
.replay-controls output { min-width: 70px; text-align: right; color: var(--blue); font: 11px var(--mono); }
.replay-chart-wrap { border: 1px solid #d7e3ee; border-radius: 6px; background: #fbfdff; padding: 8px; }
#replay-chart { display: block; width: 100%; height: 230px; }
.replay-grid { stroke: #e2ecf5; stroke-width: 1; stroke-dasharray: 2 2; }
.replay-axis { fill: #263f58; font: 10px var(--mono); }
.replay-area-observed, .replay-area-simulated { pointer-events: none; }
.replay-line-observed { fill: none; stroke: #1769aa; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.replay-line-simulated { fill: none; stroke: #dc8b38; stroke-width: 2.15; stroke-dasharray: 5 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.replay-anchor-line { stroke: #64748b; stroke-width: 1.15; stroke-dasharray: 3 3; opacity: 0.78; vector-effect: non-scaling-stroke; }
.replay-cursor { stroke: #bd5660; stroke-width: 1.5; stroke-dasharray: 3 3; }
.replay-legend { display: flex; gap: 16px; color: #38536c; font-size: 10px; padding: 3px 2px; }

.fan-panel { margin-top: 14px; }
#fan-chart { display: block; width: 100%; height: 230px; }
.fan-band-outer { fill: #1769aa1f; pointer-events: none; }
.fan-band-inner { fill: #1769aa3d; pointer-events: none; }
.fan-median { fill: none; stroke: #1769aa; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.fan-endpoint { fill: #ffffff; stroke: #1769aa; stroke-width: 2; pointer-events: none; }
.fan-grid { stroke: #e2ecf5; stroke-width: 1; stroke-dasharray: 2 2; }
.fan-axis { fill: #263f58; font: 10px var(--mono); }
.replay-legend .fan-key-outer { background: #1769aa3d; display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 5px; }
.replay-legend .fan-key-inner { background: #1769aa66; display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 5px; }
.replay-legend .fan-key-median { background: #1769aa; display: inline-block; width: 12px; height: 2px; border-radius: 1px; margin-right: 5px; }
.replay-legend i { display: inline-block; width: 16px; border-top: 2px solid #1769aa; vertical-align: middle; margin-right: 5px; }
.replay-legend .sim-key { border-color: #dc8b38; border-top-style: dashed; }
.replay-readout { margin-top: 9px; padding: 10px 12px; border: 1px solid #d6e3ef; background: #f5f9ff; border-radius: 6px; font-size: 11px; color: #294761; }
.replay-readout strong { color: #163b60; }
.replay-provenance { margin-top: 7px; color: #62778d; font: 9px/1.5 var(--mono); overflow-wrap: anywhere; }
@media(max-width:650px) { .replay-controls { grid-template-columns: 1fr auto; gap: 6px; }.replay-controls input { grid-column: 1 / -1; grid-row: 2; }.replay-series-label { font-size: 9px; } #replay-chart { height: 205px; } }

.fiscal-details { margin: 12px 0 2px; padding: 11px 12px; border: 1px solid #c9d9e8; border-radius: 8px; background: #f8fbff; }.fiscal-details summary { cursor: pointer; color: var(--blue); font-size: 11px; font-weight: 700; }.fiscal-details summary span { margin-left: 8px; color: var(--muted); font-size: 9px; font-weight: 400; }.fiscal-note,.fiscal-source-note { color: var(--muted); font-size: 9px; line-height: 1.55; }.fiscal-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }.fiscal-columns h3 { margin: 8px 0; color: #254e72; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }.fiscal-row { display: grid; grid-template-columns: 1fr minmax(90px,35%) 42px; align-items: center; gap: 7px; padding: 6px 0; border-top: 1px solid #e1e9f1; }.fiscal-row b { display: block; font-size: 9px; }.fiscal-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }.fiscal-row output { color: #294f73; font: 9px var(--mono); text-align: right; }.fiscal-row input { width: 100%; accent-color: var(--blue); }.fiscal-row em { color: var(--blue); font: normal 9px var(--mono); text-align: right; }.fiscal-source-note { margin-top: 8px; padding-top: 7px; border-top: 1px dashed #c9d9e8; }
@media(max-width:650px) { .fiscal-columns { grid-template-columns: 1fr; gap: 5px; }.fiscal-details summary span { display: block; margin: 4px 0 0; }.fiscal-row { grid-template-columns: 1fr minmax(70px,30%) 36px; } }

.sector-accounts-details { margin-top: 8px; }.sector-account-summary { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }.sector-account-summary span,.sector-flow-balances span { padding: 5px 7px; border-radius: 5px; background: #edf4fb; color: #395b7b; font-size: 8px; }.sector-account-summary b { color: #1769aa; font-family: var(--mono); }.sector-flow-balances { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; }.sector-flow-balances span { display: flex; justify-content: space-between; gap: 5px; text-transform: capitalize; }.sector-flow-balances em { white-space: nowrap; color: #1769aa; font: normal 8px var(--mono); }
@media(max-width:650px) { .sector-flow-balances { grid-template-columns: repeat(2,minmax(0,1fr)); } }

.home-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; position: relative; z-index: 1; }
.home-main { width: min(100%, 700px); padding: 36px 0; color: #f4f8fc; animation: fadeUp .8s ease-out both; }
.home-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 48px; color: #fff; font: 700 12px var(--sans); letter-spacing: .12em; }
.home-brand img { width: 42px; height: 42px; object-fit: contain; }
.home-main > .eyebrow { color: #afd3f1; }
.home-main h1 { color: #fff; font-size: clamp(32px,6vw,46px); margin: 10px 0; }
.home-main .home-title { width: min(80vw, 480px); aspect-ratio: 1; height: auto; margin: 0 auto 18px; overflow: hidden; background: transparent; animation: fadeIn 1.2s ease-out both; }
.home-title img { display: block; width: 100%; height: 100%; object-fit: contain; animation: fadeIn 1.2s ease-out both, floatLogo 6s ease-in-out infinite 1.2s; }
.home-main .home-prompt { margin: 10px 0; color: #fff; font-size: clamp(21px,4vw,28px); animation: fadeUp .8s ease-out .3s both; }
.home-intro { max-width: 590px; color: #d6e5f1; line-height: 1.65; font-size: 14px; animation: fadeUp .8s ease-out .4s both; }
.home-options { animation: fadeUp .8s ease-out .5s both; }
.home-option { transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.home-option:hover { transform: translateX(6px); box-shadow: 0 4px 24px #071e3540; }
.home-option:nth-child(1) { animation: fadeUp .6s ease-out .55s both; }
.home-option:nth-child(2) { animation: fadeUp .6s ease-out .65s both; }
.home-option:nth-child(3) { animation: fadeUp .6s ease-out .75s both; }
.home-option:nth-child(4) { animation: fadeUp .6s ease-out .85s both; }
.home-arrow { transition: transform .25s ease; }
.home-option:hover .home-arrow { transform: translateX(4px); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatLogo { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.home-main > .eyebrow { color: #afd3f1; animation: fadeUp .8s ease-out .2s both; }
.home-options { display: grid; gap: 12px; margin-top: 30px; }
.home-option { min-height: 90px; display: grid; grid-template-columns: 44px 1fr auto; gap: 15px; align-items: center; padding: 17px; border: 1px solid #6d8fac; border-radius: 10px; background: #ffffff; color: #173957; text-decoration: none; box-shadow: 0 5px 18px #071e3428; transition: transform .15s ease,border-color .15s ease; }
.home-option:hover { transform: translateY(-2px); border-color: #9dccf2; }
.home-option:focus-visible,.back-link:focus-visible { outline: 3px solid #f0c05a; outline-offset: 3px; }
.home-option-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; background: #e6f2fc; color: #1769aa; font-size: 22px; }
.home-option-icon img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.home-option strong,.home-option small { display: block; }
.home-option strong { font-size: 16px; }
.home-option small { margin-top: 5px; color: #526c85; font-size: 11px; line-height: 1.4; }
.home-arrow { padding: 0 5px; color: #1769aa; font-size: 20px; }
.database-main { width: min(100%, 700px); }
.database-main .home-brand { margin: 28px 0 38px; }
.back-link { color: #d6e5f1; text-decoration: none; font-size: 12px; }
.database-status { display: flex; gap: 13px; margin-top: 28px; padding: 18px; border: 1px solid #7b9bb6; border-radius: 9px; background: #ffffff; color: #173957; }
.database-status-mark { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #e6f2fc; color: #1769aa; font-weight: 700; }
.database-status h2,.database-sections h2 { margin: 0 0 7px; color: #173957; font-size: 15px; }
.database-status p,.database-sections li { color: #526c85; font-size: 12px; line-height: 1.6; }
.database-sections { margin-top: 24px; padding: 18px; border-radius: 9px; background: #fff; }
.database-sections ul { margin: 9px 0 0; padding-left: 20px; }
.database-note { margin-top: 16px; color: #d6e5f1; font-size: 11px; line-height: 1.6; }
@media(max-width:520px) { .home-main { padding: 20px 0; }.home-brand { margin-bottom: 36px; }.home-main .home-title { margin-bottom: 24px; letter-spacing: 0; }.home-option { grid-template-columns: 38px 1fr auto; gap: 11px; padding: 13px; }.home-option-icon { width: 36px; height: 36px; }.home-option small { font-size: 10px; } }

.database-main { width: min(100%, 920px); }
.database-browser,.db-politics { margin-top: 18px; }
.db-section-heading,.db-detail-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.database-sections .db-section-heading h2,.database-sections h2 { margin:2px 0 0; font-size:18px; }
.db-section-heading .eyebrow { margin:0; }
.db-count,.db-series-item small { color:#617990; font-size:10px; }
.db-help { margin-top:9px; color:#526c85; font-size:11px; line-height:1.6; }
.db-series-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:8px; margin-top:14px; }
.db-series-item { display:flex; flex-direction:column; align-items:flex-start; gap:6px; padding:13px; border:1px solid #d4e1ed; border-radius:7px; background:#f8fbff; color:#173957; text-align:left; cursor:pointer; }
.db-series-item:hover,.db-series-item:focus-visible { border-color:#75a9d3; background:#edf6fe; }
.db-series-item strong { font-size:12px; line-height:1.4; }
.db-series-item span { color:#526c85; font-size:10px; }
.db-empty { margin:12px 0 2px; padding:11px; border:1px dashed #bdcfdf; border-radius:6px; color:#526c85; font-size:11px; line-height:1.5; }
.db-detail { margin-top:14px; padding:15px; border:1px solid #b9d0e4; border-radius:8px; background:#f9fcff; color:#173957; }
.db-detail[hidden] { display:none; }
.db-detail-heading h3 { margin-top:4px; font-size:16px; }
.db-definition { margin:12px 0; color:#405d78; font-size:11px; line-height:1.6; }
.db-metadata { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:8px; margin:12px 0; }
.db-metadata div { padding:8px; border-radius:5px; background:#edf4fb; overflow-wrap:anywhere; }
.db-metadata dt { color:#627a91; font-size:9px; }
.db-metadata dd { margin:4px 0 0; color:#254967; font-size:10px; }
.db-source { display:inline-block; margin:3px 0 12px; color:#1769aa; font-size:11px; }
.db-vintage-label { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:4px 0 10px; color:#385875; font-size:10px; }
.db-vintage-label select { max-width:100%; font-size:10px; }
.db-observations { width:100%; border-collapse:collapse; background:white; font-size:14px; border:1px solid #dce6ef; }
.db-observations th,.db-observations td { padding:10px 12px; border:1px solid #dce6ef; text-align:left; vertical-align:top; color:#142d46; }
.db-observations th { color:#173957; background:#edf4fb; font-weight:600; }
.db-observations tr:nth-child(even) { background:#f8fbff; }
.db-provenance { max-width:340px; color:#62778d; overflow-wrap:anywhere; }
.db-party { padding:8px 0; border-bottom:1px solid #e2eaf1; color:#38536c; font-size:11px; }

/* Party Accordion */
.party-accordion { border:1px solid #d4e1ed; border-radius:8px; background:#f8fbff; margin-bottom:10px; overflow:hidden; transition:box-shadow 0.2s; }
.party-accordion[open] { box-shadow:0 2px 8px rgba(23,105,170,0.12); }
.party-accordion-header { display:flex; align-items:center; gap:12px; padding:14px 16px; cursor:pointer; list-style:none; user-select:none; transition:background 0.2s; }
.party-accordion-header::-webkit-details-marker { display:none; }
.party-accordion-header:hover { background:#edf4fb; }
.party-header-left { display:flex; align-items:center; gap:12px; flex:1; min-width:0; }
.party-short-badge { background:#1769aa; color:#fff; padding:4px 10px; border-radius:6px; font-size:11px; font-weight:700; flex-shrink:0; }
.party-title-wrap { display:flex; flex-direction:column; gap:2px; min-width:0; }
.party-title-wrap strong { font-size:14px; color:#173957; }
.party-summary { font-size:12px; color:#62778d; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.party-founded { font-size:10px; color:#75a9d3; font-weight:600; }
.party-accordion-body { padding:0 16px 16px 16px; display:flex; flex-direction:column; gap:14px; }
.party-section { display:flex; flex-direction:column; gap:4px; }
.party-section-title { margin:0; font-size:12px; font-weight:700; color:#1769aa; text-transform:uppercase; letter-spacing:0.04em; }
.party-section-text { margin:0; font-size:13px; color:#385875; line-height:1.6; }
.party-policy-list, .party-rep-list { margin:4px 0 0; padding-left:20px; }
.party-policy-list li, .party-rep-list li { font-size:13px; color:#385875; line-height:1.6; margin:3px 0; }
.party-rep-list li { font-weight:500; }
.party-website-row { padding-top:4px; border-top:1px solid #e2eaf1; }
.party-website-link { font-size:13px; color:#1769aa; text-decoration:none; font-weight:600; }
.party-website-link:hover { text-decoration:underline; }
@media(max-width:650px) { .database-main { width:min(100%,920px); }.db-observations { display:block; overflow-x:auto; white-space:nowrap; }.db-provenance { max-width:200px; white-space:normal; }.db-detail { padding:11px; }.db-observations th,.db-observations td { padding:6px; } }

.db-provider-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); gap:9px; margin-top:12px; }
.db-provider { display:flex; flex-direction:column; gap:5px; padding:12px; border:1px solid #d4e1ed; border-radius:7px; background:#f8fbff; color:#254967; }
.db-provider strong { font-size:11px; }
.db-provider-status,.db-provider-attribution { color:#617990; font-size:9px; line-height:1.5; }
.db-provider .db-source { margin:0; font-size:10px; }

/* Source Accordion */
.source-accordion { border:1px solid #d4e1ed; border-radius:8px; background:#f8fbff; margin-bottom:8px; overflow:hidden; transition:box-shadow 0.2s; }
.source-accordion[open] { box-shadow:0 2px 8px rgba(23,105,170,0.12); }
.source-accordion-header { display:flex; align-items:center; gap:10px; padding:12px 14px; cursor:pointer; list-style:none; user-select:none; transition:background 0.2s; }
.source-accordion-header::-webkit-details-marker { display:none; }
.source-accordion-header:hover { background:#edf4fb; }
.source-header-left { display:flex; align-items:center; gap:10px; flex:1; min-width:0; }
.source-status-badge { padding:3px 8px; border-radius:5px; font-size:10px; font-weight:600; flex-shrink:0; }
.source-status-verified { background:#2e7d32; color:#fff; }
.source-status-review_required { background:#f57c00; color:#fff; }
.source-status-case_by_case { background:#1565c0; color:#fff; }
.source-status-unknown { background:#9e9e9e; color:#fff; }
.source-title-wrap { display:flex; flex-direction:column; gap:2px; min-width:0; }
.source-title-wrap strong { font-size:13px; color:#173957; }
.source-licence { font-size:10px; color:#75a9d3; font-weight:600; }
.source-accordion-body { padding:0 14px 14px 14px; display:flex; flex-direction:column; gap:8px; }
.source-link { font-size:12px; color:#1769aa; text-decoration:none; font-weight:600; }
.source-link:hover { text-decoration:underline; }
.source-attribution { margin:0; font-size:11px; color:#62778d; line-height:1.5; }
.source-base-row { font-size:11px; color:#62778d; }
.source-base-link { color:#1769aa; text-decoration:none; }
.source-base-link:hover { text-decoration:underline; }

/* Representative Accordion & Henkilölähde API View */
.rep-toolbar { display:flex; flex-direction:column; gap:10px; margin-bottom:14px; padding:12px 14px; border:1px solid #d4e1ed; border-radius:8px; background:#f8fbff; }
.rep-search-row { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.rep-search-input { flex:1; min-width:220px; padding:8px 12px; border:1px solid #bfd3e6; border-radius:6px; background:#ffffff; color:#133556; font-size:13px; transition:border-color 0.2s, box-shadow 0.2s; }
.rep-search-input:focus { outline:none; border-color:#1769aa; box-shadow:0 0 0 3px rgba(23,105,170,0.14); }
.rep-filter-status { font-size:12px; color:#526c85; font-weight:600; white-space:nowrap; }
.rep-party-filter-bar { display:flex; flex-wrap:wrap; gap:6px; }
.rep-filter-btn { padding:5px 11px; border:1px solid #cde0f0; border-radius:6px; background:#ffffff; color:#2b4c6b; font-size:11px; font-weight:600; cursor:pointer; transition:all 0.15s; }
.rep-filter-btn:hover { background:#edf4fb; border-color:#75a9d3; color:#133556; }
.rep-filter-btn.active { background:#1769aa; border-color:#1769aa; color:#ffffff; }

.rep-accordion { border:1px solid #d4e1ed; border-radius:8px; background:#f8fbff; margin-bottom:8px; overflow:hidden; transition:box-shadow 0.2s, border-color 0.2s; }
.rep-accordion[open] { border-color:#8cb8de; box-shadow:0 3px 12px rgba(19,53,86,0.10); background:#ffffff; }
.rep-accordion-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px; cursor:pointer; list-style:none; user-select:none; transition:background 0.2s; }
.rep-accordion-header::-webkit-details-marker { display:none; }
.rep-accordion-header:hover { background:#edf4fb; }
.rep-accordion[open] .rep-accordion-header { background:#eef5fc; border-bottom:1px solid #d4e1ed; }
.rep-header-left { display:flex; align-items:center; gap:12px; flex:1; min-width:0; }
.rep-header-right { display:flex; align-items:center; gap:8px; flex-shrink:0; }
.rep-api-pill { font-size:11px; color:#385875; font-weight:600; font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; letter-spacing:0.01em; }

.rep-party-badge { background:#1769aa; color:#fff; padding:4px 9px; border-radius:5px; font-size:11px; font-weight:700; flex-shrink:0; min-width:44px; text-align:center; letter-spacing:0.03em; }
.rep-party-kok { background:#00529b; }
.rep-party-ps { background:#1b4f72; }
.rep-party-sdp { background:#c92a2a; }
.rep-party-kesk { background:#1b7a3d; }
.rep-party-vihr { background:#2b8a3e; }
.rep-party-vas { background:#a61e4d; }
.rep-party-rkp { background:#b47d12; }
.rep-party-kd { background:#2b579a; }
.rep-party-liik { background:#7048e8; }
.rep-party-sit { background:#495057; }

.rep-title-wrap { display:flex; flex-direction:column; gap:3px; min-width:0; }
.rep-name-line { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.rep-title-wrap strong { font-size:14px; color:#133556; }
.rep-highlight-role { font-size:11px; color:#1769aa; font-weight:600; }
.rep-role-minister { color:#9c1f3d; font-weight:700; }
.rep-role { font-size:12px; color:#526c85; overflow:hidden; text-overflow:ellipsis; }

.rep-accordion-body { padding:16px; display:flex; flex-direction:column; gap:16px; background:#ffffff; }
.rep-profile-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(220px, 1fr)); gap:12px 18px; margin:0; padding:14px; border:1px solid #dfeaf4; border-radius:7px; background:#f8fbff; }
.rep-profile-cell { display:flex; flex-direction:column; gap:3px; min-width:0; }
.rep-profile-cell dt { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:#5e7891; margin:0; }
.rep-profile-cell dd { font-size:13px; font-weight:500; color:#133556; margin:0; line-height:1.4; word-break:break-word; }

.rep-columns-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(280px, 1fr)); gap:16px; }
.rep-column { display:flex; flex-direction:column; gap:14px; min-width:0; }
.rep-section { display:flex; flex-direction:column; gap:5px; }
.rep-section-title { margin:0; font-size:11px; font-weight:700; color:#1769aa; text-transform:uppercase; letter-spacing:0.05em; }
.rep-section-text { margin:0; font-size:12px; color:#62778d; }
.rep-detail-list, .rep-aff-list { margin:2px 0 0; padding-left:18px; }
.rep-detail-list li, .rep-aff-list li { font-size:12.5px; color:#2b4865; line-height:1.55; margin:4px 0; }
.rep-role-lead-text { color:#133556; font-weight:700; }
.rep-date-muted { color:#6c849c; font-size:11.5px; }

.rep-api-card { border:1px solid #c9dced; border-radius:7px; background:#f3f8fd; overflow:hidden; }
.rep-api-card-top { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px 14px; flex-wrap:wrap; }
.rep-api-meta-wrap { display:flex; flex-direction:column; gap:4px; min-width:0; flex:1; }
.rep-api-title-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.rep-api-method { background:#133556; color:#ffffff; font-size:10px; font-weight:700; padding:2px 6px; border-radius:4px; font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; letter-spacing:0.04em; }
.rep-api-endpoint { font-size:12px; font-weight:600; color:#133556; font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; background:#e3effa; padding:2px 7px; border-radius:4px; word-break:break-all; }
.rep-api-host { font-size:11px; color:#526c85; font-weight:500; }
.rep-api-prov-text { margin:0; font-size:11.5px; color:#4b6782; line-height:1.4; }

.rep-api-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.rep-api-btn { display:inline-flex; align-items:center; justify-content:center; padding:6px 12px; border:1px solid #b8d0e8; border-radius:6px; background:#ffffff; color:#1769aa; font-size:12px; font-weight:600; text-decoration:none; cursor:pointer; transition:all 0.15s; white-space:nowrap; }
.rep-api-btn:hover { background:#e6f1fb; border-color:#1769aa; color:#0f2942; text-decoration:none; }
.rep-api-btn-primary { background:#1769aa; border-color:#1769aa; color:#ffffff; }
.rep-api-btn-primary:hover { background:#12558a; border-color:#12558a; color:#ffffff; }
.rep-source-link { font-size:12px; color:#1769aa; text-decoration:none; font-weight:600; }
.rep-source-link:hover { text-decoration:underline; }

.rep-api-json-wrap { border-top:1px solid #c9dced; background:#0f2438; color:#e4effa; }
.rep-json-toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 14px; background:#142f47; border-bottom:1px solid #234766; }
.rep-json-label { font-size:11px; color:#9ec3e6; font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.rep-json-copy-btn { padding:4px 10px; border:1px solid #3c688f; border-radius:5px; background:#1b3f5e; color:#e4effa; font-size:11px; font-weight:600; cursor:pointer; transition:background 0.15s; }
.rep-json-copy-btn:hover { background:#27567e; }
.rep-api-json-pre { margin:0; padding:12px 14px; max-height:320px; overflow:auto; font-size:11.5px; line-height:1.5; font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; color:#d7ebff; white-space:pre-wrap; word-break:break-word; }

@media (max-width: 680px) {
  .rep-accordion-header { flex-direction:column; align-items:flex-start; gap:6px; }
  .rep-header-right { align-self:flex-start; padding-left:56px; }
  .rep-api-card-top { flex-direction:column; align-items:stretch; }
  .rep-api-actions { width:100%; }
  .rep-api-btn { flex:1 1 auto; text-align:center; }
}

/* Politics subsection divider */
.db-subsection { padding-bottom: 20px; }
.db-subsection-reps { border-top: 2px solid #d4e1ed; padding-top: 20px; margin-top: 8px; }

/* Tab Navigation */
.db-tabs { display: flex; gap: 4px; margin-top: 20px; border-bottom: 2px solid #d4e1ed; padding-bottom: 4px; }
.db-tab { padding: 10px 18px; border: none; background: transparent; color: #526c85; font-size: 12px; font-weight: 600; cursor: pointer; border-radius: 6px 6px 0 0; transition: all 0.2s; }
.db-tab:hover { background: #edf4fb; color: #1769aa; }
.db-tab.active { background: #1769aa; color: white; }
.db-tab:focus-visible { outline: 2px solid #1769aa; outline-offset: 2px; }

/* History Panel */
.db-history { margin-top: 18px; }
.history-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-bottom: 8px; border-bottom: 1px solid #d4e1ed; }
.history-period-btn { padding: 8px 14px; border: 1px solid #d4e1ed; background: #f8fbff; color: #385875; font-size: 11px; border-radius: 5px; cursor: pointer; transition: all 0.2s; }
.history-period-btn:hover { background: #edf4fb; border-color: #75a9d3; }
.history-period-btn.active { background: #1769aa; color: white; border-color: #1769aa; }
.history-content { margin-top: 16px; }
.history-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.history-card { padding: 16px; border: 1px solid #d4e1ed; border-radius: 8px; background: #f8fbff; }
.history-card h3 { margin: 0 0 8px; font-size: 13px; color: #173957; }
.history-card p { margin: 0; font-size: 14px; color: #526c85; line-height: 1.5; }
.history-table { width: 100%; font-size: 14px; }
.history-parties-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.history-party-card { border: 1px solid #d4e1ed; border-radius: 8px; background: #f8fbff; overflow: hidden; }
.party-card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px; background: #edf4fb; border-bottom: 1px solid #d4e1ed; }
.party-card-header h3 { margin: 0; font-size: 13px; color: #173957; }
.party-short { background: #1769aa; color: white; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.party-card-meta { padding: 14px; font-size: 14px; color: #385875; }
.party-card-meta p { margin: 6px 0; }
.party-card-meta strong { color: #173957; }
.policy-changes { margin: 8px 0 0; padding-left: 18px; }
.policy-changes li { margin: 4px 0; font-size: 10px; }
.policy-timeline, .full-timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-item { display: flex; gap: 16px; padding: 12px; border: 1px solid #d4e1ed; border-radius: 8px; background: #f8fbff; }
.timeline-year { flex: 0 0 70px; font-weight: 700; color: #1769aa; font-size: 12px; }
.timeline-content { flex: 1; font-size: 11px; color: #385875; }
.timeline-content strong { color: #173957; }

/* Statistics & Visualization Panel */
.db-statistics { margin-top: 18px; }
.stats-controls { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; padding: 16px; background: #f8fbff; border: 1px solid #d4e1ed; border-radius: 8px; align-items: flex-end; }
.stats-control-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.stats-control-group label { font-size: 10px; color: #526c85; font-weight: 600; }
.stats-control-group select { padding: 8px 10px; border: 1px solid #b9d0e4; border-radius: 5px; background: white; color: #173957; font-size: 11px; }
.stats-control-group select:focus { outline: 2px solid #1769aa; outline-offset: 1px; border-color: #1769aa; }
#stats-export { height: fit-content; margin-bottom: 2px; }
.stats-chart-container { position: relative; height: 400px; margin-top: 16px; background: white; border: 1px solid #d4e1ed; border-radius: 8px; padding: 16px; }
.stats-chart-container[hidden] { display: none; }
.stats-table-container { margin-top: 16px; }
.stats-table-container[hidden] { display: none; }
.stats-info { margin-top: 12px; padding: 12px; background: #edf4fb; border-radius: 6px; font-size: 11px; color: #385875; }
.stats-info p { margin: 0; line-height: 1.6; }

/* Velkakello page */
.velkakello-wrapper { max-width: 800px; margin: 0 auto; }
.velkakello-display { text-align: center; padding: 48px 24px; background: linear-gradient(135deg, #173957 0%, #1769aa 100%); border-radius: 16px; color: white; box-shadow: 0 4px 24px rgba(23,54,87,0.3); }
.velkakello-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.7); margin-bottom: 16px; }
.velkakello-amount { font-size: clamp(28px, 6vw, 56px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; text-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.velkakello-sub { margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.15); }
.velkakello-per-capita { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.velkakello-pc-label { font-size: 12px; color: rgba(255,255,255,0.6); }
.velkakello-pc-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; color: #ffcc00; }
.velkakello-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 20px; }
.velkakello-stat-card { padding: 16px; border: 1px solid #d4e1ed; border-radius: 8px; background: #f8fbff; text-align: center; }
.velkakello-stat-value { font-size: 20px; font-weight: 700; color: #173957; font-variant-numeric: tabular-nums; }
.velkakello-stat-label { font-size: 10px; color: #526c85; font-weight: 600; text-transform: uppercase; margin-top: 6px; letter-spacing: 0.05em; }
.velkakello-info { margin-top: 28px; }
.velkakello-info p { font-size: 14px; color: #385875; line-height: 1.7; margin: 12px 0; }
.velkakello-source { font-size: 11px; color: #526c85; margin-top: 16px; padding-top: 12px; border-top: 1px solid #d4e1ed; }
.velkakello-source a { color: #1769aa; text-decoration: none; }
.velkakello-source a:hover { text-decoration: underline; }

/* Vaalit page */
.vaalit-panel { margin-top: 18px; }
.vaalit-controls { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.vaalit-control-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.vaalit-control-group label { font-size: 10px; color: #526c85; font-weight: 600; }
.vaalit-control-group select { padding: 8px 10px; border: 1px solid #b9d0e4; border-radius: 5px; background: white; color: #173957; font-size: 11px; }
.vaalit-control-group select:focus { outline: 2px solid #1769aa; outline-offset: 1px; border-color: #1769aa; }
.vaalit-summary { margin-bottom: 16px; }
.vaalit-summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.vaalit-summary-card { padding: 16px; border: 1px solid #d4e1ed; border-radius: 8px; background: #f8fbff; }
.vaalit-card-label { font-size: 10px; color: #526c85; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.vaalit-card-value { font-size: 22px; font-weight: 700; color: #173957; }
.vaalit-chart-row { margin-bottom: 16px; }
.vaalit-chart-container { position: relative; height: 400px; background: white; border: 1px solid #d4e1ed; border-radius: 8px; padding: 16px; }
.vaalit-table-wrap { overflow-x: auto; }
.vaalit-table { width: 100%; font-size: 14px; }
.vaalit-table th { text-align: left; padding: 8px 12px; border-bottom: 2px solid #d4e1ed; color: #526c85; font-size: 11px; font-weight: 600; }
.vaalit-table td { padding: 8px 12px; border-bottom: 1px solid #eaf2f9; color: #173957; }
.vaalit-table tr:hover { background: #f8fbff; }
.vaalit-row-top { background: #edf4fb; }
.vaalit-row-top:hover { background: #e3eef8; }
.vaalit-row-top td:first-child { font-weight: 700; }
.vaalit-party-cell { display: flex; align-items: center; gap: 8px; }
.vaalit-color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.1); }
.vaalit-pct { font-weight: 700; color: #1769aa; }
.vaalit-source { margin-top: 14px; font-size: 11px; color: #526c85; }
.vaalit-source a { color: #1769aa; text-decoration: none; }
.vaalit-source a:hover { text-decoration: underline; }

/* Responsive — Mobile calibration for all pages */
@media(max-width: 650px) {
    /* Base: reduce body min-width and page padding */
    html { overflow-x: hidden; max-width: 100vw; }
    body { min-width: 320px; overflow-x: hidden; max-width: 100vw; }
    .home-page { padding: 16px 12px; overflow-x: hidden; display: block; }
    .home-main { padding: 16px 0; width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
    .database-main { width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
    .home-main h1 { font-size: 26px; }
    .home-intro { font-size: 13px; max-width: 100%; }

    /* Home nav options */
    .home-options { gap: 10px; }
    .home-option { min-height: 76px; grid-template-columns: 38px 1fr auto; gap: 11px; padding: 13px; }
    .home-option-icon { width: 36px; height: 36px; font-size: 18px; }
    .home-option strong { font-size: 14px; }
    .home-option small { font-size: 10px; }

    /* Database tabs */
    .db-tabs { flex-wrap: wrap; }
    .db-tab { flex: 1 1 auto; text-align: center; padding: 8px 10px; font-size: 11px; }

    /* Database sections */
    .database-status { flex-direction: row; padding: 14px; gap: 10px; }
    .database-status-mark { flex: 0 0 24px; width: 24px; height: 24px; }
    .database-status h2, .database-sections h2 { font-size: 14px; }
    .database-status p, .database-sections li { font-size: 11px; }
    .database-sections { padding: 14px; margin-top: 16px; }
    .db-detail { padding: 12px; }
    .db-observations { display: block; overflow-x: auto; white-space: nowrap; }
    .db-observations th, .db-observations td { padding: 6px; }
    .db-provenance { max-width: 200px; white-space: normal; }

    /* History */
    .history-nav { justify-content: center; }
    .history-period-btn { padding: 6px 10px; font-size: 10px; }
    .history-overview { grid-template-columns: 1fr; }
    .history-parties-grid { grid-template-columns: 1fr; }
    .full-timeline .timeline-item { flex-direction: column; gap: 4px; }
    .timeline-year { flex: 0 0 auto; }

    /* Statistics */
    .stats-controls { flex-direction: column; align-items: stretch; }
    .stats-control-group { width: 100%; min-width: unset; }
    .stats-chart-container { height: 280px; padding: 10px; }

    /* Vaalit page */
    .vaalit-panel { margin-top: 14px; max-width: 100%; overflow-x: hidden; }
    .vaalit-controls { flex-direction: column; gap: 10px; width: 100%; }
    .vaalit-control-group { width: 100%; min-width: unset; max-width: 100%; }
    .vaalit-control-group select { font-size: 13px; padding: 10px 12px; width: 100%; max-width: 100%; box-sizing: border-box; }
    .vaalit-summary-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .vaalit-summary-card { padding: 12px; }
    .vaalit-card-value { font-size: 18px; }
    .vaalit-chart-container { height: 300px; padding: 10px; max-width: 100%; box-sizing: border-box; }
    .vaalit-chart-row { max-width: 100%; overflow-x: hidden; }
    .vaalit-table-wrap { overflow-x: auto; max-width: 100%; }
    .vaalit-table { font-size: 13px; min-width: 320px; }
    .vaalit-table th { padding: 6px 8px; font-size: 10px; }
    .vaalit-table td { padding: 6px 8px; }
    .vaalit-party-cell { gap: 6px; }
    .vaalit-color-dot { width: 10px; height: 10px; }

    /* Velkakello page */
    .velkakello-wrapper { max-width: 100%; }
    .velkakello-display { padding: 28px 16px; border-radius: 12px; }
    .velkakello-label { font-size: 11px; margin-bottom: 10px; }
    .velkakello-amount { font-size: clamp(22px, 8vw, 36px); }
    .velkakello-sub { margin-top: 18px; padding-top: 16px; }
    .velkakello-pc-value { font-size: 22px; }
    .velkakello-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
    .velkakello-stat-card { padding: 12px; }
    .velkakello-stat-value { font-size: 16px; }
    .velkakello-stat-label { font-size: 9px; }
    .velkakello-info { margin-top: 20px; }
    .velkakello-info p { font-size: 13px; line-height: 1.6; }
    .velkakello-source { font-size: 10px; }
}

@media(max-width: 380px) {
    .home-page { padding: 12px 8px; }
    .home-main h1 { font-size: 22px; }
    .vaalit-summary-cards { grid-template-columns: 1fr; }
    .velkakello-stats { grid-template-columns: 1fr; }
    .velkakello-amount { font-size: 20px; }
    .velkakello-pc-value { font-size: 18px; }
    .db-tabs { flex-direction: column; }
    .db-tab { width: 100%; }
}

/* Collapsible Database Sections */
.db-collapsible { border: 1px solid #d4e1ed; border-radius: 9px; background: #fff; margin-bottom: 14px; overflow: hidden; transition: box-shadow 0.2s; }
.db-collapsible[open] { box-shadow: 0 2px 10px rgba(23,105,170,0.10); }
.db-collapsible-summary { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; cursor: pointer; list-style: none; user-select: none; transition: background 0.2s; }
.db-collapsible-summary::-webkit-details-marker { display: none; }
.db-collapsible-summary:hover { background: #f5f9ff; }
.db-collapsible-summary::after { content: ''; width: 7px; height: 7px; border-right: 2px solid #75a9d3; border-bottom: 2px solid #75a9d3; transform: rotate(-45deg); transition: transform 0.2s ease; flex-shrink: 0; margin-left: 12px; }
.db-collapsible[open] .db-collapsible-summary::after { transform: rotate(45deg); }
.db-collapsible-summary .db-section-heading { margin: 0; flex: 1; min-width: 0; }
.db-collapsible-body { padding: 0 18px 18px 18px; }
@media(max-width:650px) { .db-collapsible-summary { padding: 12px 14px; } .db-collapsible-body { padding: 0 14px 14px 14px; } }


/* Image-led home navigation */
.home-page { min-height: 100svh; padding: clamp(24px,5vh,56px) 24px; overflow-x: hidden; }
.home-main { width: min(100%, 1040px); padding: 0; }
.home-heading { display: grid; justify-items: center; gap: 18px; margin: 0 auto 34px; text-align: center; }
.home-mark { display: block; width: min(100%, 440px); height: auto; object-fit: contain; }
.home-heading-copy { max-width: 620px; }
.home-heading .eyebrow { margin-bottom: 8px; color: #b9d9f4; font-size: 10px; letter-spacing: .16em; }
.home-main .home-prompt { margin: 0; font-size: clamp(25px,4vw,38px); letter-spacing: -.035em; }
.home-intro { margin-top: 9px; color: #d6e5f1; font-size: 14px; }
.home-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-top: 0; }
.home-option { position: relative; display: block; min-height: 0; aspect-ratio: 1.48; overflow: hidden; padding: 0; border: 1px solid #83a7c4; border-radius: 16px; background: #f7fbff; color: #fff; box-shadow: 0 12px 32px #071e3540; isolation: isolate; }
.home-option::after { position: absolute; z-index: 1; inset: 30% 0 0; background: linear-gradient(transparent,#071e35e8 92%); content: ""; opacity: .74; transition: opacity .28s ease; }
.home-option-image { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .55s cubic-bezier(.2,.7,.2,1), filter .3s ease; }
.home-option-copy { position: absolute; z-index: 2; right: 58px; bottom: 24px; left: 24px; opacity: 0; transform: translateY(12px); transition: opacity .22s ease, transform .28s ease; }
.home-option-copy strong { display: block; color: #fff; font-size: clamp(20px,2.6vw,29px); line-height: 1.15; letter-spacing: -.025em; }
.home-option-copy small { display: block; max-width: 38ch; margin-top: 8px; color: #e1edf7; font-size: 13px; line-height: 1.5; }
.home-arrow { position: absolute; z-index: 2; right: 20px; bottom: 20px; display: grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 1px solid #ffffff80; border-radius: 50%; background: #ffffff1c; color: #fff; font-size: 20px; opacity: .8; transition: background .22s ease, transform .22s ease, opacity .22s ease; }
.home-option:hover,.home-option:focus-visible { transform: translateY(-3px); border-color: #b7ddfb; box-shadow: 0 18px 42px #071e3566; }
.home-option:hover::after,.home-option:focus-visible::after { opacity: 1; }
.home-option:hover .home-option-image,.home-option:focus-visible .home-option-image { transform: scale(1.045); filter: saturate(1.05); }
.home-option:hover .home-option-copy,.home-option:focus-visible .home-option-copy { opacity: 1; transform: translateY(0); }
.home-option:hover .home-arrow,.home-option:focus-visible .home-arrow { transform: translate(2px,-2px); background: #ffffff30; opacity: 1; }
.home-option:focus-visible { outline: 3px solid #f0c05a; outline-offset: 4px; }
.home-option:focus-visible .home-option-copy { transition-delay: .06s; }
@media(max-width:700px), (hover:none) {
  .home-page { padding: 24px 16px; }
  .home-heading { gap: 14px; margin-bottom: 24px; }
  .home-mark { width: min(100%, 350px); }
  .home-options { gap: 12px; }
  .home-option { aspect-ratio: 1.12; border-radius: 12px; }
  .home-option::after { inset: 20% 0 0; opacity: 1; }
  .home-option-copy { right: 12px; bottom: 14px; left: 14px; opacity: 1; transform: none; }
  .home-option-copy strong { font-size: clamp(16px,4vw,21px); }
  .home-option-copy small { margin-top: 5px; font-size: 11px; line-height: 1.35; }
  .home-arrow { right: 10px; bottom: auto; top: 10px; width: 30px; height: 30px; }
}
@media(max-width:420px) {
  .home-page { padding: 18px 12px; }
  .home-options { grid-template-columns: 1fr; gap: 12px; }
  .home-option { aspect-ratio: 1.65; }
}
@media(prefers-reduced-motion:reduce) {
  .home-main,.home-heading-copy,.home-options,.home-main > .eyebrow,.home-option,.home-option:nth-child(n),.home-option-image,.home-option-copy,.home-arrow { animation: none !important; transition: none !important; }
  .home-option:hover,.home-option:focus-visible { transform: none; }
  .home-option:hover .home-option-image,.home-option:focus-visible .home-option-image { transform: none; }
}

/* The artwork itself is the navigation control; do not frame it as a card. */
.home-options { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 28px; }
.home-option-item { position: relative; display: grid; justify-items: center; align-content: start; gap: 10px; min-width: 0; }
.home-option { display: block; width: min(100%,150px); min-height: 0; aspect-ratio: 1; overflow: visible; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; box-shadow: none; text-decoration: none; transform: none; animation: none; transition: none; }
.home-option:hover,.home-option:focus-visible { border: 0; background: transparent; box-shadow: none; transform: none; }
.home-option::after { content: none; }
.home-option-image { display: block; width: 100%; height: 100%; object-fit: contain; filter: none; transform: none; transition: none; }
.home-option:hover .home-option-image,.home-option:focus-visible .home-option-image { filter: none; transform: none; }
.home-option:focus-visible { outline: none; }
.home-option-copy { position: relative; inset: auto; display: block; justify-self: center; width: min(100%,250px); min-height: 4.8em; margin-inline: auto; opacity: 0; visibility: hidden; transform: translateY(8px); text-align: center; pointer-events: none; transition: opacity .2s ease,transform .2s ease,visibility .2s ease; }
.home-option-item:hover .home-option-copy,.home-option-item:focus-within .home-option-copy { opacity: 1; visibility: visible; transform: translateY(0); }
.home-option-copy strong { color: #fff; font-size: 18px; }
.home-option-copy small { margin-top: 5px; color: #d6e5f1; font-size: 12px; line-height: 1.45; }
@media(max-width:700px), (hover:none) {
  .home-options { gap: 20px; }
  .home-option { width: min(100%,145px); aspect-ratio: 1; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .home-option-copy { min-height: 4.8em; opacity: 1; visibility: visible; transform: none; }
}
@media(max-width:420px) {
  .home-options { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 10px; }
  .home-option { width: min(100%,125px); }
}
@media(prefers-reduced-motion:reduce) {
  .home-option-copy { transition: none; }
  .home-option-item:hover .home-option-copy,.home-option-item:focus-within .home-option-copy { transform: none; }
}

.seed-controls { display: flex; align-items: center; gap: 6px; }
.seed-input, #stochastic-seed { width: 92px; padding: 6px 8px; border: 1px solid #cbd9e8; border-radius: 6px; font: 11px var(--mono); }
.shock-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.shock-chip-label { font: 600 9px var(--sans); color: #54728d; letter-spacing: .05em; text-transform: uppercase; }
.shock-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border: 1px solid #ccdbea; border-radius: 6px; background: #f8fbff; font: 500 10px/1.2 var(--mono); color: #294761; }
.shock-chip.pos { border-color: #b9d8b4; background: #f1f8ee; color: #2f6b2a; }
.shock-chip.neg { border-color: #e2b4b4; background: #fdf2f0; color: #9c2f2f; }
.chart-follow { border-left: 1px solid var(--border); padding-left: 9px; white-space: nowrap; cursor: pointer; }
.chart-follow input { width: 13px; accent-color: var(--blue); }
.chart-trend-toggle { color: #92400e; font-weight: 600; }
.chart-trend-toggle input { accent-color: #d97706; }
.chart-trend-toggle:has(input:checked) { color: #b45309; background: #fffbeb; border-radius: 4px; padding: 3px 7px 3px 9px; border: 1px solid #fcd34d; }
.chart-overview { margin: 14px 0 7px; }
.chart-trend-legend-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 7px; border-radius: 4px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font: 600 9px var(--mono); }
.chart-trend-swatch { display: inline-block; width: 14px; height: 0; border-top: 2px dashed #b45309; }
.chart-groups { display: grid; gap: 12px; }
.chart-group { border: 1px solid #d7e3ee; border-radius: 6px; background: #fbfdff; padding: 10px; }
.chart-group h3 { margin: 0 0 8px; color: #294761; font: 650 12px var(--sans); }
.chart-group-series { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,340px),1fr)); gap: 8px; }
.chart-series { min-width: 0; border: 1px solid #e3ebf2; border-radius: 5px; background: white; padding: 6px 7px 2px; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.chart-series.has-trend-overlay { border-color: #cbd5e1; background: linear-gradient(180deg, #ffffff 0%, #fffdf9 100%); }
.chart-series h4 { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0 0 2px; color: #38536c; font: 550 10px var(--sans); flex-wrap: wrap; }
.chart-series-title-main { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.chart-series h4 i { width: 8px; height: 3px; flex: none; }
.chart-trend-badge { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 4px; font: 600 8.5px var(--mono); letter-spacing: -0.01em; border: 1px solid #e2e8f0; background: #f8fafc; color: #475569; white-space: nowrap; }
.chart-trend-badge.pos { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.chart-trend-badge.neg { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.chart-trend-line { fill: none; stroke: #b45309; stroke-width: 1.9; stroke-dasharray: 5 3.5; opacity: 0.92; vector-effect: non-scaling-stroke; pointer-events: none; }
.chart-trend-area { fill-opacity: 0.11; stroke: none; pointer-events: none; }
.chart-trend-endpoint { fill: #fffbeb; stroke: #b45309; stroke-width: 1.8; pointer-events: none; }
.group-chart { display: block; width: 100%; height: 180px; overflow: visible; }
@media(max-width:650px) { .chart-follow { border: 0; padding-left: 0; }.chart-series { overflow: hidden; }.group-chart { height: 165px; } }

.chart-empty { margin: 0; padding: 20px 10px; border: 1px dashed #ccdbea; border-radius: 6px; color: var(--muted); text-align: center; font-size: 11px; }
.chart-axis-line { stroke: #455b70; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.chart-axis-tick { stroke: #455b70; stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-time-label { fill: #263f58; font-size: 10px; }
.chart-area-fill { pointer-events: none; }
.chart-ref-line { stroke: #64748b; stroke-width: 1.15; stroke-dasharray: 4 3; opacity: 0.72; pointer-events: none; vector-effect: non-scaling-stroke; }
.chart-ref-line.chart-ref-target { stroke: #0d9488; opacity: 0.82; }
.chart-ref-line.chart-ref-zero { stroke: #475569; stroke-dasharray: 3 3; opacity: 0.75; }
.chart-ref-label { fill: #475569; font: 600 8.5px var(--mono); pointer-events: none; }
.chart-endpoint { fill: #ffffff; stroke-width: 2; pointer-events: none; }
.chart-hover-dot { fill: #ffffff; stroke-width: 2.2; opacity: 0; pointer-events: none; transition: opacity 0.1s ease; }
.chart-group.is-hovering .chart-hover-dot.is-active { opacity: 1; }
.chart-group { position: relative; }
.chart-crosshair { stroke: #263f58; stroke-width: 1.25; stroke-dasharray: 4 3; opacity: 0; pointer-events: none; vector-effect: non-scaling-stroke; }
.chart-group.is-hovering .chart-crosshair { opacity: .82; }
.chart-hover-tooltip { position: absolute; z-index: 4; top: 34px; right: 14px; max-width: min(360px, calc(100% - 28px)); padding: 8px 10px; border: 1px solid #9fb3c5; border-radius: 6px; background: #fffef7f5; box-shadow: 0 3px 12px #17395726; color: #263f58; font-size: 10px; pointer-events: none; }
.chart-hover-tooltip[hidden] { display: none; }
.chart-hover-heading { padding-bottom: 5px; margin-bottom: 4px; border-bottom: 1px solid #dce6ef; color: #173957; font: 650 10px var(--mono); }
.chart-hover-row { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; align-items: baseline; gap: 6px; padding: 2px 0; }
.chart-hover-row i { width: 8px; height: 3px; align-self: center; }
.chart-hover-row b { font: 600 10px var(--mono); white-space: nowrap; }
.chart-hover-trend { display: block; margin-top: 1px; color: #b45309; font: 500 8.5px var(--mono); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.hero-actions .diagnostics-link { margin-top: 0; }
.export-btn { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.chart-tools { flex-wrap: wrap; align-items: center; }
.pres-modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(9, 25, 42, 0.72); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 18px; }
.pres-modal-backdrop[hidden] { display: none; }
.pres-modal-card { width: min(1020px, 96vw); height: min(86vh, 880px); background: #ffffff; border: 1px solid #9ec3e2; border-radius: 12px; box-shadow: 0 20px 50px rgba(7, 25, 45, 0.45); display: flex; flex-direction: column; overflow: hidden; }
.pres-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: #f2f8fe; border-bottom: 1px solid #d5e3f0; flex-wrap: wrap; }
.pres-modal-header strong { display: block; font-size: 13px; color: #123354; }
.pres-modal-header small { display: block; font-size: 10px; color: #526d88; margin-top: 2px; font-family: var(--mono); }
.pres-modal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pres-preview-frame { flex: 1; width: 100%; border: 0; background: #ffffff; }

/* ---- Opas / guide page ---- */
html[lang="fi"] body:not(.show-both) .lang-en { display: none; }
html[lang="en"] body:not(.show-both) .lang-fi { display: none; }
body.show-both h2 .lang-en::before, body.show-both h3 .lang-en::before, body.show-both p .lang-en::before { content: " — "; color: #8aa3ba; }
.guide-main { width: min(100%, 1180px); margin: 26px auto 70px; padding: 0 20px; display: grid; grid-template-columns: 268px minmax(0,1fr); gap: 20px; align-items: start; }
.guide-toc { position: sticky; top: 86px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); padding: 14px; max-height: calc(100vh - 112px); overflow: auto; box-shadow: 0 3px 12px #26486a0a; }
.guide-toc b { display: block; font: 10px var(--mono); letter-spacing: .08em; color: #526d88; margin: 2px 0 8px; text-transform: uppercase; }
.guide-toc a { display: block; padding: 6px 8px; margin: 1px 0; border-radius: 6px; color: #294761; text-decoration: none; font-size: 12px; line-height: 1.35; border-left: 3px solid transparent; }
.guide-toc a:hover { background: #eef6fd; }
.guide-toc a.active { background: #e5f1fc; border-left-color: var(--blue); color: #123f66; font-weight: 650; }
.guide-toc .toc-terms { margin: 8px 0 2px; padding-top: 8px; border-top: 1px dashed var(--border); }
.guide-toc label.showboth { display: flex; gap: 7px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11px; color: #294761; cursor: pointer; }
.guide-content { min-width: 0; }
.guide-chapter { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 20px 22px; margin-bottom: 18px; box-shadow: 0 3px 12px #26486a0a; scroll-margin-top: 86px; }
.guide-chapter h2 { font-size: 21px; margin: 0 0 12px; display: flex; gap: 10px; align-items: baseline; }
.guide-chapter h2 .num { flex: 0 0 auto; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--blue); color: #fff; font: 700 14px var(--mono); }
.guide-chapter h3 { font-size: 15px; margin: 18px 0 6px; color: #123f66; scroll-margin-top: 86px; }
.guide-chapter p, .guide-chapter li { color: #2c4a66; font-size: 13px; line-height: 1.65; }
.guide-chapter ul, .guide-chapter ol { margin: 6px 0 10px; padding-left: 22px; }
.guide-chapter table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 12px; }
.guide-chapter th, .guide-chapter td { border: 1px solid #d7e3ee; padding: 7px 9px; text-align: left; vertical-align: top; }
.guide-chapter th { background: #eef6fd; font: 650 10px var(--mono); letter-spacing: .04em; color: #173957; text-transform: uppercase; }
.guide-chapter code { font: 11px var(--mono); background: #f2f7fd; border: 1px solid #dce8f2; border-radius: 4px; padding: 1px 5px; color: #14507f; }
.guide-note { border-left: 3px solid #bf8a16; background: #fff9e8; padding: 9px 12px; border-radius: 0 6px 6px 0; margin: 10px 0; font-size: 12px; color: #6a5a2a; }
.guide-term { border: 1px solid #dce8f2; border-radius: 8px; padding: 12px 14px; margin: 10px 0; background: #fbfdff; scroll-margin-top: 86px; }
.guide-term h3 { margin-top: 0; }
.term-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin: 12px 0; }
.term-index a { display: block; padding: 6px 9px; border: 1px solid #d7e3ee; border-radius: 6px; background: #f6faff; color: #14507f; text-decoration: none; font-size: 11.5px; }
.term-index a:hover { border-color: #75a9d3; background: #eaf4fd; }
.guide-top-link { position: fixed; right: 18px; bottom: 18px; z-index: 6; text-decoration: none; }
@media(max-width:980px) { .guide-main { grid-template-columns: 1fr; }.guide-toc { position: static; max-height: none; } }
.home-option:nth-child(5) { animation: fadeUp .6s ease-out .95s both; }
body.show-both td .lang-en::before, body.show-both li .lang-en::before { content: " — "; color: #8aa3ba; }

/* Guide mobile polish */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
.guide-chapter td { overflow-wrap: break-word; }
.guide-chapter code { overflow-wrap: anywhere; }
@media(max-width:980px) {
  .guide-main { grid-template-columns: 1fr; margin: 16px auto 56px; padding: 0 12px; gap: 12px; }
  .guide-toc { position: static; max-height: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; }
  .guide-toc > b { width: 100%; margin: 2px 0 0; }
  .guide-toc a { display: inline-flex; border: 1px solid #d7e3ee; border-left-width: 1px; border-radius: 999px; padding: 5px 10px; background: #f6faff; font-size: 11.5px; }
  .guide-toc a.active { background: #e5f1fc; border-color: var(--blue); font-weight: 600; }
  .guide-toc .toc-terms { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 0; padding-top: 8px; }
  .guide-toc .toc-terms b { margin: 0; }
  .guide-toc label.showboth { width: 100%; margin-top: 4px; padding-top: 8px; }
}
@media(max-width:650px) {
  .guide-chapter { padding: 16px 13px; border-radius: 8px; }
  .guide-chapter h2 { font-size: 18px; }
  .guide-chapter h2 .num { width: 26px; height: 26px; font-size: 12px; }
  .guide-chapter table { display: block; width: 100%; margin: 10px 0; }
  .guide-chapter table tr:first-child { display: none; }
  .guide-chapter tr { display: block; border: 1px solid #d7e3ee; border-radius: 8px; background: #fbfdff; margin: 0 0 10px; padding: 2px 0; }
  .guide-chapter td { display: block; border: 0; padding: 6px 11px 7px; font-size: 12.5px; }
  .guide-chapter td + td { border-top: 1px dashed #e3edf5; }
  .guide-chapter td[data-label]::before { content: attr(data-label); display: block; margin: 0 0 2px; font: 650 9px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #5a7a94; }
  .term-index { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .guide-top-link { right: 12px; bottom: 12px; }
  .guide-note { font-size: 11.5px; }
}

/* ---- Simulator UI Overhaul: Animations, Sliders, Typography & Expanded History Panel ---- */
@keyframes pulseLiveDot {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(33, 134, 75, 0.55); }
  50% { transform: scale(1.18); box-shadow: 0 0 0 6px rgba(33, 134, 75, 0); }
}
@keyframes quarterBump {
  0% { transform: scale(1); color: #a9d5ff; }
  40% { transform: scale(1.14); color: #ffffff; text-shadow: 0 0 10px rgba(169, 213, 255, 0.7); }
  100% { transform: scale(1); color: #a9d5ff; }
}
@keyframes kpiFlash {
  0% { border-color: #6ab0e8; box-shadow: 0 4px 16px rgba(23, 105, 170, 0.16); }
  100% { border-color: var(--border); box-shadow: 0 2px 8px #24486a08; }
}
@keyframes kpiFlashUp {
  0% { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25), 0 6px 18px rgba(21, 128, 61, 0.18); }
  100% { box-shadow: 0 2px 8px #24486a08; }
}
@keyframes kpiFlashDown {
  0% { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25), 0 6px 18px rgba(185, 28, 28, 0.18); }
  100% { box-shadow: 0 2px 8px #24486a08; }
}
@keyframes eventSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.live-dot {
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}
.live-dot.is-running {
  background: #23a455;
  animation: pulseLiveDot 2s infinite ease-in-out;
}
.live-dot:not(.is-running) {
  background: #d99b26;
  box-shadow: 0 0 8px rgba(217, 155, 38, 0.45);
}
#quarter.quarter-bump {
  display: inline-block;
  animation: quarterBump 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Enhanced KPI Cards */
.kpis {
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  position: relative;
  border-radius: 10px;
  padding: 13px 15px;
  min-height: 90px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.22s ease, background 0.22s ease;
}
.kpi:hover {
  transform: translateY(-2px);
  border-color: #9ec3e2;
  box-shadow: 0 6px 18px rgba(20, 45, 70, 0.12);
}
.kpi.kpi-up {
  border: 1.5px solid #22c55e;
  background: linear-gradient(145deg, #ffffff 0%, #f0fdf4 100%);
}
.kpi.kpi-down {
  border: 1.5px solid #ef4444;
  background: linear-gradient(145deg, #ffffff 0%, #fef2f2 100%);
}
.kpi.kpi-flash {
  animation: kpiFlash 0.48s ease-out;
}
.kpi.kpi-flash-up {
  animation: kpiFlashUp 0.55s ease-out;
}
.kpi.kpi-flash-down {
  animation: kpiFlashDown 0.55s ease-out;
}
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.kpi .label {
  font: 600 9.5px var(--mono);
  letter-spacing: 0.04em;
  color: #46627d;
}
.kpi .value {
  font: 700 22px var(--display);
  margin-top: 9px;
  color: #133556;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease;
}
.kpi.kpi-up .value {
  color: #14532d;
}
.kpi.kpi-down .value {
  color: #7f1d1d;
}
.kpi.kpi-up .unit {
  color: #166534;
}
.kpi.kpi-down .unit {
  color: #991b1b;
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 4px;
  font: 700 9.5px var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.kpi-dir-icon {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.kpi-delta.up,
.kpi-delta.kpi-up,
.kpi-delta.kpi-good {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.kpi-delta.down,
.kpi-delta.kpi-down,
.kpi-delta.kpi-warn,
.kpi-delta.kpi-bad {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}
.kpi-delta.flat,
.kpi-delta.kpi-neutral {
  background: #eff4f9;
  color: #5b748d;
  border: 1px solid #d8e3ee;
}
.chart-series.series-up {
  border: 1.5px solid #86efac;
}
.chart-series.series-down {
  border: 1.5px solid #fca5a5;
}
.series-header-badges {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

/* Panel & Typography Refinements */
.panel {
  border-radius: 11px;
  padding: 18px 20px;
  box-shadow: 0 4px 16px rgba(15, 42, 70, 0.08);
  transition: box-shadow 0.2s ease;
}
.panel h2 {
  font-size: 18px;
  letter-spacing: -0.015em;
  color: #133556;
}
.policy-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.button-subtle {
  padding: 6px 10px;
  font-size: 10.5px;
  font-weight: 600;
  color: #175c96;
  background: #f2f8fe;
  border-color: #bcd5ec;
  transition: all 0.16s ease;
}
.button-subtle:hover {
  background: #e1f0fc;
  border-color: #7ab0de;
  transform: translateY(-1px);
}

/* Easier, High-Clarity Policy & Budget Sliders */
.controls-grid {
  gap: 8px 20px;
  margin-top: 14px;
}
.control-row {
  padding: 11px 12px;
  border: 1px solid #e3ecf5;
  border-radius: 8px;
  background: #fafcff;
  gap: 8px 12px;
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.control-row:hover {
  background: #f3f9ff;
  border-color: #bdd6ed;
}
.control-row.is-modified {
  background: #eef6ff;
  border-color: #82b6e3;
  box-shadow: inset 3px 0 0 var(--blue);
}
.control-row b {
  font-size: 12.5px;
  font-weight: 650;
  color: #143656;
  line-height: 1.3;
}
.control-row small {
  font-size: 10.5px;
  color: #4e6984;
  margin-top: 3px;
  line-height: 1.35;
}
.control-row output {
  min-width: 64px;
  padding: 3px 7px;
  border-radius: 5px;
  background: #eaf3fc;
  border: 1px solid #cde0f2;
  color: #124d80;
  font: 700 12px var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.control-row.is-modified output {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

/* Custom Range Input Track & Thumb */
.control-row input[type="range"],
.fiscal-row input[type="range"],
.replay-controls input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  margin: 4px 0 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--blue) 0%,
    var(--blue2) var(--slider-pct, 50%),
    #dbe7f3 var(--slider-pct, 50%),
    #dbe7f3 100%
  );
  border: 1px solid #c3d6e8;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.control-row input[type="range"]:hover,
.fiscal-row input[type="range"]:hover {
  border-color: #7eb0dc;
}
.control-row input[type="range"]::-webkit-slider-thumb,
.fiscal-row input[type="range"]::-webkit-slider-thumb,
.replay-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid var(--blue);
  box-shadow: 0 2px 6px rgba(13, 45, 77, 0.25);
  cursor: grab;
  transition: transform 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}
.control-row input[type="range"]::-webkit-slider-thumb:hover,
.fiscal-row input[type="range"]::-webkit-slider-thumb:hover,
.replay-controls input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.16);
  background: #f0f7ff;
  box-shadow: 0 3px 9px rgba(23, 105, 170, 0.38);
}
.control-row input[type="range"]:active::-webkit-slider-thumb,
.fiscal-row input[type="range"]:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.22);
  background: var(--blue);
}
.control-row input[type="range"]::-moz-range-thumb,
.fiscal-row input[type="range"]::-moz-range-thumb,
.replay-controls input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid var(--blue);
  box-shadow: 0 2px 6px rgba(13, 45, 77, 0.25);
  cursor: grab;
  transition: transform 0.14s ease, background-color 0.14s ease;
}
.control-row input[type="range"]::-moz-range-thumb:hover,
.fiscal-row input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.16);
  background: #f0f7ff;
}

/* Fiscal Breakdown Rows */
.fiscal-details {
  margin: 14px 0 4px;
  padding: 13px 15px;
  border-radius: 9px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.fiscal-details[open] {
  border-color: #9dc2e2;
  box-shadow: 0 3px 12px rgba(23, 105, 170, 0.07);
}
.fiscal-details summary {
  font-size: 12px;
  padding: 2px 0;
}
.fiscal-details summary span {
  font-size: 10.5px;
}
.fiscal-note, .fiscal-source-note {
  font-size: 10.5px;
  line-height: 1.6;
}
.fiscal-row {
  grid-template-columns: 1fr minmax(110px, 38%) 48px;
  gap: 9px;
  padding: 8px 6px;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}
.fiscal-row:hover {
  background: #eef6fe;
}
.fiscal-row.is-modified {
  background: #e9f3fd;
}
.fiscal-row b {
  font-size: 11px;
  color: #163959;
}
.fiscal-row small {
  font-size: 9.5px;
}
.fiscal-row output,
.fiscal-row em {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.assumption-note {
  font-size: 10.5px;
  line-height: 1.6;
}

/* Sector Shares Readability */
.sector-top {
  font-size: 10.5px;
  font-weight: 500;
  color: #1e3f5e;
}
.sector-top span:last-child {
  font-size: 10.5px;
  font-weight: 600;
}
.bar {
  height: 5px;
  margin-top: 6px;
}
.bar i {
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.sector-account-summary span,
.sector-flow-balances span {
  font-size: 9.5px;
  padding: 6px 8px;
}
.sector-flow-balances em {
  font-size: 9.5px;
}

/* Overhauled Decision & Event Log (History Panel) */
.events-section {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid #dce7f2;
}
.events-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  color: #163b60;
  font-size: 12px;
}
.events-heading-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.events-heading-left b {
  font-size: 13px;
  font-weight: 650;
  color: #153858;
}
.event-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #e5f1fc;
  border: 1px solid #bdd7ef;
  color: #145388;
  font: 700 10px var(--mono);
}
.event-filters {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 7px;
  background: #eef4fa;
  border: 1px solid #d5e2ef;
}
.event-filter {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #486580;
  padding: 4px 9px;
  font: 600 10.5px var(--sans);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.event-filter:hover {
  color: #15456e;
  background: rgba(255, 255, 255, 0.65);
}
.event-filter.active {
  background: #ffffff;
  color: var(--blue);
  box-shadow: 0 1px 4px rgba(16, 58, 99, 0.12);
}
.event-list {
  max-height: 360px;
  min-height: 170px;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.event {
  border: 1px solid #dce8f3;
  border-left: 3.5px solid #2b7ec1;
  border-radius: 7px;
  background: #f9fcff;
  margin: 0;
  padding: 9px 11px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #213e59;
  animation: eventSlideIn 0.22s ease-out;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.event:hover {
  background: #f1f8ff;
  border-color: #b7d3ec;
}
.event.event-shock {
  border-left-color: #d48817;
  background: #fffdf7;
}
.event.event-policy {
  border-left-color: #1769aa;
}
.event-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.event time {
  font: 700 10.5px var(--mono);
  color: #154c7e;
  display: inline-block;
  margin: 0;
}
.event-badge {
  display: inline-flex;
  align-items: center;
  padding: 1.5px 6px;
  border-radius: 4px;
  font: 600 9px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.event-badge-policy {
  background: #e5f1fc;
  color: #14568c;
}
.event-badge-shock {
  background: #fef3dc;
  color: #8f5c08;
}
.event-badge-system {
  background: #edf2f7;
  color: #4c657d;
}
.event-text {
  font-size: 11.5px;
  line-height: 1.5;
  color: #264460;
  overflow-wrap: anywhere;
}
.event-empty {
  padding: 24px 12px;
  text-align: center;
  border: 1px dashed #cbdbea;
  border-radius: 7px;
  color: var(--muted);
  font-size: 11.5px;
}

/* Guide Equation & Playbook Cards */
.guide-eq {
  margin: 10px 0;
  padding: 11px 14px;
  border: 1px solid #cfe0ef;
  border-left: 3.5px solid var(--blue);
  border-radius: 7px;
  background: #f5f9ff;
  font: 12px/1.6 var(--mono);
  color: #133c63;
  overflow-x: auto;
}
.guide-eq b {
  display: block;
  font: 700 10.5px var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1769aa;
  margin-bottom: 4px;
}
.guide-playbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.guide-playbook {
  border: 1px solid #d5e4f1;
  border-radius: 8px;
  padding: 13px 15px;
  background: #f9fcff;
}
.guide-playbook h4 {
  margin: 0 0 6px;
  font-size: 13.5px;
  color: #143d63;
}
.guide-playbook p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}

/* ---- 5.6M 1:1 Micro-Simulation 6-Deck Command Desk ---- */
.micro-command-desk {
  margin-bottom: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  border: 1px solid #b8d3eb;
  box-shadow: 0 6px 22px rgba(15, 45, 78, 0.09);
}
.micro-desk-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.micro-telemetry-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  background: #eef6fd;
  border: 1px solid #c6ddef;
  color: #16426b;
  font: 600 10.5px var(--mono);
}
.telemetry-pill b {
  color: #0d3152;
  font-weight: 700;
}
.telemetry-pill.telemetry-speed {
  background: #ebf8f0;
  border-color: #b7e2c5;
  color: #1a6636;
}
.micro-deck-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border-radius: 9px;
  background: #eaf2fa;
  border: 1px solid #cbdced;
  margin-bottom: 16px;
}
.micro-deck-tab {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #2c4e6e;
  padding: 7px 12px;
  font: 650 11.5px var(--mono);
  cursor: pointer;
  transition: all 0.15s ease;
}
.micro-deck-tab:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #10385c;
}
.micro-deck-tab.active {
  background: #1769aa;
  border-color: #115387;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(23, 105, 170, 0.25);
}
.micro-decks-host {
  display: grid;
  gap: 16px;
}
.micro-deck-pane {
  border: 1px solid #d4e3f1;
  border-radius: 10px;
  background: #ffffff;
  padding: 16px 18px;
}
.micro-deck-pane h3 {
  margin: 0 0 4px;
  font-size: 15.5px;
  color: #123759;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.micro-deck-sub {
  margin: 0 0 14px;
  color: #4f6c87;
  font-size: 11.5px;
}
.micro-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 14px;
}
.micro-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
}
.micro-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 10px;
}
.micro-card {
  border: 1px solid #dce8f3;
  border-radius: 8px;
  background: #fafdff;
  padding: 12px 14px;
}
.micro-card h4 {
  margin: 0 0 8px;
  font: 700 11px var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #17588d;
}
.micro-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px dashed #e5eef6;
  font-size: 12px;
  color: #274663;
}
.micro-stat-row:last-child {
  border-bottom: 0;
}
.micro-stat-row b {
  font: 700 12px var(--mono);
  color: #113455;
}
.micro-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  background: #e6f2fc;
  border: 1px solid #bdd8ef;
  color: #134f82;
  font: 600 10.5px var(--mono);
}
.micro-badge.warn {
  background: #fff3df;
  border-color: #efd09e;
  color: #8c5608;
}
.micro-badge.danger {
  background: #fdeeee;
  border-color: #eabcbc;
  color: #9b2626;
}
.micro-badge.good {
  background: #eaf8ef;
  border-color: #bce3c8;
  color: #1b6b39;
}
.micro-meter {
  height: 7px;
  border-radius: 999px;
  background: #e2ecf5;
  overflow: hidden;
  margin: 4px 0 8px;
}
.micro-meter > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #1769aa, #3292dc);
  border-radius: 999px;
}
.finland-map-layout {
  display: grid;
  grid-template-columns: minmax(330px, 445px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 920px) {
  .finland-map-layout {
    grid-template-columns: 1fr;
  }
}
.finland-svg-wrap {
  border: 1px solid #c9dced;
  border-radius: 9px;
  background: radial-gradient(circle at 50% 35%, #f3f9ff 0%, #dfeefb 100%);
  padding: 12px;
  position: relative;
}
.finland-svg {
  display: block;
  width: 100%;
  height: 525px;
}
.muni-node {
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.muni-node:hover circle {
  stroke: #0b253c;
  stroke-width: 2.2px;
}
.muni-node.selected circle {
  stroke: #d97706;
  stroke-width: 2.4px;
}
.micro-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.micro-table th,
.micro-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e4eef7;
  text-align: left;
}
.micro-table th {
  font: 700 10px var(--mono);
  text-transform: uppercase;
  color: #466582;
  background: #f1f7fd;
}
.payslip-box {
  border: 1px solid #bfd7ec;
  border-radius: 8px;
  background: #f6fbff;
  padding: 12px 14px;
  font: 11.5px/1.55 var(--mono);
}
.payslip-total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 2px solid #1769aa;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: #0e385c;
}
.citizen-search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}
.citizen-search-bar input {
  width: 135px;
  padding: 6px 9px;
  border: 1px solid #bdd3e8;
  border-radius: 6px;
  font: 600 12px var(--mono);
}
.micro-slider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 275px), 1fr));
  gap: 8px 14px;
}
.micro-slider-row {
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid #dde8f3;
  border-radius: 7px;
  background: #fbfdff;
}
.micro-slider-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 11.5px;
}
.micro-slider-top b {
  color: #153858;
}
.micro-slider-top output {
  font: 700 11px var(--mono);
  color: #1769aa;
}
.micro-quick-tax-bar {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #c6dcef;
  border-radius: 9px;
  background: linear-gradient(180deg, #f3f9ff 0%, #fbfdff 100%);
}
.micro-quick-tax-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #123c63;
}

/* Interactive Economic & Electoral Indicator Tooltips (Tietokanta & Vaalit) */
.econ-glossary-bar {
  margin: 14px 0 18px;
  padding: 12px 15px;
  border: 1px solid #c5dbf0;
  border-radius: 10px;
  background: linear-gradient(180deg, #f3f9ff 0%, #fbfdff 100%);
  box-shadow: 0 2px 8px rgba(15, 45, 74, 0.04);
}
.econ-glossary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.econ-glossary-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #14497a;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.econ-glossary-hint {
  font-size: 11.5px;
  color: #4f6c88;
}
.econ-glossary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.econ-term {
  position: relative;
  display: inline;
  border-bottom: 1.5px dashed #2b76b8;
  color: inherit;
  font-weight: 600;
  cursor: help;
  padding: 0 2px;
  border-radius: 3px;
  text-decoration: none;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.econ-term:hover,
.econ-term:focus-visible {
  background-color: #dbeeff;
  color: #0b2e4f;
  border-bottom-color: #0e4c84;
  outline: none;
}
.econ-term-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px solid #bcd6ee;
  border-bottom: 1px solid #bcd6ee;
  border-radius: 6px;
  background: #ffffff;
  font-size: 11.5px;
  font-weight: 600;
  color: #164672;
  box-shadow: 0 1px 2px rgba(16, 48, 78, 0.04);
}
.econ-term-chip:hover,
.econ-term-chip:focus-visible {
  background: #1769aa;
  color: #ffffff;
  border-color: #1769aa;
}
.econ-term-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  margin-left: 3px;
  flex-shrink: 0;
  vertical-align: middle;
}
.econ-term-chip:hover .econ-term-badge,
.econ-term-chip:focus-visible .econ-term-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}
.econ-tooltip-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
  width: max-content;
  max-width: min(350px, calc(100vw - 24px));
  min-width: 240px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #0f2942;
  color: #f0f7ff;
  border: 1px solid #35699c;
  box-shadow: 0 14px 32px rgba(5, 18, 32, 0.42);
  font-size: 12px;
  line-height: 1.48;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
}
.econ-tooltip-popover.visible {
  opacity: 1;
  visibility: visible;
}
.econ-tooltip-popover::after {
  content: "";
  position: absolute;
  left: var(--tip-arrow-x, 50%);
  transform: translateX(-50%);
  border: 6px solid transparent;
}
.econ-tooltip-popover[data-placement="bottom"]::after {
  bottom: 100%;
  border-bottom-color: #0f2942;
}
.econ-tooltip-popover[data-placement="top"]::after {
  top: 100%;
  border-top-color: #0f2942;
}
.econ-tip-cat {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7cc4fa;
  background: rgba(124, 196, 250, 0.14);
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 5px;
}
.econ-tip-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 5px;
}
.econ-tip-body {
  color: #d8e9f9;
  margin-bottom: 7px;
}
.econ-tip-impact {
  padding-top: 6px;
  border-top: 1px solid rgba(158, 208, 246, 0.22);
  font-size: 11px;
  color: #a7d8ff;
}
.econ-tip-impact strong {
  color: #ffffff;
}

/* Energy Sensitivity & Pass-Through Panel */
.energy-sensitivity-panel {
  border-color: #9ec5e8;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}
.energy-sens-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.energy-sens-controls select {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #b8d0e6;
  background: #ffffff;
  color: #0f2942;
  font-size: 12px;
  font-weight: 600;
}
.energy-regime-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #334155;
}
.energy-regime-badge.good {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}
.energy-regime-badge.warn {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}
.energy-regime-badge.danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
.energy-sens-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.energy-sens-kpi {
  background: #ffffff;
  border: 1.5px solid #b8d4ee;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(12, 43, 75, 0.04);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.energy-sens-kpi.warn {
  border: 1.5px solid #f59e0b;
}
.energy-sens-kpi.danger,
.energy-sens-kpi.kpi-down {
  border: 1.5px solid #ef4444;
  background: linear-gradient(145deg, #ffffff 0%, #fef2f2 100%);
}
.energy-sens-kpi.good,
.energy-sens-kpi.kpi-up {
  border: 1.5px solid #22c55e;
  background: linear-gradient(145deg, #ffffff 0%, #f0fdf4 100%);
}
.energy-sens-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
.energy-sens-kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: #47627d;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0;
}
.energy-sens-kpi-val {
  font-size: 19px;
  font-weight: 800;
  font-family: var(--mono, monospace);
  color: #0b2540;
  margin-bottom: 3px;
}
.energy-sens-kpi.kpi-up .energy-sens-kpi-val,
.energy-sens-kpi.good .energy-sens-kpi-val {
  color: #14532d;
}
.energy-sens-kpi.kpi-down .energy-sens-kpi-val,
.energy-sens-kpi.danger .energy-sens-kpi-val {
  color: #7f1d1d;
}
.energy-sens-kpi-meta {
  font-size: 11px;
  color: #52718f;
}
.energy-sens-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.energy-sens-chart-card {
  background: #ffffff;
  border: 1px solid #cfe0f0;
  border-radius: 8px;
  padding: 12px 14px;
}
.energy-sens-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.energy-sens-card-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: #0f2942;
}
.energy-corr-pill {
  font-family: var(--mono, monospace);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.energy-sens-svg {
  width: 100%;
  height: auto;
  display: block;
}
.energy-sens-legend {
  margin-top: 6px;
  font-size: 11px;
  color: #47627d;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.energy-sens-matrix {
  background: #ffffff;
  border: 1px solid #d5e4f2;
  border-radius: 8px;
  padding: 10px 14px;
}
.energy-matrix-head {
  display: grid;
  grid-template-columns: 1.5fr 0.7fr 1.2fr 1.6fr;
  gap: 10px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #47627d;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2ecf5;
}
.energy-matrix-row {
  display: grid;
  grid-template-columns: 1.5fr 0.7fr 1.2fr 1.6fr;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
  color: #1e3a5f;
}
.energy-matrix-row:last-child {
  border-bottom: none;
}
.energy-matrix-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.energy-matrix-bar i {
  display: block;
  height: 100%;
  border-radius: 4px;
}
@media (max-width: 720px) {
  .energy-matrix-head,
  .energy-matrix-row {
    grid-template-columns: 1fr 0.6fr;
  }
}


/* Suomilaattori home: polished motion layer */
.home-page {
  isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 0%, #1b5684 0%, transparent 52%),
    radial-gradient(ellipse at 8% 88%, #14507b66 0%, transparent 40%),
    var(--bg);
}
#particles { z-index: 0; opacity: .8; }
.home-main { position: relative; z-index: 1; }
.home-heading { perspective: 900px; }
.home-mark {
  transform-origin: 50% 60%;
  filter: drop-shadow(0 12px 28px #061b3030);
  animation: brand-arrive 1.1s cubic-bezier(.2,.75,.25,1) both,
             brand-breathe 7s ease-in-out 1.1s infinite;
}
.home-heading-copy .eyebrow {
  opacity: 0;
  animation: text-arrive .7s ease-out .22s forwards;
}
.home-heading-copy .home-prompt {
  opacity: 0;
  animation: text-arrive .8s cubic-bezier(.2,.75,.25,1) .32s forwards;
}
.home-heading-copy .home-intro {
  opacity: 0;
  animation: text-arrive .8s cubic-bezier(.2,.75,.25,1) .48s forwards;
}
.home-option-item {
  opacity: 0;
  animation: option-arrive .75s cubic-bezier(.2,.75,.25,1) var(--entry-delay, 180ms) forwards;
  transform-origin: 50% 50%;
}
.home-option {
  position: relative;
  isolation: isolate;
  border: 0;
  outline: none;
  box-shadow: none;
  background: transparent;
  filter: drop-shadow(0 8px 15px #061b3022);
  transition: transform .32s cubic-bezier(.2,.75,.25,1), filter .32s ease;
}
.home-option::before {
  content: none;
  border: 0;
  box-shadow: none;
}
.home-option-image {
  transform: translateZ(0);
  transition: transform .65s cubic-bezier(.2,.75,.25,1), filter .4s ease;
  will-change: transform;
}
.home-option-item:hover .home-option,
.home-option-item:focus-within .home-option {
  border: 0;
  outline: none;
  box-shadow: none;
  transform: translateY(-7px) scale(1.035);
  filter: drop-shadow(0 18px 25px #03172b66);
}
.home-option-item:hover .home-option-image,
.home-option-item:focus-within .home-option-image {
  transform: scale(1.075) rotate(-1deg);
  filter: saturate(1.13) brightness(1.04);
}
.home-option-copy {
  text-shadow: 0 2px 16px #061b30;
}
.home-option-copy strong {
  transition: letter-spacing .25s ease, color .25s ease;
}
.home-option-item:hover .home-option-copy strong,
.home-option-item:focus-within .home-option-copy strong {
  color: #d9efff;
  letter-spacing: .015em;
}
.home-option-item::after {
  content: none;
}
.page-transition {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: #082641;
  opacity: 1;
  visibility: visible;
  clip-path: inset(0 0 0 0);
  transition: clip-path .55s cubic-bezier(.76,0,.24,1), opacity .38s ease, visibility .55s;
}
.page-transition::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .55;
  background: radial-gradient(ellipse at center, #2f86cf55 0%, transparent 56%);
}
.transition-orb {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 0;
  background: url("/assets/brand/suomilaattori-symbol.png") center / contain no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 12px 28px #04152688);
  opacity: 1;
  transform: scale(1);
  transition: transform .46s cubic-bezier(.22,1,.36,1), opacity .34s ease;
}
.page-ready .page-transition {
  opacity: 0;
  visibility: hidden;
  clip-path: inset(0 0 100% 0);
  transition-delay: .06s;
}
.page-ready .transition-orb {
  opacity: 0;
  transform: scale(0.84) translateY(-10px);
}
.page-leaving .page-transition {
  opacity: 1;
  visibility: visible;
  clip-path: inset(0 0 0 0);
  transition-duration: .38s;
}
.page-leaving .transition-orb {
  opacity: 1;
  transform: scale(1.06) translateY(0);
}
@keyframes brand-arrive {
  from { opacity: 0; transform: translateY(18px) scale(.96); filter: blur(7px) drop-shadow(0 12px 28px #061b3030); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0) drop-shadow(0 12px 28px #061b3030); }
}
@keyframes brand-breathe {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes text-arrive {
  from { opacity: 0; transform: translateY(13px); filter: blur(4px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes option-arrive {
  from { opacity: 0; transform: translateY(24px) scale(.97); filter: blur(5px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@media (max-width: 700px), (hover: none) {
  .home-option { border-radius: 14px; }
  .home-option-item:hover .home-option,
  .home-option-item:focus-within .home-option { transform: translateY(-3px) scale(1.015); }
  .home-option-item:hover .home-option-image,
  .home-option-item:focus-within .home-option-image { transform: scale(1.035); }
}
@media (prefers-reduced-motion: reduce) {
  .page-transition { display: none !important; }
  .home-mark, .home-heading-copy .eyebrow, .home-heading-copy .home-prompt,
  .home-heading-copy .home-intro, .home-option-item { animation: none !important; opacity: 1 !important; filter: none !important; }
  .home-option, .home-option-image, .home-option::before, .home-option-copy strong { transition: none !important; }
  .home-option-item:hover .home-option,
  .home-option-item:focus-within .home-option { transform: none; }
  .home-option-item:hover .home-option-image,
  .home-option-item:focus-within .home-option-image { transform: none; }
}

.deep-expenditure-workbench {
  margin: 14px 0 18px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #bfd7ee;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f7fd 100%);
}
.deep-exp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.deep-exp-header h4 {
  margin: 2px 0 4px;
  font-size: 14.5px;
  color: #103252;
}
.deep-exp-summary-Right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.deep-exp-kpi {
  display: flex;
  flex-direction: column;
  padding: 6px 11px;
  border-radius: 7px;
  border: 1px solid #c7dcef;
  background: #ffffff;
  min-width: 138px;
}
.deep-exp-kpi span {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #4b6884;
}
.deep-exp-kpi b {
  font-size: 13.5px;
  font-family: var(--mono, monospace);
  color: #103252;
  margin-top: 2px;
}
.deep-exp-kpi.up {
  border-color: #f59e0b;
  background: #fffbeb;
}
.deep-exp-kpi.up b {
  color: #b45309;
}
.deep-exp-kpi.down {
  border-color: #16a34a;
  background: #f0fdf4;
}
.deep-exp-kpi.down b {
  color: #15803d;
}
.deep-exp-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #d4e4f3;
}
.deep-exp-tab {
  appearance: none;
  border: 1px solid #bfd6ec;
  background: #ffffff;
  color: #1e4265;
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.deep-exp-tab:hover {
  background: #eaf4fd;
  border-color: #84b5e2;
}
.deep-exp-tab.active {
  background: #145388;
  border-color: #0f3f68;
  color: #ffffff;
}
.deep-exp-groups {
  display: grid;
  gap: 14px;
}
.deep-exp-group {
  background: #ffffff;
  border: 1px solid #d2e3f3;
  border-radius: 8px;
  padding: 11px 12px;
}
.deep-exp-group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 9px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e6f0f9;
}
.deep-exp-group-head h5 {
  margin: 0;
  font-size: 13px;
  color: #103252;
}
.deep-exp-group-head span {
  font-size: 11px;
  color: #4f6c88;
}
.deep-exp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 9px;
}
.deep-exp-row {
  margin: 0;
  background: #f9fcff;
}
.deep-exp-row em {
  font-size: 10.5px;
  font-style: normal;
  font-family: var(--mono, monospace);
  color: #365675;
}
.derived-fiscal-row {
  background: #f5f9fe;
  border: 1px dashed #9fc3e4;
}
.derived-fiscal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.derived-fiscal-actions output {
  min-width: 140px;
  font-size: 11.5px;
  padding: 4px 8px;
}
.finland-reconciliation-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.recon-item {
  background: #ffffff;
  border: 1px solid #cde0f2;
  border-radius: 8px;
  padding: 8px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.recon-item span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #486581;
}
.recon-item b {
  font-size: 12px;
  color: #103252;
}
.recon-item small {
  font-size: 11px;
  font-family: var(--mono, monospace);
  color: #1769aa;
}
.fiscal-readonly-row {
  grid-template-columns: 1fr minmax(80px, 28%) auto;
  align-items: center;
}
.fiscal-bar-track {
  width: 100%;
  height: 7px;
  background: #e2ecf5;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #cbdceb;
}
.fiscal-bar-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue2) 100%);
  border-radius: 999px;
}
.session-badge-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(196, 216, 233, 0.32);
}
.session-badge-label {
  font: 600 9.5px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c4d8e9;
}
.session-badge-id {
  font: 700 10.5px var(--mono);
  color: #ffffff;
  background: rgba(13, 45, 77, 0.65);
  border: 1px solid rgba(169, 213, 255, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.session-action-btn {
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
}

/* Guide Hero Card, Stat Pills & Language Switcher */
.guide-topbar .lang-switch {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(196, 216, 233, 0.35);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.guide-topbar .lang-btn {
  border: 0;
  background: transparent;
  color: #d6e5f1;
  font: 600 11px var(--sans);
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.guide-topbar .lang-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}
.guide-topbar .lang-btn.active {
  background: #ffffff;
  color: #0d2d4d;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(7, 30, 52, 0.25);
}
.guide-hero-card {
  background: linear-gradient(145deg, #ffffff 0%, #f1f7fe 100%);
  border: 1px solid #b8d3eb;
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(15, 45, 78, 0.08);
}
.guide-hero-eyebrow {
  font: 700 10px var(--mono);
  letter-spacing: 0.08em;
  color: #1769aa;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.guide-hero-card h1 {
  font: 700 clamp(22px, 3vw, 28px) var(--display);
  letter-spacing: -0.025em;
  color: #103252;
  margin: 0 0 10px;
}
.guide-hero-lead {
  color: #2c4a66;
  font-size: 13.5px;
  line-height: 1.65;
  margin: 0 0 16px;
}
.guide-stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
}
.guide-stat-pill {
  background: #ffffff;
  border: 1px solid #cde0f2;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.guide-stat-pill > span {
  font: 700 9.5px var(--mono);
  letter-spacing: 0.05em;
  color: #486581;
  text-transform: uppercase;
}
.guide-stat-pill > b {
  font: 700 15px var(--display);
  color: #103252;
}
.guide-stat-pill > small {
  font: 500 11px var(--sans);
  color: #4f6c87;
}
.glossary-group {
  margin: 22px 0 10px !important;
  padding-bottom: 6px;
  border-bottom: 2px solid #d5e4f1;
  font: 700 13px var(--mono) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1769aa !important;
}
.chapter-lead {
  margin: 0 0 12px;
  color: #365675;
  font-size: 13px;
  line-height: 1.6;
}

/* =========================================================================
   Simulator Main Container & Global Mobile / Responsive Containment
   ========================================================================= */

main:not([class]) {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 0 24px 36px;
}

/* Ensure grid and flex children never blow out parent tracks via min-content */
.layout > *,
.lower-grid > *,
.panel,
.micro-command-desk,
.micro-desk-header,
.micro-desk-header > *,
.micro-decks-host,
.micro-deck-pane,
.micro-card,
.micro-grid-2,
.micro-grid-2 > *,
.micro-grid-3,
.micro-grid-3 > *,
.micro-grid-4,
.micro-grid-4 > *,
.micro-slider-grid,
.micro-slider-row,
.deep-exp-groups,
.deep-exp-group,
.deep-exp-grid,
.deep-exp-card,
.controls-grid,
.control-row,
.energy-sensitivity-panel,
.energy-sens-charts-grid,
.energy-sens-chart-card {
  min-width: 0;
  max-width: 100%;
}

.micro-decks-host {
  grid-template-columns: minmax(0, 1fr);
}

select,
input[type="text"],
input[type="number"] {
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
}

.deep-exp-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
}

.finland-reconciliation-strip {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

.energy-sens-charts-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

@media (max-width: 980px) {
  main:not([class]) {
    padding: 0 16px 32px;
  }

  .topbar {
    height: auto;
    min-height: 60px;
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .clock {
    margin-left: auto;
  }

  .clock-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }

  .panel-heading {
    flex-wrap: wrap;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  main:not([class]) {
    padding: 0 12px 28px;
    overflow-x: hidden;
  }

  /* Non-sticky compact multi-row topbar on mobile so viewport stays clear */
  .topbar {
    position: relative;
    height: auto;
    padding: 10px 12px;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .brand > div:last-child {
    min-width: 0;
  }

  .brand h1 {
    font-size: 14px;
    line-height: 1.2;
  }

  .brand .eyebrow {
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .eyebrow {
    font-size: 9.5px;
    white-space: normal;
    line-height: 1.35;
    overflow-wrap: break-word;
  }

  .clock {
    margin-left: auto;
    text-align: right;
    flex: 0 0 auto;
  }

  .clock strong {
    font-size: 13px;
  }

  .clock span {
    font-size: 10px;
  }

  .clock-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(196, 216, 233, 0.22);
  }

  .session-badge-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px;
  }

  .session-badge-id {
    margin-right: auto;
  }

  .clock-actions > .button,
  .clock-actions > a.button {
    padding: 6px 9px;
    font-size: 11px;
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
  }

  .clock-actions > .speed {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(196, 216, 233, 0.3);
    border-radius: 6px;
    padding: 4px 8px;
    flex: 1 1 auto;
    justify-content: center;
  }

  .clock-actions > .speed select {
    padding: 3px 6px;
    font-size: 11px;
  }

  /* Hero section & presets */
  .hero-strip {
    padding: 14px 0 10px;
    gap: 12px;
  }

  .hero-copy h2 {
    font-size: 20px;
    line-height: 1.25;
  }

  .hero-copy p {
    font-size: 13px;
    line-height: 1.5;
  }

  .preset-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .preset-bar .chip {
    width: 100%;
    text-align: center;
    padding: 8px 8px;
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* KPI Grid: 2 columns on mobile with clean typography */
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .kpi-card {
    padding: 10px;
    min-height: 82px;
  }

  .kpi-card span {
    font-size: 10.5px;
    line-height: 1.25;
  }

  .kpi-card strong {
    font-size: 18px;
  }

  .kpi-card small {
    font-size: 10.5px;
    line-height: 1.3;
  }

  /* Panel headings & actions */
  .panel {
    padding: 12px;
  }

  .panel-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .panel-heading > div:first-child {
    width: 100%;
    min-width: 0;
  }

  .panel-heading h2 {
    font-size: 18px;
    line-height: 1.25;
    overflow-wrap: break-word;
  }

  .desk-heading-actions,
  .energy-sens-controls,
  .replay-series-label {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .desk-heading-actions .button {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    font-size: 11px;
    padding: 7px 8px;
  }

  .energy-sens-controls label,
  .replay-series-label {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .energy-sens-controls select,
  #fan-indicator {
    width: 100%;
    max-width: 100%;
  }

  /* Micro Command Desk on Mobile */
  .micro-command-desk {
    padding: 12px 10px !important;
  }

  .micro-desk-header h2 {
    font-size: 18px;
    line-height: 1.25;
    overflow-wrap: break-word;
  }

  .micro-deck-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .micro-deck-tab,
  .micro-tab-btn {
    width: 100%;
    min-width: 0;
    white-space: normal;
    text-align: left;
    line-height: 1.25;
    font-size: 9.8px;
    letter-spacing: -0.015em;
    padding: 7px 6px;
    min-height: 42px;
    display: flex;
    align-items: center;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
  }

  .micro-deck-pane {
    padding: 10px;
    overflow-x: hidden;
  }

  .micro-deck-pane h3 {
    font-size: 14px;
    line-height: 1.3;
    overflow-wrap: break-word;
  }

  .micro-badge {
    white-space: normal;
    line-height: 1.25;
    max-width: 100%;
    word-break: break-word;
  }

  .micro-deck-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .micro-grid-2,
  .micro-grid-3,
  .micro-grid-4,
  .power-builder-grid-2,
  .power-builder-grid-3 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .micro-card {
    padding: 10px;
    overflow-x: hidden;
  }

  .micro-stat-row {
    flex-wrap: wrap;
    gap: 2px 8px;
    align-items: baseline;
  }

  .micro-stat-row span {
    min-width: 0;
    word-break: break-word;
  }

  .micro-stat-row b {
    margin-left: auto;
    text-align: right;
    word-break: break-word;
  }

  /* Scrollable wide data tables inside micro decks */
  .micro-table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .micro-table th,
  .micro-table td {
    white-space: nowrap;
    font-size: 10.5px;
    padding: 5px 6px;
  }

  .micro-slider-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .micro-slider-row span {
    grid-column: 1 / 2;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
  }

  .micro-slider-row b {
    grid-column: 2 / 3;
  }

  .micro-slider-row input[type="range"] {
    grid-column: 1 / -1;
    width: 100%;
  }

  .micro-action-bar {
    gap: 6px;
  }

  .micro-action-bar .button.sm-btn {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    white-space: normal;
    line-height: 1.2;
    padding: 7px 6px;
  }

  .micro-muni-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .micro-muni-toolbar label,
  .micro-muni-toolbar select {
    width: 100%;
    max-width: 100%;
  }

  /* Map & Legend on Mobile */
  .map-wrap {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  #world-map {
    min-height: 200px;
  }

  .map-legend,
  .map-note {
    position: static;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    font-size: 10.5px;
    padding: 6px 8px;
  }

  /* Main Chart Workbench on Mobile */
  .chart-tools {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    align-items: stretch;
  }

  .chart-tools label {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
    background: #f3f8fc;
    border: 1px solid #d5e4f1;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .chart-tools label:has(input[type="month"]) {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .chart-tools input[type="month"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    font-size: 11px;
    padding: 4px 6px;
  }

  .chart-tools input[type="number"] {
    width: 58px;
  }

  .chart-tools .button {
    width: 100%;
    text-align: center;
    padding: 6px 8px;
    font-size: 11px;
  }

  .chart-selectors {
    max-height: 156px;
    overflow-y: auto;
    padding: 6px;
    background: #f5f9fd;
    border: 1px solid #d6e4f0;
    border-radius: 7px;
    gap: 5px;
    -webkit-overflow-scrolling: touch;
  }

  .series-chip {
    font-size: 10.5px;
    padding: 5px 8px;
    white-space: normal;
    line-height: 1.2;
  }

  #main-chart {
    min-height: 235px;
  }

  /* Policy Desk & Fiscal Breakdown on Mobile */
  .control-row {
    padding: 10px;
    gap: 6px;
  }

  .control-row.derived-fiscal-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .derived-fiscal-actions {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
    padding-top: 4px;
    border-top: 1px dashed #d5e4f1;
  }

  .control-row:has(.seed-controls) {
    grid-template-columns: minmax(0, 1fr);
  }

  .seed-controls {
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .seed-controls input,
  .seed-controls select {
    flex: 1 1 120px;
  }

  .fiscal-row,
  .deep-exp-row {
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 5px 8px;
  }

  .fiscal-row > span,
  .deep-exp-row > span {
    grid-column: 1 / 2;
    font-size: 11.5px;
    line-height: 1.25;
  }

  .fiscal-row > output,
  .deep-exp-row > output {
    grid-column: 2 / 3;
    text-align: right;
  }

  .fiscal-row > input[type="range"],
  .deep-exp-row > input[type="range"] {
    grid-column: 1 / -1;
    width: 100%;
  }

  .fiscal-readonly-row {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .fiscal-readonly-row .fiscal-bar-track {
    grid-column: 1 / -1;
    order: 3;
  }

  /* Energy Sensitivity Charts & Details on Mobile */
  .energy-sens-charts-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .energy-sens-svg {
    height: 185px;
  }

  /* Tietokanta & Vaalit Mobile Containment */
  .rep-party-badge {
    white-space: normal !important;
    max-width: 100%;
    word-break: break-word;
    line-height: 1.25;
  }

  .vaalit-table th,
  .vaalit-table td {
    padding: 6px 5px;
    font-size: 11px;
  }

  .vaalit-table th:last-child,
  .vaalit-table td.vaalit-bar-cell {
    display: none;
  }
}


