/* =============================================================
   HL Dashboard — OCHA Humanitarian Leadership Snapshot
   Design tokens imported from ocha_dataviz_online v2026.x
   ============================================================= */

:root {
  /* ── OCHA common-design-system tokens ────────────────────────
     Mirrors https://un-ocha.github.io/ocha-common-design-system-BDU/.
     Never hardcode hex anywhere else in this file — always use these. */

  /* UN Blue (signature — use AA variant for any text on white) */
  --brand-primary:        #009EDB;  /* fills, backgrounds, brand moments    */
  --brand-primary--text:  #0077B8;  /* text on white (WCAG AA)              */
  --brand-primary--dark:  #004987;  /* hover / dark accents                 */
  --brand-primary--light: #64BDEA;  /* tints, focus                         */
  --brand-primary--navy:  #002E6E;  /* darkest step of UN Blue ramp         */
  --brand-primary--pale:  #C5DFEF;  /* pale ramp step                       */
  --brand-primary--ice:   #E3EDF6;  /* ice-pale ramp step                   */

  /* OCHA accent colours — use sparingly. Only WCAG-AA text variants are
     applied to text on white. Fills can use the original. */
  --brand-green:          #72BF44;  --brand-green--text:  #27833A;
  --brand-yellow:         #FFC800;
  --brand-orange:         #F58220;  --brand-orange--text: #CF3F0B;
  --brand-red:            #ED1847;  --brand-red--text:    #EB0045;
  --brand-purple:         #A05FB4;  --brand-purple--text: #733D96;
  --brand-slate:          #AEA29A;
  --brand-grey--neutral:  #999999;

  /* Greys (design-system aliases) */
  --brand-default-text-color: #4D4D4D;
  --brand-grey--text:     #737373;
  --brand-grey:           #F2F2F2;  /* surface            */
  --brand-grey--border:   #BFBFBF;
  --brand-grey--line:     #E6E6E6;  /* map neighbour fill */

  /* UN Blue 7-step sequential ramp (for choropleth-style tints) */
  --blue-1: #002E6E;  --blue-2: #004987;  --blue-3: #0074B7;  --blue-4: #009EDB;
  --blue-5: #64BDEA;  --blue-6: #C5DFEF;  --blue-7: #E3EDF6;

  /* Map-specific (per OCHA map spec) */
  --map-ocean:     #E1E8F6;
  --map-coastline: #64BEEB;
  --map-land:      #E6E6E6;  /* neighbouring country */
  --map-featured:  #FFFFFF;
  --map-border-intl:   #8A8C8E;
  --map-border-admin1: #C7C8CA;

  /* Typography */
  --font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --font-cond: 'Roboto Condensed', var(--font-sans);
  --font-mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Text roles */
  --text:        var(--brand-default-text-color); /* body */
  --text-muted:  var(--brand-grey--text);
  --text-dim:    var(--brand-grey--neutral);
  --text-strong: #1A1A1A;
  --text-inv:    #FFFFFF;
  --text-brand:  var(--brand-primary--text);      /* text links on white  */
  --text-title:  var(--brand-primary--navy);      /* page / section titles */

  /* Surfaces — canvas is pure white everywhere on screen. Only KPI
     cards and highlight cards sit on `--bg-soft` to give them mild
     contrast against the white. */
  --bg-page:    #FFFFFF;           /* page background (was #F4F6F8)  */
  --bg-paper:   #FFFFFF;           /* inside of .page                */
  --bg-soft:    #F6F9FC;           /* subtle surface for accent cards */
  --border:     #E6EAEF;
  /* Bumped from #EEF2F6 → #D5DCE3 in v2 so chart-card outlines and
     table row separators read clearly against the white surface
     without feeling heavy. Used by .chart-card, .chart-card__head
     underline, .table-wrap, .table-toolbar bottom rule, table.data
     td bottom rules, .page-foot top rule, and chart-axis tick lines
     (which stay subtle thanks to their .5 stroke-width). */
  --border-soft:#D5DCE3;
  --border-rule:#E1E8EF;           /* slightly warmer for section rules */

  /* A4 LANDSCAPE at 96 DPI (297mm × 210mm) */
  --page-w: 1123px;
  --page-h: 794px;
  --page-pad: 36px;

  /* Elevation */
  --shadow-1: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --shadow-2: 0 4px 14px rgba(0,0,0,.08), 0 10px 30px rgba(0,0,0,.05);

  /* ── v2 redesign tokens ──────────────────────────────────────
     Editorial layer added on top of the OCHA design system. These
     tokens drive the navy hero, the alternating warm-paper / white
     section rhythm, and the inkier body colour. Every value is a
     warm-neutral or a re-alias of an existing OCHA blue — no new
     brand colours. */
  /* Alternating section background — applied to even-indexed .page
     sections (Pages 2 / 4 / 6) so the dashboard reads as a clear
     editorial rhythm of white / grey / white / grey. Cool grey so it
     pairs with UN Blue rather than competing with it. Bumped from
     #F1F3F6 → #E9EDF1 so the alternation reads clearly even from
     across the room. Old name was --ocha-warm-bg / --ocha-warm-rule
     (warm paper); v2 is grey. */
  --section-alt-bg:   #E9EDF1;
  --section-alt-rule: #D7DCE2;
  --ocha-ink:       #1A1F2C;          /* slightly inkier body for editorial */
  --hero-from:      var(--brand-primary--navy);  /* navy 1, hero gradient top */
  --hero-to:        #003C7D;          /* gradient bottom (warmer than navy) */
}

/* Local Roboto (so PDFs render correctly offline).
   If Roboto files are missing, the system falls back gracefully. */
@font-face {
  font-family: 'Roboto';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: local('Roboto'), url('assets/fonts/Roboto-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: local('Roboto Medium'), url('assets/fonts/Roboto-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: local('Roboto Bold'), url('assets/fonts/Roboto-Bold.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto Condensed';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: local('Roboto Condensed'), url('assets/fonts/RobotoCondensed-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto Condensed';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: local('Roboto Condensed Bold'), url('assets/fonts/RobotoCondensed-Bold.woff2') format('woff2');
}

/* =============================================================
   v2 redesign primitives
   -------------------------------------------------------------
   Shared building blocks introduced for the editorial redesign.
   Each is a pure CSS recipe — no JS changes required — so any
   render module can adopt them without touching the others.

   Inventory:
     .section-head          editorial section heading (kicker + title + dek)
     .chart-card__head      title + figure tag row inside a chart card
     .chart-card__title
     .chart-card__tag
     .observation           full-width callout under a chart group
     .observation__kicker
     .kicker-rule           small uppercase eyebrow with bottom warm-rule
     .link-row              full-width row with trailing external icon
     .hero / .hero__*       Page 1 navy gradient hero band (Phase 2 mounts it)
     .mega-footer           navy bottom bar (Phase 5 mounts it)

   These primitives are the canonical building blocks for the
   editorial layout. Pages and components compose them.
   ============================================================= */

/* ── section-head — numbered editorial heading at the top of each
   section. 2-digit tab on a 2 px UN-Blue rule + kicker + condensed
   title + italic dek. The ordinal also appears in the PDF and the
   Google Sheet so producers and editors can talk in the same
   vocabulary ("update section 03"). */
.section-head {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  margin-bottom: 22px;
}
.section-head__num {
  flex: 0 0 auto;
  min-width: 36px;
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .16em;
  color: var(--brand-primary);
  padding-top: 10px;
  border-top: 2px solid var(--brand-primary);
}
.section-head__body {
  flex: 1;
  min-width: 0;
}
.section-head__kicker {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--blue-3);
  margin-bottom: 6px;
}
.section-head__title {
  margin: 0;
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.012em;
  color: var(--text-title);
}
.section-head__dek {
  margin-top: 8px;
  font-size: 17px;
  line-height: 1.5;
  color: #4b5563;
  font-style: italic;
  max-width: 820px;
  text-wrap: pretty;
}
.section-head__action {
  flex: 0 0 auto;
}

/* ── chart-card BEM extensions — sit on top of the existing .chart-card.
   The plain .chart-card stays available for any caller that doesn't
   need the figure-tag head pattern. */
.chart-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
  gap: 12px;
}
.chart-card__title {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.005em;
  color: var(--text-title);
  margin: 0;
}
.chart-card__tag {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--blue-3);
  white-space: nowrap;
}

/* ── observation — call-out placed below a chart grid.
   Outer wrapper participates in the page content shell (so its
   left + right edges align with chart-grid above); the warm-bg
   styling lives on .observation__inner so the visible block has
   its own balanced internal padding regardless of the shell
   horizontal padding. */
.observation {
  margin-top: 22px;
  /* No background or border here — those are on .observation__inner. */
}
.observation__inner {
  /* Pale OCHA blue (--brand-primary--ice = #E3EDF6) — distinct from
     both the white pages and the grey alternating bg, so the
     callout reads as "this is a call-out" on every section. */
  background: var(--brand-primary--ice);
  border-left: 3px solid var(--brand-primary);
  padding: 18px 24px;
}
.observation__kicker {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-title);
  margin-bottom: 6px;
}
.observation__body {
  font-size: 17px;
  line-height: 1.55;
  color: #1f2937;
  text-wrap: pretty;
}
.observation__body p { margin: 0 0 8px; }
.observation__body p:last-child { margin: 0; }

/* ── kicker-rule — small uppercase eyebrow above a prose block,
   with a bottom rule that sits on the section's warm tint. */
.kicker-rule {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-title);
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--section-alt-rule);
}

/* ── link-row — full-width interactive row, used in the Highlights
   link list and the Resources columns. Trailing space reserved for
   an external-link or chevron icon. */
.link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--section-alt-rule);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-title);
  text-decoration: none;
  cursor: pointer;
}
.link-row:hover { color: var(--brand-primary--text); }
.link-row__trail {
  margin-left: auto;
  flex: 0 0 auto;
}
/* Where .link-row__trail is the OCHA Link icon <img>, render it
   small + muted. (SVG uses currentColor but <img> fixes the colour
   to the SVG's intrinsic UN-Blue, which sits well in the link list
   without further treatment.) */
img.link-row__trail {
  width: 12px;
  height: 12px;
  opacity: .7;
}
img.link-row__trail:hover { opacity: 1; }

/* ── Hero band (Page 1 only) ────────────────────────────────
   Navy gradient that opens the dashboard. Lives inside Page 1
   so it ships with A4 sheet 1 in print, but on screen it breaks
   out to 100 vw via the standard "negative-margin to viewport"
   trick — gives a true editorial full-bleed regardless of
   .pages padding. In `.pages.a4-mode` (PDF export) we cancel
   the break-out below so the hero sits inside the A4 sheet. */
.hero {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  /* No margin-bottom: the cover page sits on the alternating grey
     background, so any space below the hero would render as a grey
     strip inside the cover. The next .page (Section 01) has its
     own padding-top, which is what gives the breathing room
     between the navy hero and the section-head. */
  padding: 40px 0 56px;
  background: linear-gradient(180deg, var(--hero-from) 0%, var(--hero-to) 100%);
  color: #fff;
  overflow: hidden;
}
/* In A4 / print mode, hero stays inside its .page-inner box. */
.pages.a4-mode .hero {
  width: auto;
  margin-left: 0;
  margin-right: 0;
}
/* Fine vertical-grid texture in the hero — purely decorative,
   pulled almost imperceptible. Uses repeating-linear-gradient
   so no extra DOM nodes are needed. Stripe alpha was dropped
   from 0.04 → 0.015 per design feedback (was reading too active
   against the navy gradient). */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.015) 0,
    rgba(255,255,255,0.015) 1px,
    transparent 1px,
    transparent 80px);
  pointer-events: none;
}
.hero__shell {
  position: relative;
  /* Content shell — centers hero contents at a comfortable
     reading max while the navy gradient .hero stays 100 vw.
     1320 px on screen (Bootstrap-standard editorial cap), 1500 px
     in A4 / PDF export to fill the print sheet inner box. */
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 72px);
}
.pages.a4-mode .hero__shell {
  max-width: 1500px;
  padding: 0 56px;
}

/* Top utility row — IASC logo on the left, action buttons right. */
.hero__utility {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 36px;
}
.hero__brand { display: inline-flex; align-items: center; }
.hero__logo {
  height: 26px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);   /* render the navy SVG as white */
}
.hero__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 7px 14px;
  cursor: pointer;
  transition: background .15s ease;
}
.hero__btn:hover { background: rgba(255,255,255,0.12); }
.hero__btn--primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}
.hero__btn--primary:hover { background: #00B0EE; }
/* OCHA-icon glyph inside hero buttons. <img> renders white via the
   filter trick (since the SVG uses currentColor + #009edb fallback,
   and we want it pure white in the navy hero context). */
.hero__btn-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: -2px;
  filter: brightness(0) invert(1);
}
.hero__btn-icon--char {
  width: auto;
  height: auto;
  filter: none;
  font-size: 14px;
  line-height: 1;
}

/* Masthead — kicker + oversized condensed title + subline. */
.hero__masthead { max-width: 920px; margin-bottom: 40px; }
.hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--brand-primary--pale);
  margin-bottom: 18px;
}
.hero__kicker-dot {
  width: 8px;
  height: 8px;
  background: var(--brand-primary);
  display: inline-block;
}
.hero__title {
  margin: 0;
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: clamp(36px, 6vw, 76px);
  line-height: 0.96;
  letter-spacing: -0.018em;
  color: #fff;
}
.hero__subline {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-cond);
  font-size: 16px;
  color: var(--brand-primary--pale);
  letter-spacing: .04em;
}
.hero__subline strong {
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.hero__sep { opacity: .5; }

/* KPI rail — 5 cells, white-on-navy, separated by hairline rules.
   Overrides the default .kpi card style when its parent is .hero__rail. */
.hero__rail {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.14);
}
.hero__rail .kpi {
  background: transparent;
  border-left: 1px solid rgba(255,255,255,0.14);
  border-radius: 0;
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}
.hero__rail .kpi:first-child { border-left: none; }
.hero__rail .kpi .kpi-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  align-self: flex-start;
  justify-self: flex-start;
}
.hero__rail .kpi .kpi-icon svg path,
.hero__rail .kpi .kpi-icon svg circle,
.hero__rail .kpi .kpi-icon svg polygon { fill: var(--brand-primary--light); }
.hero__rail .kpi .value {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
  grid-column: auto;
  grid-row: auto;
}
.hero__rail .kpi .value .unit {
  font-size: .55em;
  margin-left: 2px;
  color: var(--brand-primary--pale);
}
.hero__rail .kpi .label {
  margin-top: 10px;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  line-height: 1.35;
  letter-spacing: 0;
  text-transform: none;
  grid-column: auto;
  grid-row: auto;
}

/* ── Page-1 v2 layout (.overview-layout) ────────────────
   Hero takes the top of the page, then the map sits full-width
   below it, then the two prose blocks share a 2-column row. */
.overview-layout {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  /* On screen, rows size to content (auto) so the map is its
     natural aspect-ratio height and the prose row is its natural
     reading height — no awkward white space at the bottom of
     Section 01 from a `1fr` row stretching to fill the page.
     A4 / PDF mode below restores `1.5fr / 1fr` so the grid fills
     the print sheet height exactly. */
  grid-template-rows: auto auto;
  gap: 28px 24px;
  margin-top: 28px;
  padding: 0;
  min-height: 0;
}
.pages.a4-mode .overview-layout {
  grid-template-rows: minmax(0, 1.5fr) minmax(0, 1fr);
  flex: 1;
}
.overview-layout .map-wrap                 { grid-column: 1 / -1; grid-row: 1; min-height: 0; }
.overview-layout .overview-block--overview { grid-column: span 6; grid-row: 2; }
.overview-layout .overview-block--lotm     { grid-column: span 6; grid-row: 2; }
.overview-layout .map-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
}
/* Map container matches the world-map.svg's natural aspect ratio
   (868.5 / 523.77 ≈ 1.66) so when its width grows to fill the
   shell, its height grows in step. Combined with the map's
   `preserveAspectRatio="xMinYMid meet"` this guarantees the map
   image fills the container edge-to-edge — no empty space on
   the right at any viewport. */
.overview-layout .map-wrap .map-container {
  width: 100%;
  aspect-ratio: 868.5 / 523.77;
  height: auto;
  flex: 0 0 auto;
}
.overview-layout .overview-block {
  background: transparent;
  padding: 0;
  border-radius: 0;
}
/* Section 01 prose-block headings ("Overview", "Leadership on the
   move") use the kicker-rule treatment: Roboto Condensed, .18em
   letterspaced, navy text, warm-rule underline. */
.overview-block h3 {
  font-family: var(--font-cond);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-title);
  border-bottom: 1px solid var(--section-alt-rule);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

/* The cover (.page--hero) holds ONLY the hero band — no other
   content. Drop all .page padding so the navy gradient fills the
   sheet edge-to-edge with no stray grey strip below the hero.
   Breathing room before Section 01 comes from the next .page's
   own padding-top. */
.page--hero { padding: 0 !important; }

/* ── Mega-footer (web only) ─────────────────────────────────
   Full-width navy band that closes the dashboard on screen.
   Hidden in print + A4 export — the per-page .page-foot
   handles PDF page-numbering. */
.mega-footer {
  background: var(--brand-primary--navy);
  color: #fff;
  padding: 36px 0 32px;
  margin-top: 0;
}
.mega-footer__shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 72px);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  flex-wrap: wrap;
}
.mega-footer__brand {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .04em;
  color: #fff;
}
.mega-footer__meta {
  font-family: var(--font-cond);
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  text-align: right;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.5;
}

/* Hide mega-footer in A4 export and print — the per-page foot
   keeps page numbers in the PDF. The web view shows the mega
   footer instead of repeating the small page foot at the bottom. */
.pages.a4-mode ~ .mega-footer { display: none; }
@media print { .mega-footer { display: none !important; } }

/* End of v2 primitives ===================================== */

/* Reset ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  /* Default body size — 1 em. Browsers default to 16 px root, so this
     is the standard readable size. Everything else on the page is sized
     in relative `em` multiples against this. */
  font-size: 1em;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* The Page-1 hero uses `width: 100vw` + negative margins to break
     out of its container and become a true full-bleed band. On some
     browsers 100vw includes the vertical scrollbar width and causes
     a few pixels of horizontal scroll on the body. Clipping here is
     safe because nothing legitimately scrolls horizontally — wide
     tables scroll inside their own container. */
  overflow-x: hidden;
}
/* A4 (print + PNG export) drops the root to 13 px so the compact
   layout fits an A4 landscape sheet. */
h1, h2, h3, h4, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: var(--brand-primary--text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Generic .btn (default look — overridden by .hero__btn variant for
   action buttons in the navy hero band). */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--bg-soft); border-color: #CCD1D7; }
.btn.primary {
  color: #fff;
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn.primary:hover { background: var(--brand-primary--text); border-color: var(--brand-primary--text); }

/* Pages container ------------------------------------------
   Single continuous white surface that holds every section. Wider
   side gutters at larger viewports give the content room to breathe.
   A4 / print mode overrides below restore the per-page card look. */
.pages {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  /* v2: container has NO horizontal padding so each .page can host
     its own alternating background (white / warm-paper) that runs
     edge-to-edge across the viewport. Each .page provides its own
     horizontal padding instead. `.pages.a4-mode` below resets to
     the per-sheet model for PDF export. */
  padding: 0;
  max-width: none;
  margin: 0;
  background: var(--bg-paper);
}

/* Page ------------------------------------------------------
   On screen the page is FLUID — it grows to whatever width the reader
   has, with a comfortable max so line-length doesn't become unreadable.
   The page ONLY becomes exact A4-landscape dimensions when:
     • the browser is printing (`@media print` below), or
     • JS toggles `.pages.a4-mode` on the container before exporting
       a PNG — see `app/export.js`.
*/
.page {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  min-height: auto;
  /* v2: .page provides only the vertical rhythm. Horizontal padding
     lives INSIDE each content shell (see `.page > .section-head`
     etc. below) so hero shell + page content shell share the exact
     same internal-padding pattern — content edges line up across
     every page on every viewport. The alternating warm-paper bg
     can still fill the viewport edge-to-edge because .page itself
     has no horizontal padding. */
  padding: clamp(36px, 4vw, 56px) 0;
  background: transparent;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  /* No page separator on screen — alternating warm-paper / white
     section backgrounds provide the visual page-to-page rhythm. */
}
/* Alternating white / grey rhythm on screen.
   .pages now has 8 children: Cover (.page--hero) at index 1,
   then Sections 01–07 at indices 2–8. Cover is always navy
   (hero gradient covers any background), so for the rhythm
   we want even-indexed sections to be white and odd-indexed
   sections grey. With cover at index 1 (odd, doesn't matter)
   the pattern walks: 2 white, 3 grey, 4 white, 5 grey, 6
   white, 7 grey, 8 white. `.pages.a4-mode .page` below
   forces white in PDF / PNG export regardless. */
.pages > .page:nth-child(even),
.pages > section.page:nth-of-type(even) {
  background: var(--bg-paper);
}
.pages > .page:nth-child(odd),
.pages > section.page:nth-of-type(odd) {
  background: var(--section-alt-bg);
}

/* v2 content shell — centres each .page's CONTENT at a comfortable
   reading max while the .page BACKGROUND (warm-paper, navy hero,
   etc.) keeps spanning the full viewport. Same pattern as the
   Claude Design mockup's `.heroShell`: max-width 1500 px + internal
   horizontal padding so content edges sit at the SAME x-coordinate
   on every page. .page itself has no horizontal padding. */
.page > .section-head,
.page > .chart-grid,
.page > .observation,
.page > .highlights-grid,
.page > .resources,
.page > .overview-layout {
  /* 1320 px on screen (editorial cap), 1500 px in A4 / PDF export
     so the print sheet's inner box (1500 × 1061) fills properly. */
  max-width: 1320px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(20px, 4vw, 72px);
  padding-right: clamp(20px, 4vw, 72px);
}
.pages.a4-mode .page > .section-head,
.pages.a4-mode .page > .chart-grid,
.pages.a4-mode .page > .observation,
.pages.a4-mode .page > .highlights-grid,
.pages.a4-mode .page > .resources,
.pages.a4-mode .page > .overview-layout {
  max-width: 1500px;
}

/* Tables (Pages 5 + 6) sit inside a dedicated .table-shell wrapper
   that carries the same max-width + horizontal padding as the
   sibling content-shell elements, so the .table-wrap card inside
   ends up edge-aligned with section-head text, chart-grid edges,
   etc. The shell handles centering and inset; .table-wrap is just
   the card itself (border + toolbar + table). */
.page > .table-shell {
  max-width: 1320px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(20px, 4vw, 72px);
  padding-right: clamp(20px, 4vw, 72px);
}
.pages.a4-mode .page > .table-shell { max-width: 1500px; }
.page:first-child { border-top: 0; padding-top: clamp(8px, 1vw, 16px); }
.page:last-child  { padding-bottom: clamp(24px, 3vw, 40px); }

/* ── A4 export mode ──
   Strategy: keep the ENTIRE fluid layout unchanged (same paddings,
   typography, grid, gaps). To fit each section on one A4 landscape
   sheet:
     • JS wraps each `.page`'s content in a `.page-inner` div on
       `beforeprint` / PNG export.
     • `.page-inner` renders at natural fluid dimensions — 1500 ×
       1061 (same 1.414 aspect ratio as A4 landscape).
     • CSS `transform: scale(0.7487)` shrinks the inner down to
       1123 × 794 px; the outer `.page` stays locked at exact A4
       landscape dimensions with `overflow: hidden`.
   Using pure `transform: scale` (not `zoom`) because `zoom` is
   inconsistently honoured by browser print pipelines (Safari drops
   it entirely). `transform` + fixed outer box is reliable. */
.pages.a4-mode {
  gap: 20px;
  padding: 20px;
  background: #F4F6F8;       /* tint so white A4 cards read as sheets */
  max-width: none;
}
.pages.a4-mode .page {
  /* Outer box = exact A4 landscape. */
  width: 1123px;
  max-width: 1123px;
  height: 794px;
  min-height: 794px;
  max-height: 794px;
  padding: 0;
  overflow: hidden;
  margin: 0 auto;
  background: var(--bg-paper);
  box-shadow: var(--shadow-1);
  border-top: 0;
  position: relative;
}
.pages.a4-mode .page > .page-inner {
  /* Inner = natural fluid size, scaled down to fit. */
  width: 1500px;
  height: 1061px;
  padding: clamp(48px, 5vw, 72px) clamp(40px, 4vw, 64px);
  display: flex;
  flex-direction: column;
  transform: scale(0.7487);
  transform-origin: top left;
  box-sizing: border-box;
}

.page-png-btn {
  display: none;            /* hidden in the continuous on-screen view */
}
.pages.a4-mode .page-png-btn {
  display: inline-flex;
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0;
  transition: opacity .15s;
  z-index: 5;
}
.pages.a4-mode .page:hover .page-png-btn { opacity: 1; }

/* ── v2 Hero in A4 mode (PDF + PNG export) ────────────────────
   Fires when JS toggles `.pages.a4-mode` for export — whether on
   screen during PNG capture or in real print. The hero compresses
   so the whole Page 1 (hero + map + prose) fits one A4 landscape
   sheet (1500 × 1061 inner box). Numbers tuned to leave ~530 px
   for map and ~250 px for the prose row beneath. */
.pages.a4-mode .hero { padding: 26px 0 34px; }
.pages.a4-mode .hero__utility { padding-bottom: 28px; }
.pages.a4-mode .hero__masthead { margin-bottom: 32px; }
.pages.a4-mode .hero__title { font-size: 60px; }
.pages.a4-mode .hero__subline { font-size: 14px; margin-top: 14px; }
.pages.a4-mode .hero__rail .kpi { padding: 16px 18px 18px; }
.pages.a4-mode .hero__rail .kpi .value { font-size: 44px; }
.pages.a4-mode .hero__rail .kpi .label { font-size: 12px; margin-top: 6px; }
.pages.a4-mode .hero__rail .kpi .kpi-icon { width: 30px; height: 30px; margin-bottom: 6px; }
/* Tighten the page-1 v2 grid in A4 too. */
.pages.a4-mode .overview-layout {
  margin-top: 22px;
  gap: 22px 22px;
}

/* Overview-block prose styling (used inside .overview-layout
   on Page 1 / Section 01). Layout / grid rules for the
   .overview-layout container live earlier in the file. */
.overview-block div {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
}
.overview-block div p { margin: 0 0 8px; }
.overview-block div p:last-child { margin-bottom: 0; }
.overview-block div strong { color: var(--text-strong); }

/* KPIs are rendered exclusively into the navy hero rail by
   render/kpis.js. All visual rules live under `.hero__rail .kpi*`
   in the hero block earlier in the file. The v1 grey-card .kpi
   rules were removed when KPIs moved into the hero — every
   property they set was already overridden by the hero variant. */

/* Map ------------------------------------------------------- */
.map-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #fff;
}
.map-container svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Zoom controls — top-right, subtle, reveal-on-hover */
.map-zoom-ctrls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0.6;
  transition: opacity .15s;
}
.map-container:hover .map-zoom-ctrls { opacity: 1; }
.map-zoom-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: #fff;
  font: 600 14px/1 var(--font-sans);
  color: var(--text);
  cursor: pointer;
  border-radius: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-zoom-btn:hover {
  background: var(--bg-soft);
  border-color: var(--brand-primary);
  color: var(--brand-primary--text);
}
/* Neighbouring country / landmass fill per OCHA map spec. International
   boundaries show through via the coloured stroke. */
.map-country {
  fill: var(--map-land);
  stroke: var(--map-border-intl);
  stroke-width: .6;
  transition: filter .15s;
}
.map-country.has-leader {
  cursor: pointer;
  stroke: #fff;
  stroke-width: .8;
}
.map-country.has-leader:hover {
  filter: brightness(.92);
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}
.map-legend .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid var(--brand-grey--border);
}
/* "+ DHC" diamond swatch — mirrors the map overlay marker. */
.map-legend .swatch-diamond {
  background: transparent;
  border: none;
  position: relative;
}
.map-legend .swatch-diamond::after {
  content: "";
  position: absolute;
  inset: 1px;
  background: #002E6E;
  border: 1px solid #fff;
  transform: rotate(45deg);
}
.map-tooltip {
  position: fixed;
  pointer-events: none;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  padding: 8px 10px;
  font-size: 11.5px;
  border-radius: 0;
  z-index: 100;
  max-width: 220px;
}
.map-label {
  font-size: 9px;           /* at default zoom; JS rescales on zoom */
  font-weight: 700;
  font-family: var(--font-cond);
  letter-spacing: .03em;
  fill: var(--text-strong);
  paint-order: stroke;
}
.map-label-halo {
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-cond);
  letter-spacing: .03em;
  fill: none;
  stroke: #fff;
  stroke-width: 3.5;
  stroke-linejoin: round;
  paint-order: stroke;
}
.map-tooltip .t-country { font-weight: 700; color: var(--text-title); }
.map-tooltip .t-pos { color: var(--text-muted); font-size: 10.5px; }
.map-tooltip[hidden] { display: none; }

/* Page 2 — Highlights -------------------------------------- */
.highlight-card {
  background: var(--brand-primary--ice);
  border-left: 4px solid var(--brand-primary);
  padding: 24px 28px;
  margin-bottom: 28px;
  font-size: 1em;
  line-height: 1.6;
}
.highlight-card h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand-primary--dark);
  margin-bottom: 8px;
}
/* ── Page 2 — highlights-grid + framework + link-list ──
   Two-column layout: lead prose + link list on the left,
   2 × 2 framework on the right with hairline rules between
   cells (no big colored number tiles). */
.highlights-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 56px;
  margin-top: 24px;
  flex: 1;
  align-items: start;
}
.highlights-lead {}
.highlights-body {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
}
.highlights-body p { margin: 0 0 12px; }
.highlights-body p:last-child { margin: 0; }
.highlights-body strong { color: var(--text-strong); }
.link-list { margin-top: 28px; border-top: 1px solid var(--section-alt-rule); }

.framework {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;                                /* hairline gap shows through */
  background: var(--section-alt-rule);       /* the hairline colour */
  border: 1px solid var(--section-alt-rule);
  margin-top: 0;
  margin-bottom: 0;
}
.framework .framework-item {
  background: #fff;
  padding: 26px 28px;
  font-size: 1em;
  line-height: 1.55;
}
.framework .framework-item h4 {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 26px;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--text-title);
  margin-bottom: 10px;
}
.framework .framework-item p {
  font-size: 16px;
  line-height: 1.55;
  color: #374151;
}

.highlight-links {
  font-size: 1em;
  color: var(--text-muted);
  line-height: 1.55;
}
.highlight-links a { color: var(--brand-primary--text); font-weight: 500; }

/* Pages 3 + 4 — Chart grid. Charts sit directly inside the .page,
   with .observation callouts beneath each grid. */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 32px;
  min-height: 0;
}
/* On screen the chart grid sits at its natural content height so the
   alternating page bg (white / grey) shows clearly around the cards.
   In `.a4-mode` we re-enable flex:1 so the grid fills the A4 sheet
   exactly between the section-head and the observation callout. */
.pages.a4-mode .page > .chart-grid { flex: 1; }
/* v2: observation callout sits right under the chart grid. Auto height. */
.page > .observation { flex: 0 0 auto; }
/* Slide 3: 4 charts in a 2 × 2 grid, matching the PPT layout. */
.chart-grid.characteristics {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}
/* Slide 4: two rows, one chart each (stacked). */
.chart-grid.trends {
  grid-template-columns: 1fr;
  grid-template-rows: repeat(2, 1fr);
}
.chart-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-soft);
  padding: 22px 24px;
  border-radius: 0;
  min-height: 0;
  /* White card on alternating bg: pops against grey on Page 4,
     reads as a subtle bordered region on the white pages (3/5/7).
     The grey shows around the card via the chart-grid `gap` and
     the page-level vertical padding above and below. */
  background: #fff;
}
.chart-card h3 {
  font-size: 1em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-title);
  margin-bottom: 12px;
}
.chart-card .chart {
  flex: 1;
  min-height: 0;
  position: relative;
}
.chart-card .chart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--text-muted);
}
.chart-legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  vertical-align: middle;
  border-radius: 1px;
}
/* Per-chart source + as-of line (OCHA requirement) */
.chart-source {
  margin-top: 6px;
  font-size: 9.5px;
  color: var(--text-dim);
  font-style: italic;
}

/* Map disclaimer — mandatory on any OCHA map showing boundaries */
.map-disclaimer {
  margin-top: 4px;
  font-size: 9.5px;
  font-style: italic;
  color: var(--brand-slate);
  line-height: 1.35;
}

/* SVG chart shared styles */
.c-axis-line { stroke: var(--border); stroke-width: 1; }
.c-tick-line { stroke: var(--border-soft); stroke-width: .5; }
.c-tick-label { font-size: 10px; fill: var(--text-muted); }
.c-axis-label { font-size: 10px; fill: var(--text-muted); }
.c-value-label { font-size: 10px; fill: var(--text); font-weight: 500; }
.c-bar { transition: opacity .15s; }
.c-line { fill: none; stroke-width: 2; }
.c-point { stroke: #fff; stroke-width: 1.5; }
.c-donut-center {
  font-family: var(--font-cond);
  font-size: 24px;
  font-weight: 700;
  text-anchor: middle;
  fill: var(--text-title);
}
.c-donut-sub {
  font-size: 10px;
  text-anchor: middle;
  fill: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
/* PDF / A4 export — shrink the center stack so the 3-line block
   (value + 2 label words) fits comfortably inside the donut hole
   when the whole page is proportionally scaled down to A4 landscape. */
.pages.a4-mode .c-donut-center { font-size: 18px; }
.pages.a4-mode .c-donut-sub    { font-size: 8px; letter-spacing: .04em; }
@media print {
  .c-donut-center { font-size: 18px; }
  .c-donut-sub    { font-size: 8px; letter-spacing: .04em; }
}

/* Tables ---------------------------------------------------- */
/* ── Tables (Pages 5 + 6) — v2 redesign ───────────────────────
   Navy-underline TH instead of solid-blue background; condensed
   search toolbar with a count badge on the right. The table sits
   inside a .table-wrap card that contains its own scroll on
   narrow screens (mobile fix from commit 9a1db13). */
.table-wrap {
  margin-top: 22px;
  border: 1px solid var(--border-soft);
  /* White card on the alternating page bg — same pattern as
     .chart-card: white pops against the grey on Page 6, reads
     as a subtle bordered region on white Page 5. */
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* No flex-grow on screen — let the table size to its content so
     the grey page bg shows clearly above and below. In `.a4-mode`
     we re-enable flex:1 so the table fills the A4 sheet exactly. */
}
.pages.a4-mode .table-wrap { flex: 1; }
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: #fafbfc;
}
/* Search input wrapped in a <label class="table-search"> so the
   OCHA Search icon sits flush-left inside the input frame. */
.table-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--border);
  padding: 7px 12px;
}
.table-search__icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--text-muted);
  /* SVG uses currentColor — but for an <img> tag, currentColor is
     not honoured. Fade to muted via opacity instead. */
  opacity: .55;
}
.table-search input.search {
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--ocha-ink);
  flex: 1;
  min-width: 0;
  padding: 0;
}
.table-meta {
  font-family: var(--font-cond);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}
table.data th {
  text-align: left;
  padding: 12px 14px;
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 11.5px;
  color: var(--text-title);
  background: transparent;
  letter-spacing: .14em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--text-title);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data thead { background: #fff; }
table.data th:hover { color: var(--brand-primary--text); }
table.data th.sort-asc::after  { content: ' ▴'; color: var(--brand-primary); }
table.data th.sort-desc::after { content: ' ▾'; color: var(--brand-primary); }
table.data td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  color: #1f2937;
  font-size: 16px;
  line-height: 1.45;
}
table.data tbody tr:nth-child(even) td { background: var(--bg-soft); }
table.data tbody tr:hover td { background: var(--brand-primary--ice); }
table.data td a { color: var(--brand-primary--text); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
.td-missing { color: var(--brand-grey--border); font-style: italic; }
.td-sub     { color: var(--text-muted); font-size: 10.5px; }

/* Cell-type modifiers (added by render/tables.js — see below). */
table.data td.td-country {
  font-weight: 500;
  color: var(--text-title);
}
table.data td.td-position {
  font-family: var(--font-cond);
  font-weight: 500;
}
table.data td.td-email a { color: var(--brand-primary--dark); }

/* Numeric row index column on the Leaders table. */
table.data th.col-num,
table.data td.col-num {
  width: 40px;
  text-align: left;
  font-family: var(--font-cond);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-primary--dark);
}

/* Page 7 — Resources (v2) ----------------------------------
   Three columns, each with an icon-less title + 2 px navy
   bottom rule, then .link-row items. Markup emitted by
   render/resources.js. */
.resources {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px 36px;
  margin-top: 22px;
  flex: 1;
  align-items: start;
}
.resources__col {}
.resources__head {
  padding-bottom: 12px;
  margin-bottom: 6px;
  border-bottom: 2px solid var(--text-title);
}
.resources__title {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.005em;
  color: var(--text-title);
}

/* Page footer -----------------------------------------------
   Only visible in A4 mode + print — page numbers don't make sense in
   the continuous on-screen view. Pinned to the OUTER `.page` (the
   1123 × 794 A4 frame) so every page's footer is at the same visual
   offset from the sheet bottom. Lives outside `.page-inner` so the
   scale transform doesn't affect its anchor. */
.page-foot { display: none; }
.pages.a4-mode .page > .page-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  left: 40px;
  right: 40px;
  bottom: 18px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  font-size: 10px;
  color: var(--text-dim);
  z-index: 2;
}
.page-foot .brand-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-foot .page-num::before { content: 'p. '; }

/* Empty / error states -------------------------------------- */
.data-error {
  padding: 12px 14px;
  background: #FFF4F3;
  border: 1px solid var(--brand-red);
  border-radius: 0;
  color: #8C1A13;
  font-size: 12px;
}

/* Responsive ------------------------------------------------
   Three tiers:
     • > 1163 px — desktop A4 landscape (default; nothing overridden)
     • 768–1163 px — tablet: A4 dimensions released, columns collapse
     • < 768 px — mobile: everything stacks, bigger tap targets,
                   smaller headings, map gets the full width of the viewport
*/

/* Tablet ---------------------------------------------------- */
@media screen and (max-width: 1163px) {
  .pages { padding: 0; gap: 0; }
  .page {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    /* Vertical only — horizontal inset comes from the content shell
       so warm-bg sections fill the viewport edge-to-edge and content
       on every page aligns at the same x-coord. */
    padding: 28px 0;
  }
  /* Release the fixed A4-landscape lock on the overview page so content
     can grow vertically for readability. */
  .page[data-page="overview"] {
    height: auto;
    min-height: 0;
    max-height: none;
  }
  /* Layout collapse: Page 1 stacks to a single column. */
  .overview-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 18px;
  }
  .overview-layout .map-wrap,
  .overview-layout .overview-block--overview,
  .overview-layout .overview-block--lotm { grid-column: 1 / -1; }
  /* Charts keep a 2-column layout on tablets but flatter rows. */
  .chart-grid.characteristics {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
    gap: 14px;
  }
  .chart-grid.characteristics .chart-card,
  .chart-grid.trends .chart-card { min-height: 260px; }
  .chart-grid.trends {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .resources { grid-template-columns: repeat(2, 1fr); }
  /* Lift map to a reasonable viewing height when stacked. */
  .overview-layout .map-wrap { min-height: 360px; }

  /* Tables: contain horizontal scroll inside the table so 7-col
     contacts and 5-col leaders rosters never blow out the page
     width on tablets. See the matching block in the 767 px
     breakpoint for the reasoning. Scoped to the table itself —
     we deliberately do NOT set overflow-x on .page here because
     `.pages.a4-mode .page` already manages its own overflow for
     export and we don't want to conflict with that. */
  .page { min-width: 0; max-width: 100%; }
  .table-wrap > table.data {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* v2 Hero on tablet — .page already has padding: 28px 0 (vertical
     only) so the hero just needs its top padding suppressed and
     can keep its 100 vw breakout. Content shell handles horizontal. */
  .page--hero { padding-top: 0; }
  .hero { padding: 28px 0 36px; }
  .overview-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 18px;
  }
  .overview-layout .map-wrap { min-height: 360px; }
  .overview-layout .map-wrap,
  .overview-layout .overview-block--overview,
  .overview-layout .overview-block--lotm { grid-column: 1 / -1; grid-row: auto; }
}

/* Mobile ---------------------------------------------------- */
@media screen and (max-width: 767px) {
  body { font-size: 14px; }
  .btn { padding: 8px 10px; font-size: 11.5px; }
  .pages { padding: 0; gap: 0; }
  .page {
    padding: 24px 0;     /* vertical only — shell provides horizontal inset */
    border-radius: 0;
  }

  /* All grids collapse to single column. */
  .overview-layout,
  .chart-grid,
  .chart-grid.characteristics,
  .chart-grid.trends,
  .framework,
  .resources {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
    gap: 12px;
  }
  .overview-layout .map-wrap,
  .overview-layout .overview-block--overview,
  .overview-layout .overview-block--lotm { grid-column: 1 / -1 !important; grid-row: auto !important; }

  /* Map: full-width card with a comfortable minimum height. */
  .overview-layout .map-wrap { min-height: 300px; }
  .map-zoom-ctrls { opacity: 1; }   /* always visible on touch  */
  .map-zoom-btn { width: 36px; height: 36px; font-size: 18px; }

  /* Charts: taller cards so the SVG stays legible. */
  .chart-grid.characteristics .chart-card,
  .chart-grid.trends .chart-card {
    min-height: 240px;
  }
  .chart-card h3 { font-size: 11.5px; }

  /* Tables: contain horizontal scroll INSIDE the table itself so the
     page never widens past the viewport. The previous selector
     (`.page section.page table.data`) never matched because tables
     are direct children of `section.page`, not nested — so contacts
     and leaders pages were blowing out the whole mobile layout.

     `display: block` on the <table> detaches it from the table
     layout algorithm; `overflow-x: auto` + `max-width: 100 %` then
     give us a self-contained horizontal scroll region. `.page`
     gets min-width: 0 + max-width: 100 % so it cannot refuse to
     shrink below the table's natural width and cannot grow past
     the viewport. We deliberately do NOT set overflow-x on .page
     itself — `.pages.a4-mode .page` already manages its own
     overflow for export, and the table's internal scroll is
     enough to contain the horizontal axis. */
  .page { min-width: 0; max-width: 100%; }
  table.data { font-size: 11px; }
  table.data th, table.data td { padding: 8px 8px; white-space: nowrap; }
  .table-wrap > table.data {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Toolbar sits above the table — keep it inside the page width. */
  .table-wrap > .table-toolbar { flex-wrap: wrap; gap: 8px; }
  .table-wrap > .table-toolbar input.search { flex: 1 1 100%; min-width: 0; }

  /* Long-form paragraphs need more room. */
  .overview-block div,
  .framework-item p { font-size: 12.5px; line-height: 1.5; }

  /* The per-page PNG export button is desktop-only. */
  .page-png-btn { display: none; }

  /* v2 Hero on mobile — full-width navy band with stacked utility row,
     2-column KPI grid, smaller title. The hero escapes any container
     padding via its 100 vw breakout; .page is padding 24px 0 (vertical
     only) so we just need to suppress the top padding for .page--hero. */
  .page--hero { padding-top: 0; }
  .hero { padding: 24px 0 28px; }
  .hero__shell { padding: 0 18px; }
  .hero__utility { padding-bottom: 24px; flex-wrap: wrap; gap: 12px; }
  .hero__masthead { margin-bottom: 22px; }
  .hero__kicker { font-size: 11px; margin-bottom: 12px; }
  .hero__title { font-size: clamp(28px, 9vw, 44px); }
  .hero__subline { font-size: 13px; gap: 8px; }
  .hero__btn { font-size: 11px; padding: 6px 10px; letter-spacing: .06em; }
  .hero__logo { height: 22px; }

  /* KPI rail: 5 cells → 2 cols + 1 wide.  We split visually via row
     borders so the white-on-navy block doesn't show empty cells. */
  .hero__rail { grid-template-columns: repeat(2, 1fr); }
  .hero__rail .kpi {
    padding: 14px 14px 16px;
    border-left: 1px solid rgba(255,255,255,0.14);
  }
  .hero__rail .kpi:first-child { border-left: none; }
  .hero__rail .kpi:nth-child(odd) { border-left: none; }
  .hero__rail .kpi:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,0.14); }
  .hero__rail .kpi:last-child {
    grid-column: 1 / -1;     /* 5th KPI spans full width on mobile */
  }
  .hero__rail .kpi .value { font-size: 36px; }
  .hero__rail .kpi .label { font-size: 12px; }
  .hero__rail .kpi .kpi-icon { width: 28px; height: 28px; margin-bottom: 4px; }

  /* Page-1 v2 layout collapse — single column on phone. Horizontal
     padding comes from the content shell rule (clamp 20-72), so we
     don't need to add it here. */
  .overview-layout {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
    gap: 16px;
  }
  .overview-layout .map-wrap,
  .overview-layout .overview-block--overview,
  .overview-layout .overview-block--lotm { grid-column: 1 / -1 !important; grid-row: auto !important; }
  .overview-layout .map-wrap { min-height: 280px; }
}

/* Print — the layout itself is driven by `.pages.a4-mode` (added by
   export.js on `beforeprint`). This block only adds the @page rule,
   hides the on-screen chrome, and installs page-break hints. */
@media print {
  @page { size: A4 landscape; margin: 0; }
  html, body { background: #fff; }
  .btn, .table-toolbar input.search { display: none !important; }

  /* Make sure every section starts on its own physical sheet. */
  .pages.a4-mode { padding: 0 !important; gap: 0 !important; background: #fff !important; }
  .pages.a4-mode .page {
    box-shadow: none !important;
    page-break-after: always;
    break-after: page;
    page-break-inside: avoid;
    break-inside: avoid-page;
  }
  .pages.a4-mode .page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  table.data th { position: static; }
}
