:root {
  --cz-ink: #171918;
  --cz-paper: #f1ede3;
  --cz-acid: #a8b63f;
  --cz-green: #777b24;
  --cz-blue: #8b8d83;
  --cz-red: #c93237;
  --cz-line: #c8c2b7;
  --cz-muted: #6e716d;
}

.cz-budget-page { background: var(--cz-paper); color: var(--cz-ink); }
.cz-budget-page .cz-header { background: rgba(243,240,232,.95); }
.cz-budget-page .dataset-pill { border-color: var(--cz-ink); }
.cz-budget-page main { overflow: hidden; }
.breadcrumbs { display: flex; gap: 10px; align-items: center; padding: 22px 5vw; border-bottom: 1px solid var(--cz-line); font-size: 12px; color: var(--cz-muted); }
.breadcrumbs a { text-underline-offset: 3px; }
.breadcrumbs strong { color: var(--cz-ink); }

.cz-hero { padding: 74px 5vw 58px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 60px; align-items: end; border-bottom: 1px solid var(--cz-line); }
.cz-hero h1,.detail-hero h1 { margin: 28px 0 22px; font: 500 clamp(62px,9vw,132px)/.85 Georgia,serif; letter-spacing: -.065em; }
.cz-hero h1 em { color: var(--cz-red); font-weight: 400; }
.cz-hero p,.detail-hero p { max-width: 710px; margin: 0; color: var(--cz-muted); font-size: 17px; line-height: 1.65; }
.cz-hero .eyebrow,.detail-hero .eyebrow { font: 700 11px monospace; text-transform: uppercase; letter-spacing: .11em; }
.cz-hero .live-dot,.detail-hero .live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 9px; border-radius: 50%; background: #52bb83; box-shadow: 0 0 0 4px #52bb8320; }
.cohort-switch { display: grid; width: 300px; border: 1px solid var(--cz-ink); }
.cohort-switch a { display: flex; justify-content: space-between; padding: 18px 20px; text-decoration: none; border-bottom: 1px solid var(--cz-ink); font-size: 13px; font-weight: 700; }
.cohort-switch a:last-child { border-bottom: 0; }
.cohort-switch a.active { background: var(--cz-ink); color: white; }
.cohort-switch a.active b { color: var(--cz-acid); }

.cz-totals,.detail-kpis { display: grid; grid-template-columns: repeat(3,1fr); border-bottom: 1px solid var(--cz-line); }
.cz-totals article,.detail-kpis article { padding: 28px 5vw; border-right: 1px solid var(--cz-line); }
.cz-totals article:last-child,.detail-kpis article:last-child { border-right: 0; }
.cz-totals span,.detail-kpis span { display: block; color: var(--cz-muted); font: 10px monospace; text-transform: uppercase; letter-spacing: .08em; }
.cz-totals strong,.detail-kpis strong { display: block; margin: 10px 0 5px; font: 500 clamp(26px,3vw,42px) Georgia,serif; }
.cz-totals small,.detail-kpis small { color: var(--cz-muted); }

.directory,.analysis-ready,.detail-analysis,.data-contract { padding: 100px 5vw; }
.directory-title,.detail-section-title { display: grid; grid-template-columns: 1.1fr .7fr; gap: 12vw; align-items: end; margin-bottom: 42px; }
.directory-title h2,.analysis-ready h2,.detail-section-title h2,.data-contract h2 { margin: 16px 0 0; font: 500 clamp(46px,6vw,78px)/.95 Georgia,serif; letter-spacing: -.05em; }
.directory-title p,.detail-section-title p,.data-contract p { margin: 0; color: var(--cz-muted); line-height: 1.65; }
.kicker { font: 700 11px monospace; text-transform: uppercase; letter-spacing: .11em; }

.directory-filters { display: grid; grid-template-columns: 1.4fr repeat(4,1fr) auto; gap: 1px; padding: 1px; margin-bottom: 18px; background: var(--cz-line); border: 1px solid var(--cz-line); }
.directory-filters label { display: grid; gap: 8px; padding: 13px 15px; background: #faf8f2; }
.directory-filters label span { font: 9px monospace; text-transform: uppercase; letter-spacing: .08em; color: var(--cz-muted); }
.directory-filters input,.directory-filters select { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--cz-ink); outline: 0; font-size: 13px; }
.directory-filters label:focus-within { background: white; box-shadow: inset 0 -3px var(--cz-green); }
.directory-filters button { padding: 0 18px; border: 0; background: var(--cz-ink); color: white; font-size: 11px; font-weight: 700; cursor: pointer; }
.result-meta { display: flex; justify-content: space-between; padding: 13px 3px 22px; color: var(--cz-muted); font-size: 12px; }
.result-meta strong { color: var(--cz-ink); }
.entity-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.entity-card { display: flex; flex-direction: column; min-height: 360px; padding: 25px; background: white; border: 1px solid var(--cz-line); box-shadow: 0 7px 0 rgba(23,26,25,.05); }
.entity-card[hidden] { display: none; }
.entity-card-top { display: flex; justify-content: space-between; gap: 20px; color: var(--cz-muted); font: 10px monospace; text-transform: uppercase; }
.entity-card h2 { margin: 50px 0 26px; font: 500 33px Georgia,serif; }
.entity-card h2 a { text-decoration: none; }
.entity-card h2 a:hover { text-decoration: underline; text-decoration-color: var(--cz-green); text-underline-offset: 6px; }
.entity-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 0 28px; border-top: 1px solid #dedad1; }
.entity-card dl div { padding: 13px 7px 9px 0; }
.entity-card dt { color: var(--cz-muted); font-size: 9px; text-transform: uppercase; }
.entity-card dd { margin: 5px 0 0; font-weight: 700; font-size: 13px; }
.entity-detail-link { display: flex; justify-content: space-between; margin-top: auto; padding: 14px 0 0; border-top: 1px solid #dedad1; text-decoration: none; font-size: 12px; font-weight: 700; }
.entity-detail-link span { color: var(--cz-green); }
.empty-state { padding: 48px; background: white; border: 1px solid var(--cz-line); text-align: center; }

.analysis-ready { display: grid; grid-template-columns: .8fr 1.2fr; gap: 10vw; background: var(--cz-ink); color: white; }
.analysis-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: #48504d; border: 1px solid #48504d; }
.analysis-grid article { padding: 26px; background: #202522; }
.analysis-grid b { color: var(--cz-acid); font: 11px monospace; }
.analysis-grid h3 { margin: 42px 0 13px; font: 500 23px Georgia,serif; }
.analysis-grid p { color: #b6bdb8; font-size: 13px; line-height: 1.6; }

.detail-hero { min-height: 600px; padding: 82px 5vw 68px; display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 8vw; align-items: center; border-bottom: 1px solid var(--cz-line); }
.detail-hero h1 { font-size: clamp(62px,9vw,136px); }
.detail-actions { display: flex; align-items: center; gap: 25px; margin-top: 25px; }
.detail-actions .primary-button { margin-top: 0; }
.detail-actions>a:last-child { font-size: 12px; text-underline-offset: 4px; }
.detail-score { padding: 28px; background: var(--cz-ink); color: white; box-shadow: 10px 10px 0 var(--cz-acid); }
.detail-score span,.detail-score small { display: block; color: #b6bdb8; font: 10px/1.5 monospace; text-transform: uppercase; }
.detail-score strong { display: block; margin: 35px 0 8px; font: 500 64px Georgia,serif; color: var(--cz-acid); }
.detail-kpis { grid-template-columns: repeat(4,1fr); }
.detail-kpis article { padding: 25px 2.5vw; }
.detail-kpis strong { font-size: clamp(22px,2.4vw,35px); }
.positive { color: #70751b !important; }
.negative { color: var(--cz-red) !important; }

.detail-controls { display: grid; grid-template-columns: 1.3fr repeat(3,1fr); gap: 1px; padding: 1px; background: var(--cz-line); border-bottom: 1px solid var(--cz-line); }
.detail-controls>* { min-width: 0; padding: 17px 2.5vw; background: #faf8f2; }
.detail-controls span { display: block; margin-bottom: 6px; color: var(--cz-muted); font: 9px monospace; text-transform: uppercase; }
.detail-controls strong,.detail-controls select { width: 100%; border: 0; background: transparent; font-size: 12px; font-weight: 700; }
.detail-section-title { margin-top: 96px; }
.detail-section-title:first-child { margin-top: 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-panel { padding: 30px; background: white; border: 1px solid var(--cz-line); box-shadow: 0 7px 0 rgba(23,26,25,.05); }
.plan-panel { display: grid; gap: 30px; }
.plan-row>div:first-child,.panel-title,.mix-row>div:first-child { display: flex; justify-content: space-between; gap: 20px; align-items: baseline; }
.plan-row span,.mix-row span { color: var(--cz-muted); font-size: 12px; }
.budget-stage-scroll { overflow-x: auto; }
.budget-stage-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.budget-stage-table th,.budget-stage-table td { padding: 15px 16px; border-bottom: 1px solid var(--cz-line); text-align: right; white-space: nowrap; }
.budget-stage-table thead th { color: var(--cz-muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.budget-stage-table th:first-child { text-align: left; }
.budget-stage-table tbody th { font-size: 14px; }
.budget-stage-table tbody tr:last-child { background: color-mix(in srgb, var(--acid) 20%, white); }
.budget-stage-table tbody tr:last-child th,.budget-stage-table tbody tr:last-child td { border-bottom: 0; font-weight: 800; }
.budget-stage-source { margin: 14px 0 0; color: var(--cz-muted); font-size: 11px; }
.budget-stage-source code { font-size: 10px; }
.municipal-breakdown-explorer { margin-top: 76px; }
.breakdown-heading { display: grid; grid-template-columns: 1.1fr .8fr; gap: 9vw; align-items: end; margin-bottom: 28px; }
.breakdown-heading h2 { margin: 14px 0 0; font: 500 clamp(40px,5vw,68px)/.94 Georgia,serif; letter-spacing: -.045em; }
.breakdown-heading p { margin: 0; color: var(--cz-muted); line-height: 1.65; }
.breakdown-stage-tabs { display: flex; width: max-content; max-width: 100%; margin: 0 0 14px; border: 1px solid var(--cz-ink); overflow-x: auto; }
.breakdown-stage-tabs button { min-width: 118px; padding: 13px 18px; border: 0; border-right: 1px solid var(--cz-ink); background: transparent; color: var(--cz-ink); font: 700 10px monospace; text-transform: uppercase; letter-spacing: .05em; cursor: pointer; }
.breakdown-stage-tabs button:last-child { border-right: 0; }
.breakdown-stage-tabs button[aria-pressed="true"] { background: var(--cz-ink); color: white; }
.budget-breakdown-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.budget-breakdown-panel { min-width: 0; background: white; border: 1px solid var(--cz-line); box-shadow: 0 7px 0 rgba(23,26,25,.05); }
.budget-breakdown-panel>header { min-height: 112px; padding: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--cz-line); }
.budget-breakdown-panel>header span { color: var(--cz-muted); font: 8px/1.35 monospace; text-transform: uppercase; letter-spacing: .06em; }
.budget-breakdown-panel>header h3 { margin: 14px 0 0; font: 500 24px/1 Georgia,serif; }
.budget-breakdown-panel>header>strong { font: 500 19px/1 Georgia,serif; white-space: nowrap; }
.breakdown-ranked { padding: 8px 20px 18px; }
.breakdown-rank-row { padding: 13px 0 10px; border-bottom: 1px solid var(--cz-line); }
.breakdown-rank-label { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 4px 9px; align-items: baseline; }
.breakdown-rank-label code { grid-row: 1/3; color: var(--cz-muted); font-size: 9px; }
.breakdown-rank-label strong { min-width: 0; font-size: 11px; line-height: 1.3; }
.breakdown-rank-label span { color: var(--cz-muted); font-size: 9px; }
.breakdown-rank-track { height: 5px; margin: 9px 0 0 51px; background: #ece9e1; }
.breakdown-rank-track i { display: block; height: 100%; background: var(--cz-green); }
.budget-breakdown-panel:nth-child(2) .breakdown-rank-track i { background: var(--cz-ink); }
.budget-breakdown-panel:nth-child(3) .breakdown-rank-track i { background: #86b6ff; }
.breakdown-full { border-top: 1px solid var(--cz-line); }
.breakdown-full summary { padding: 16px 20px; color: var(--cz-green); font: 700 10px monospace; cursor: pointer; }
.breakdown-full>div { max-height: 480px; overflow: auto; border-top: 1px solid var(--cz-line); }
.breakdown-full table { width: 100%; min-width: 620px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.breakdown-full th,.breakdown-full td { padding: 11px 13px; border-bottom: 1px solid var(--cz-line); text-align: right; font-size: 10px; }
.breakdown-full thead th { position: sticky; top: 0; z-index: 1; background: var(--cz-ink); color: white; font: 700 8px monospace; text-transform: uppercase; }
.breakdown-full tbody th { max-width: 390px; text-align: left; font-weight: 600; }
.breakdown-full th:first-child,.breakdown-full td:first-child { text-align: left; }
.budget-financing-detail { margin-top: 14px; }
.budget-financing-detail .budget-breakdown-panel>header { min-height: 86px; }
.breakdown-method-note { margin: 20px 0 0; color: var(--cz-muted); font-size: 10px; line-height: 1.6; }
.breakdown-method-note code { font-size: 9px; }
.plan-track,.mix-track { position: relative; height: 28px; margin-top: 12px; background: #e6e2d9; }
.plan-track i,.mix-track i { display: block; height: 100%; background: var(--cz-green); }
.plan-track b,.mix-track b { position: absolute; right: 8px; top: 6px; font-size: 11px; }
.plan-note { display: flex; gap: 30px; padding-top: 20px; border-top: 1px solid #dedad1; color: var(--cz-muted); font-size: 12px; }
.plan-note b { color: var(--cz-ink); }
.panel-title { margin-bottom: 30px; }
.panel-title h3 { margin: 0; font: 500 28px Georgia,serif; }
.panel-title>strong { font-size: 12px; }
.mix-row { margin-top: 20px; }
.mix-row>div:first-child i { width: 9px; height: 9px; margin-right: 8px; flex: none; }
.mix-row>div:first-child strong { margin-right: auto; font-size: 13px; }
.mix-track { height: 20px; }
.mix-track b { top: 4px; }

.cash-story { display: grid; grid-template-columns: 1fr auto 1fr .8fr; gap: 1px; align-items: stretch; background: var(--cz-line); border: 1px solid var(--cz-line); }
.cash-story article,.cash-story aside { padding: 30px; background: white; }
.cash-story span { display: block; color: var(--cz-muted); font: 10px monospace; text-transform: uppercase; }
.cash-story strong { display: block; margin-top: 14px; font: 500 31px Georgia,serif; }
.cash-story>i { display: grid; place-items: center; min-width: 150px; padding: 20px; background: var(--cz-ink); color: white; font-style: normal; font-weight: 700; }
.cash-story>i.up { color: var(--cz-acid); }
.benchmark-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 36px 60px; }
.benchmark-row>div:first-child { display: flex; justify-content: space-between; gap: 20px; }
.benchmark-track { position: relative; height: 8px; margin: 15px 0 11px; background: linear-gradient(90deg,#d8d4cb 0 50%,#bfcdbf 50%); }
.benchmark-track:after { content: ""; position: absolute; left: 50%; top: -5px; height: 18px; border-left: 1px dashed var(--cz-ink); }
.benchmark-track b { position: absolute; top: -4px; width: 15px; height: 15px; border-radius: 50%; background: var(--cz-ink); box-shadow: 0 0 0 3px var(--cz-acid); }
.benchmark-row small { color: var(--cz-muted); }

.data-contract { display: grid; grid-template-columns: .9fr 1.1fr; gap: 10vw; background: var(--cz-ink); color: white; }
.data-contract p { margin-top: 22px; color: #b6bdb8; }
.source-list { display: grid; border: 1px solid #48504d; }
.source-list a { display: flex; justify-content: space-between; gap: 20px; padding: 22px; border-bottom: 1px solid #48504d; text-decoration: none; }
.source-list a:last-child { border-bottom: 0; }
.source-list span { color: #b6bdb8; font-size: 11px; }
.source-list strong { color: var(--cz-acid); font-size: 12px; }
.cz-header .municipal-lang-switch { justify-self: end; display: flex; align-items: center; gap: 6px; font: 9px/1 monospace; }
.cz-header .municipal-lang-switch a { padding: 6px 4px; border: 0; background: transparent; color: var(--cz-muted); font-weight: 800; text-decoration: none; }
.cz-header .municipal-lang-switch a[aria-current="true"] { color: var(--cz-ink); box-shadow: inset 0 -2px 0 var(--acid); }
.territorial-stack .layer-row{position:relative;border-left:8px solid transparent}.territorial-stack .municipal-layer{border-left-color:#47735c;background:#f4f7f1}.territorial-stack .region-layer{border-left-color:#86b6ff;background:#f0f5fb}.territorial-stack .combined-layer{border-left-color:#d2674d;background:#fff2ed}.consolidation-badge{display:block;margin-top:9px!important;color:var(--cz-muted);font:700 8px/1.3 monospace!important;text-transform:uppercase;letter-spacing:.06em}.combined-layer .consolidation-badge{color:#a34434}.budget-stage-table caption,.breakdown-full caption{padding:10px 13px;background:#f3efe6;color:var(--cz-muted);font:700 8px/1 monospace;text-align:left;text-transform:uppercase;letter-spacing:.07em}

@media (max-width: 1100px) {
  .entity-grid { grid-template-columns: repeat(2,1fr); }
  .directory-filters { grid-template-columns: repeat(3,1fr); }
  .directory-filters button { min-height: 58px; }
  .analysis-ready { grid-template-columns: 1fr; }
  .detail-kpis { grid-template-columns: repeat(2,1fr); }
  .detail-controls { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 760px) {
  .breadcrumbs { padding: 18px 20px; overflow-x: auto; white-space: nowrap; }
  .cz-hero,.detail-hero { grid-template-columns: 1fr; padding: 55px 20px; }
  .cz-hero h1,.detail-hero h1 { font-size: 17vw; }
  .cohort-switch { width: 100%; }
  .cz-totals,.detail-kpis { grid-template-columns: 1fr 1fr; }
  .cz-totals article,.detail-kpis article { padding: 22px 20px; border-bottom: 1px solid var(--cz-line); }
  .directory,.analysis-ready,.detail-analysis,.data-contract { padding: 72px 20px; }
  .directory-title,.detail-section-title,.data-contract { grid-template-columns: 1fr; gap: 24px; }
  .directory-filters { grid-template-columns: 1fr; }
  .entity-grid,.analysis-grid,.detail-grid,.benchmark-panel { grid-template-columns: 1fr; }
  .entity-card { min-height: 330px; }
  .detail-score { width: calc(100% - 10px); }
  .detail-actions { align-items: flex-start; flex-direction: column; }
  .detail-controls { grid-template-columns: 1fr; }
  .municipal-breakdown-explorer { margin-top: 58px; }
  .breakdown-heading,.budget-breakdown-grid { grid-template-columns: 1fr; }
  .breakdown-heading { gap: 18px; }
  .breakdown-stage-tabs { width: 100%; }
  .breakdown-stage-tabs button { min-width: max-content; flex: 1; padding-inline: 13px; }
  .budget-breakdown-panel>header { min-height: 96px; }
  .cash-story { grid-template-columns: 1fr; }
  .cash-story>i { min-height: 65px; }
  .plan-note { flex-direction: column; gap: 10px; }
}

/* All-municipality and long-term fiscal views */
.wide-switch { min-width: min(520px,100%); }
.wide-switch a { flex: 1; }
.territorial-stack,.municipal-aggregate-story,.history-explorer,.nationwide-history { padding: 90px 5vw; border-bottom: 1px solid var(--cz-line); }
.layer-row { display: grid; grid-template-columns: 260px 1fr; gap: 30px; align-items: center; padding: 24px 26px; margin-top: 10px; background: white; border: 1px solid var(--cz-line); box-shadow: 0 5px 0 rgba(23,26,25,.04); }
.layer-row>div>span,.layer-row>div>small { display: block; color: var(--cz-muted); }
.layer-row>div>span { font: 700 11px monospace; text-transform: uppercase; letter-spacing: .08em; }
.layer-row>div>strong { display: block; margin: 5px 0; font: 500 36px Georgia,serif; }
.layer-row dl { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin: 0; }
.layer-row dl div { border-left: 1px solid #dedad1; padding-left: 18px; }
.layer-row dt { color: var(--cz-muted); font: 9px monospace; text-transform: uppercase; }
.layer-row dd { margin: 8px 0 0; font-weight: 750; }
.method-warning { margin: 18px 0 0; padding: 17px 20px; background: #fff2cf; border-left: 4px solid #d7a731; color: #55461e; font-size: 12px; line-height: 1.55; }
.municipal-aggregate-story { background: #f4f1e9; }
.aggregate-equation { display: grid; grid-template-columns: minmax(0,1fr) 40px minmax(0,1fr) 40px minmax(0,1fr); align-items: stretch; }
.aggregate-cohort { padding: 26px; background: white; border: 1px solid var(--cz-line); }
.aggregate-cohort>span,.aggregate-cohort>small { display: block; color: var(--cz-muted); }
.aggregate-cohort>span { font: 700 11px monospace; text-transform: uppercase; letter-spacing: .08em; }
.aggregate-cohort>strong { display: block; margin: 9px 0 2px; font: 500 clamp(34px,4vw,58px)/1 Georgia,serif; }
.aggregate-cohort>small { font-size: 11px; }
.aggregate-cohort>small i { font-style: normal; }
.aggregate-cohort dl { display: grid; gap: 14px; margin: 26px 0 0; }
.aggregate-cohort dl div { padding-top: 13px; border-top: 1px solid #dedad1; }
.aggregate-cohort dt { color: var(--cz-muted); font: 9px monospace; text-transform: uppercase; }
.aggregate-cohort dd { margin: 7px 0 0; font-size: clamp(17px,1.8vw,25px); font-weight: 750; }
.good-cohort { border-top: 5px solid #47735c; }
.bad-cohort { border-top: 5px solid #d2674d; }
.net-cohort { border-top: 5px solid var(--cz-ink); background: var(--cz-ink); color: white; }
.net-cohort>span,.net-cohort>small,.net-cohort dt { color: #babdb7; }
.net-cohort dl div { border-color: #424743; }
.net-cohort .positive { color: #d9ff69; }
.equation-sign { display: grid; place-items: center; font: 500 34px Georgia,serif; }
.piggy-panel { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(320px,.85fr); gap: 50px; margin-top: 34px; padding: 34px; background: #fff2cf; border: 1px solid #ead79d; }
.piggy-copy h3 { margin: 14px 0; font: 500 clamp(30px,4vw,52px)/1 Georgia,serif; letter-spacing: -.04em; }
.piggy-copy p { margin: 0 0 22px; font-size: 17px; line-height: 1.55; }
.piggy-copy>small { display: block; max-width: 72ch; color: #695f46; line-height: 1.55; }
.piggy-panel ol { margin: 0; padding: 0; list-style: none; border-top: 1px solid #d9c991; }
.piggy-panel li { border-bottom: 1px solid #d9c991; }
.piggy-panel li a { display: flex; justify-content: space-between; gap: 20px; padding: 14px 2px; text-decoration: none; }
.piggy-panel li a:hover span { text-decoration: underline; text-underline-offset: 3px; }
.piggy-panel li strong { color: var(--cz-red); white-space: nowrap; }
.compact-entity-card { min-height: 315px; }
.compact-entity-card h2 { margin: 34px 0 20px; font-size: 27px; }
.load-more { display: block; margin: 30px auto 0; padding: 15px 24px; border: 1px solid var(--cz-ink); background: transparent; font-weight: 750; cursor: pointer; }
.load-more:hover { background: var(--cz-ink); color: white; }
.result-meta a { font-weight: 700; text-underline-offset: 3px; }
.history-explorer { background: #f4f1e9; }
.nationwide-history { background: #eef1ec; scroll-margin-top: 150px; }
.nationwide-history-controls { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 28px 0 0; }
.nationwide-history-controls label { min-width: 220px; display: grid; gap: 7px; }
.nationwide-history-controls label span { color: var(--cz-muted); font: 9px monospace; text-transform: uppercase; letter-spacing: .08em; }
.nationwide-history-controls select { padding: 13px 15px; border: 1px solid var(--cz-line); background: white; color: var(--cz-ink); font-size: 15px; font-weight: 750; }
.nationwide-history-controls p { margin: 0 0 13px; color: var(--cz-muted); font-size: 12px; }
.spending-benchmark { margin-top: 64px; padding-top: 56px; border-top: 1px solid var(--cz-line); }
.benchmark-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; margin: 28px 0; padding: 1px; background: var(--cz-line); }
.benchmark-summary article { padding: 20px; background: white; }
.benchmark-summary span,.benchmark-summary small { display: block; color: var(--cz-muted); font-size: 10px; }
.benchmark-summary strong { display: block; margin: 10px 0 4px; font: 500 clamp(20px,2.2vw,32px) Georgia,serif; }
.spending-benchmark-chart { display: grid; gap: 14px; padding: 24px; border: 1px solid var(--cz-line); background: white; }
.spending-benchmark-chart article { display: grid; grid-template-columns: minmax(220px,.9fr) 2fr; align-items: center; gap: 22px; }
.spending-benchmark-chart header { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 14px; }
.spending-benchmark-chart header span { color: var(--cz-ink); font-size: 12px; font-weight: 750; }
.spending-benchmark-chart header strong { font: 500 17px Georgia,serif; }
.spending-benchmark-chart header small { grid-column: 1/-1; color: var(--cz-muted); font-size: 10px; }
.spending-benchmark-chart article > div { height: 13px; background: #e4e7e1; overflow: hidden; }
.spending-benchmark-chart article > div i { display: block; height: 100%; background: var(--cz-green); }
.entity-spending-benchmark { display: grid; gap: 4px; margin: 14px 0 18px; padding: 12px 0; border-block: 1px solid var(--cz-line); }
.entity-spending-benchmark span,.entity-spending-benchmark small { color: var(--cz-muted); font-size: 10px; }
.entity-spending-benchmark strong { font: 500 18px Georgia,serif; }
.history-select { min-width: 280px; display: grid; gap: 7px; }
.history-select span { color: var(--cz-muted); font: 9px monospace; text-transform: uppercase; }
.history-select select { padding: 13px 15px; border: 1px solid var(--cz-line); background: white; font-weight: 700; }
.history-kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; margin: 28px 0; padding: 1px; background: var(--cz-line); }
.history-kpis article { padding: 20px; background: white; }
.history-kpis span,.history-kpis small { display: block; color: var(--cz-muted); font-size: 10px; }
.history-kpis strong { display: block; margin: 10px 0 4px; font: 500 clamp(20px,2.2vw,32px) Georgia,serif; }
.history-legend { display: flex; gap: 24px; margin: 0 0 12px; font-size: 11px; }
.history-legend span { display: flex; align-items: center; gap: 7px; }
.history-legend i { width: 22px; height: 3px; }
.revenue-key { background: #47735c; }.expense-key { background: #d2674d; }.cash-key { background: #315ba6; }
.history-chart { position: relative; overflow-x: auto; padding: 12px; background: white; border: 1px solid var(--cz-line); }
.history-chart svg { display: block; width: 100%; min-width: 780px; }
.history-grid line { stroke: #ddd9d0; stroke-width: 1; }.history-grid text { fill: #77746d; font: 11px monospace; }
.history-line { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.revenue-line { stroke: #47735c; }.expense-line { stroke: #d2674d; }.cash-line { stroke: #315ba6; }
.history-point circle { fill: white; stroke: #315ba6; stroke-width: 3; }
.history-year-hit { fill: transparent; cursor: crosshair; outline: none; }
.history-year-guide,.history-hover-dot { opacity: 0; pointer-events: none; transition: opacity .14s ease; }
.history-year-guide { stroke: #171a19; stroke-width: 1.5; stroke-dasharray: 4 4; }
.history-hover-dot { fill: white; stroke-width: 3; }
.history-hover-dot.revenue-dot { stroke: #47735c; }
.history-hover-dot.expense-dot { stroke: #d2674d; }
.history-hover-dot.cash-dot { stroke: #315ba6; }
.history-year-interaction:hover .history-year-guide,
.history-year-interaction:hover .history-hover-dot,
.history-year-interaction:focus-within .history-year-guide,
.history-year-interaction:focus-within .history-hover-dot { opacity: 1; }
.history-year-interaction:focus-within .history-year-hit { fill: #d9ff6926; }
.history-tooltip { position: absolute; z-index: 3; width: 220px; padding: 14px 16px; border: 1px solid #171a19; background: #fffdf7; box-shadow: 6px 6px 0 #d9ff69; pointer-events: none; }
.history-tooltip[hidden] { display: none; }
.history-tooltip > strong { display: block; margin-bottom: 9px; font: 700 12px/1 monospace; }
.history-tooltip span { display: grid; grid-template-columns: 9px 1fr auto; gap: 7px; align-items: center; padding: 5px 0; color: var(--cz-muted); font-size: 10px; }
.history-tooltip span:last-child { grid-template-columns: 1fr auto; border-top: 1px solid var(--cz-line); }
.history-tooltip i { width: 8px; height: 8px; border-radius: 50%; }
.history-tooltip b { color: var(--cz-ink); }
.municipal-currency-control { width: fit-content; margin-top: 18px; display: grid; grid-template-columns: auto auto; align-items: center; gap: 5px 10px; padding: 10px 12px; border: 1px solid var(--cz-line); background: #fff; }
.municipal-currency-control > span { color: var(--cz-muted); font: 700 9px/1 monospace; text-transform: uppercase; letter-spacing: .07em; }
.municipal-currency-control select { min-width: 88px; padding: 8px 28px 8px 10px; border: 1px solid var(--cz-ink); background: #fffdf7; color: var(--cz-ink); font-weight: 800; cursor: pointer; }
.municipal-currency-control select:hover { background: #f0f6dc; }
.municipal-currency-control select:focus-visible { outline: 3px solid #d9ff69; outline-offset: 2px; }
.municipal-currency-control small { grid-column: 1 / -1; color: var(--cz-muted); font-size: 9px; }
.detail-kpis article,.plan-row,.mix-row,.breakdown-rank-row { transition: background-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.detail-kpis article:hover,.detail-kpis article:focus-within,
.plan-row:hover,.plan-row:focus-within,
.mix-row:hover,.mix-row:focus-within,
.breakdown-rank-row:hover,.breakdown-rank-row:focus-within { background: #f0f6dc; box-shadow: inset 4px 0 0 #a8b63f; }
.plan-row:hover .plan-track > i,.mix-row:hover .mix-track > i,.breakdown-rank-row:hover .breakdown-rank-track > i { filter: saturate(1.25) contrast(1.08); }
.history-line { transition: opacity .16s ease, stroke-width .16s ease; }
.history-chart:hover .history-line { opacity: .55; }
.history-chart:has(.history-year-interaction:hover) .history-line { opacity: 1; stroke-width: 4.5; }
.nationwide-selected-year { stroke: #171a19; stroke-width: 2; stroke-dasharray: 5 5; opacity: .6; pointer-events: none; }
.nationwide-year-hit { fill: transparent; stroke: transparent; cursor: pointer; pointer-events: all; }
.selected-year-label { fill: #171a19!important; font-weight: 800!important; }
.selected-history-row { background: #f0f6dc; }
.history-table { margin-top: 15px; border: 1px solid var(--cz-line); background: white; }
.history-table summary { padding: 16px 20px; cursor: pointer; font-weight: 700; }
.history-table>div { overflow-x: auto; }
.history-table table { width: 100%; border-collapse: collapse; }
.history-table th,.history-table td { padding: 11px 18px; border-top: 1px solid #e4e0d7; text-align: right; font-size: 12px; }
.history-table th:first-child { text-align: left; }

@media (max-width: 900px) {
  .layer-row { grid-template-columns: 1fr; }
  .layer-row dl { grid-template-columns: 1fr 1fr; }
  .aggregate-equation { grid-template-columns: 1fr; }
  .equation-sign { min-height: 48px; }
  .piggy-panel { grid-template-columns: 1fr; }
  .history-kpis { grid-template-columns: 1fr 1fr; }
  .benchmark-summary { grid-template-columns: 1fr 1fr 1fr; }
  .spending-benchmark-chart article { grid-template-columns: minmax(190px,.9fr) 2fr; }
}

@media (max-width: 760px) {
  .territorial-stack,.municipal-aggregate-story,.history-explorer,.nationwide-history { padding: 70px 20px; }
  .wide-switch { display: grid; grid-template-columns: 1fr; }
  .layer-row dl { grid-template-columns: 1fr; }
  .layer-row dl div { border-left: 0; border-top: 1px solid #dedad1; padding: 12px 0 0; }
  .piggy-panel { gap: 28px; padding: 25px 20px; }
  .piggy-panel li a { align-items: baseline; }
  .history-kpis { grid-template-columns: 1fr; }
  .benchmark-summary { grid-template-columns: 1fr; }
  .spending-benchmark { margin-top: 46px; padding-top: 42px; }
  .spending-benchmark-chart { padding: 18px; }
  .spending-benchmark-chart article { grid-template-columns: 1fr; gap: 8px; }
  .nationwide-history-controls { align-items: stretch; flex-direction: column; }
  .nationwide-history-controls label { min-width: 0; }
  .nationwide-history-controls p { margin: 0; }
  .nationwide-history { scroll-margin-top: 130px; }
}
