/* ============================================================
     v2 — continuous form, scenario comparison, data transparency.
     Aesthetic continuity with v1 clone (Bricolage Grotesque +
     Geist Mono, warm cream bg, civic-utility feel).
     ============================================================ */
  /* Font stack: system fonts replace the Google Fonts dependency (Bricolage
     Grotesque → system sans-serif, Geist Mono → system monospace). This removes
     the external fonts.googleapis.com call, making the page fully self-contained
     with no third-party requests apart from analytics. (3B.3)
     To restore custom fonts: download WOFF2 files, add @font-face rules here,
     and update the font-family references below. */

  :root {
    --ink: #0f1419;
    --ink-soft: #3a4452;
    --ink-faint: #5e6874;  /* darkened for WCAG AA contrast */
    --line: #d4d8de;
    --line-strong: #9ba3ad;
    --bg: #ffffff;                 /* WALGA: white background */
    --bg-card: #ffffff;
    --bg-sunken: #f4f7fa;          /* very pale neutral panel tint */
    --accent: #00465D;             /* WALGA Tide — primary brand */
    --accent-soft: #e6eff3;        /* pale Tide */
    --accent-bright: #009DD1;      /* WALGA Ocean — hover/active */
    --positive: #008354;           /* WALGA Forest */
    --warning: #DF6023;            /* WALGA Earth */
    --warning-soft: #fdf2ec;       /* pale Earth */
    --error: #7A1218;              /* WALGA Celebration */
    --header-bg: #00465D;          /* WALGA Tide for the header band */
    --header-text: #ffffff;
    --shadow-sm: 0 1px 0 rgba(15, 20, 25, 0.04), 0 1px 2px rgba(15, 20, 25, 0.06);
    --shadow-md: 0 2px 4px rgba(15, 20, 25, 0.06), 0 8px 16px rgba(15, 20, 25, 0.08);
  }

  /* Gantari from Google Fonts (Open Font License — commercial use permitted) */
  
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    font-family: 'Gantari', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    font-size: 15px;
    min-height: 100vh;
  }
  .mono { font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace; font-feature-settings: 'tnum'; }

  /* ===== Header — WALGA brand ===== */
  header.app {
    background: var(--header-bg);
    color: var(--header-text);
  }
  header.app .row {
    max-width: 1400px; margin: 0 auto; padding: 14px 20px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
  }
  header.app .brand { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
  header.app .brand .walga-logo { height: 28px; width: auto; color: var(--header-text); flex-shrink: 0; }
  header.app .brand .logo { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
  header.app .brand .title { font-size: 14px; font-weight: 400; color: rgba(255,255,255,0.85); }
  header.app .meta { font-size: 12px; color: rgba(255,255,255,0.6); }

  /* ===== Footer — single line, persistent ===== */
  footer.app-footer {
    margin-top: 24px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--ink-faint);
    text-align: center;
  }
  footer.app-footer a { color: var(--accent); text-decoration: underline; }
  footer.app-footer a:hover { color: var(--accent-bright); }
  @media print { footer.app-footer { display: none; } }

  /* ===== Layout — two columns: form + live results ===== */
  main {
    max-width: 1400px; margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 20px;
    padding: 20px;
  }
  @media (max-width: 980px) {
    main { grid-template-columns: 1fr; }
  }

  /* ===== Scenario tabs ===== */
  .scenario-bar {
    grid-column: 1 / -1;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 4px;
  }
  .scenario-bar .label { font-size: 12px; color: var(--ink-faint); margin-right: 6px; font-weight: 500; }
  .tab {
    background: var(--bg-card); border: 1px solid var(--line);
    padding: 6px 12px; border-radius: 6px; cursor: pointer;
    font-size: 13px; font-family: inherit;
    display: flex; align-items: center; gap: 8px;
    transition: all 0.1s;
  }
  .tab:hover { border-color: var(--line-strong); }
  .tab.active { background: var(--accent); color: white; border-color: var(--accent); }
  .tab .name { font-weight: 500; }
  .tab .close { opacity: 0.5; cursor: pointer; padding: 0 2px; }
  .tab .close:hover { opacity: 1; }
  .tab-add {
    background: transparent; border: 1px dashed var(--line-strong);
    padding: 6px 12px; border-radius: 6px; cursor: pointer;
    font-size: 13px; color: var(--ink-soft); font-family: inherit;
  }
  .tab-add:hover { background: var(--bg-card); }

  /* ===== Form column ===== */
  .form-col { min-width: 0; }
  .panel {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
  }
  .panel-head {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-sunken);
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px;
  }
  .panel-head h2 {
    margin: 0; font-size: 14px; font-weight: 600;
    letter-spacing: 0.02em; text-transform: uppercase;
    color: var(--ink-soft);
  }
  .panel-body { padding: 16px; }

  /* ===== Form fields ===== */
  .field { margin-bottom: 14px; }
  .field:last-child { margin-bottom: 0; }
  .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
  @media (max-width: 600px) { .field-row, .field-row-3 { grid-template-columns: 1fr; } }

  label.fl { display: block; font-size: 12px; font-weight: 500; color: var(--ink-soft); margin-bottom: 4px; }
  label.fl .hint { color: var(--ink-faint); font-weight: 400; }
  .with-info { display: flex; align-items: center; gap: 6px; }
  .info-btn {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--bg-sunken); color: var(--ink-faint);
    border: none; font-size: 10px; font-weight: 600;
    cursor: pointer; padding: 0; line-height: 1;
  }
  .info-btn:hover { background: var(--ink-soft); color: var(--bg); }

  input[type="text"], input[type="number"], select {
    width: 100%; padding: 8px 10px;
    font-family: inherit; font-size: 14px;
    background: white; color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 4px;
  }
  input[type="number"] { font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace; }
  input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }

  .segmented {
    display: flex; gap: 0; border: 1px solid var(--line);
    border-radius: 4px; overflow: hidden; background: white;
  }
  .segmented button {
    flex: 1; padding: 8px 10px; font-family: inherit;
    font-size: 13px; background: white; border: none;
    cursor: pointer; border-right: 1px solid var(--line);
    color: var(--ink-soft);
  }
  .segmented button:last-child { border-right: none; }
  .segmented button.active { background: var(--accent); color: white; }
  .segmented button:not(.active):hover { background: var(--bg-sunken); }

  /* ===== Segments (multiple road sections per scenario) ===== */
  .segment {
    border: 1px solid var(--line); border-radius: 6px;
    padding: 12px; margin-bottom: 8px;
    background: var(--bg-sunken);
  }
  .segment-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 8px;
  }
  .segment-head .title { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
  .segment-head .del {
    background: none; border: none; color: var(--ink-faint);
    font-size: 12px; cursor: pointer; padding: 0;
  }
  .segment-head .del:hover { color: var(--accent); }
  .segment-add {
    width: 100%; padding: 8px;
    background: transparent; border: 1px dashed var(--line-strong);
    border-radius: 6px; cursor: pointer; font-family: inherit;
    font-size: 13px; color: var(--ink-soft);
  }
  .segment-add:hover { background: var(--bg-card); }

  /* ===== Result column — sticky, live ===== */
  .results-col {
    position: sticky; top: 20px;
    align-self: start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }
  @media (max-width: 980px) {
    .results-col { position: static; max-height: none; }
  }

  .result-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
  }
  .result-card .head {
    padding: 12px 16px;
    background: var(--accent); color: white;
    display: flex; align-items: baseline; justify-content: space-between;
  }
  .result-card .head h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
  .result-card .head .live {
    font-size: 10px; padding: 2px 6px; border-radius: 3px;
    background: var(--positive); color: white;
  }
  .result-card .head .live.stale { background: var(--ink-faint); }

  .result-headline {
    padding: 20px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line);
  }
  .result-headline .label { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; }
  .result-headline .value {
    font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace;
    font-size: 32px; font-weight: 600;
    color: var(--ink); margin-top: 4px;
    line-height: 1.1;
  }
  .result-headline .secondary { font-size: 13px; color: var(--ink-faint); margin-top: 4px; }
  .result-headline .empty { color: var(--ink-faint); font-style: italic; font-size: 14px; }

  .breakdown { padding: 16px; }
  .breakdown h3 {
    margin: 0 0 8px 0;
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--ink-faint); font-weight: 600;
  }
  .breakdown-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 4px 0; font-size: 13px;
    border-bottom: 1px dotted var(--line);
  }
  .breakdown-row:last-child { border-bottom: none; }
  .breakdown-row .k { color: var(--ink-soft); }
  .breakdown-row .v { font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace; font-weight: 500; color: var(--ink); }
  .breakdown-row .v .raw { color: var(--ink-faint); font-size: 11px; margin-left: 6px; }

  .seg-breakdown {
    background: var(--bg-sunken); border-radius: 4px;
    padding: 10px 12px; margin-top: 8px;
  }
  .seg-breakdown .seg-title { font-size: 11px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }

  /* ===== Warnings ===== */
  .warning {
    background: var(--warning-soft); border: 1px solid var(--warning);
    border-radius: 6px; padding: 10px 12px; margin: 8px 16px;
    font-size: 12px; color: var(--warning);
  }
  .warning strong { font-weight: 600; }

  /* ===== Actions ===== */
  .actions {
    padding: 12px 16px; border-top: 1px solid var(--line);
    background: var(--bg-sunken); display: flex; gap: 8px; flex-wrap: wrap;
  }
  .btn {
    padding: 8px 14px; border: 1px solid var(--ink);
    background: white; color: var(--ink);
    font-family: inherit; font-size: 13px; font-weight: 500;
    border-radius: 4px; cursor: pointer; flex: 1; min-width: 120px;
  }
  .btn:hover { background: var(--bg-sunken); }
  .btn.primary { background: var(--accent); color: white; }
  .btn.primary:hover { background: var(--ink-soft); }
  .btn:disabled { opacity: 0.4; cursor: not-allowed; }

  /* ===== Tooltip / provenance popover ===== */
  .popover-backdrop {
    position: fixed; inset: 0; background: rgba(15,20,25,0.4);
    display: none; align-items: center; justify-content: center;
    z-index: 100;
  }
  .popover-backdrop.open { display: flex; }
  .popover {
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: 8px; max-width: 540px; width: 90%;
    max-height: 80vh; overflow-y: auto;
    box-shadow: var(--shadow-md);
  }
  .popover .head {
    padding: 12px 16px; border-bottom: 1px solid var(--line);
    background: var(--bg-sunken);
    display: flex; align-items: center; justify-content: space-between;
  }
  .popover .head h3 { margin: 0; font-size: 14px; font-weight: 600; }
  .popover .head button {
    background: none; border: none; font-size: 18px;
    cursor: pointer; color: var(--ink-faint); padding: 0;
  }
  .popover .body { padding: 16px; font-size: 13px; line-height: 1.55; }
  .popover .body p { margin: 0 0 10px 0; }
  .popover .body .src {
    font-size: 11px; color: var(--ink-faint);
    background: var(--bg-sunken); padding: 8px 10px;
    border-radius: 4px; margin-top: 12px;
  }
  .popover .body code {
    font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace; font-size: 12px;
    background: var(--bg-sunken); padding: 1px 4px; border-radius: 3px;
  }

  /* ===== Disclaimer accept-gate modal (item 1) ===== */
  /* Higher z-index than other popovers so it sits on top on load.
     Different shape from .popover — wider, with a sticky accept button. */
  .disclaimer-backdrop {
    position: fixed; inset: 0; background: rgba(15,20,25,0.7);
    display: none; align-items: center; justify-content: center;
    z-index: 200; padding: 16px;
  }
  .disclaimer-backdrop.open { display: flex; }
  .disclaimer {
    background: var(--bg-card); border-radius: 8px;
    max-width: 640px; width: 100%;
    max-height: 90vh; display: flex; flex-direction: column;
    box-shadow: var(--shadow-md);
  }
  .disclaimer .head {
    padding: 16px 20px; border-bottom: 1px solid var(--line);
    background: var(--accent); color: white;
    border-radius: 8px 8px 0 0;
  }
  .disclaimer .head h2 { margin: 0; font-size: 18px; font-weight: 600; }
  .disclaimer .head .sub { font-size: 12px; opacity: 0.85; margin-top: 4px; }
  .disclaimer .body {
    padding: 18px 20px; overflow-y: auto; font-size: 13px; line-height: 1.55;
  }
  .disclaimer .body h3 { margin: 0 0 10px 0; font-size: 14px; font-weight: 600; }
  .disclaimer .body p { margin: 0 0 12px 0; }
  .disclaimer .body p:last-child { margin-bottom: 0; }
  .disclaimer .body .src {
    font-size: 11px; color: var(--ink-soft);
    margin-top: 14px; padding-top: 10px;
    border-top: 1px dashed var(--line);
  }
  .disclaimer .actions {
    padding: 14px 20px; border-top: 1px solid var(--line);
    background: var(--bg-sunken);
    display: flex; gap: 10px; justify-content: flex-end;
    border-radius: 0 0 8px 8px;
    flex-wrap: wrap;
  }
  .disclaimer .actions button.accept {
    background: var(--accent); color: white; border: none;
    padding: 10px 18px; border-radius: 4px; font-weight: 600;
    cursor: pointer; font-size: 14px;
  }
  .disclaimer .actions button.accept:hover { background: var(--accent-bright); }
  .disclaimer .actions button.accept:focus-visible {
    outline: 3px solid #4d8ce8; outline-offset: 2px;
  }
  @media (max-width: 600px) {
    .disclaimer .actions { justify-content: stretch; }
    .disclaimer .actions button.accept { flex: 1; }
  }

  /* ===== Cost zone map ===== */
  .zone-map-wrap {
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px;
    position: relative;
  }
  .zone-map-wrap .map-inner {
    position: relative;
    width: 100%;
    /* match map aspect ratio 751:805 */
    aspect-ratio: 751 / 805;
    max-width: 360px;
    margin: 0 auto;
  }
  .zone-map-wrap img.map {
    display: block;
    width: 100%;
    height: 100%;
    user-select: none;
    pointer-events: none;
  }
  .zone-map-wrap svg.hotspots {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
  .zone-map-wrap svg.hotspots polygon {
    fill: transparent;
    stroke: transparent;
    cursor: pointer;
    transition: fill 0.1s, stroke 0.1s;
  }
  .zone-map-wrap svg.hotspots polygon:hover {
    fill: rgba(255, 255, 255, 0.25);
    stroke: rgba(255, 255, 255, 0.8);
    stroke-width: 2;
  }
  .zone-map-wrap svg.hotspots polygon.selected {
    fill: rgba(255, 255, 255, 0.15);
    stroke: white;
    stroke-width: 3;
    stroke-dasharray: 4 4;
  }
  .zone-map-wrap svg.hotspots polygon.disabled {
    cursor: not-allowed;
    fill: rgba(0, 0, 0, 0.5);
    pointer-events: none;
  }
  .zone-map-wrap .map-label {
    text-align: center;
    font-size: 13px;
    margin-top: 8px;
    color: var(--ink-soft);
  }
  .zone-map-wrap .map-label .selected-zone {
    font-weight: 600;
    color: var(--ink);
  }
  .zone-map-wrap .map-disabled-note {
    font-size: 11px;
    color: var(--warning);
    text-align: center;
    margin-top: 4px;
  }

  /* ===== Aid 3 — RAV silhouette display (User Guide Appendix A) ===== */
  .rav-silhouette {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--bg-sunken);
    border: 1px solid var(--line);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
  }
  .rav-silhouette img {
    height: 50px;
    width: auto;
    flex-shrink: 0;
    background: white;
    padding: 4px;
    border-radius: 3px;
  }
  .rav-silhouette-meta { flex: 1; min-width: 200px; }
  .rav-silhouette .rav-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
  }
  .rav-silhouette .rav-source {
    font-size: 10px;
    color: var(--ink-faint);
    line-height: 1.4;
  }

  /* ===== Aid 1 — Gravel compliance reference (User Guide Table 2) ===== */
  details.aid-panel {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--bg-sunken);
  }
  details.aid-panel summary {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 12px;
    color: var(--ink-soft);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  details.aid-panel summary::-webkit-details-marker { display: none; }
  details.aid-panel summary::after { content: "\25BE"; font-size: 11px; transition: transform 120ms; }
  details.aid-panel[open] summary::after { transform: rotate(180deg); }
  details.aid-panel summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
  details.aid-panel .panel-body { padding: 0 14px 14px; }
  details.aid-panel table { width: 100%; border-collapse: collapse; font-size: 12px; }
  details.aid-panel th, details.aid-panel td {
    padding: 7px 8px;
    text-align: left;
    border-bottom: 1px dashed var(--line);
    vertical-align: top;
  }
  details.aid-panel th {
    background: rgba(0,0,0,0.04);
    font-weight: 600;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
  }
  details.aid-panel tr.active-row td {
    background: var(--accent-soft);
    font-weight: 500;
  }
  details.aid-panel tr.active-row td:first-child::before {
    content: "\25B8 ";
    color: var(--accent);
    font-weight: 700;
  }
  details.aid-panel .source-note {
    font-size: 10px;
    color: var(--ink-faint);
    margin-top: 10px;
    line-height: 1.4;
  }

  /* ===== Decision flag (interpolation, etc.) ===== */
  .decision-flag {
    background: var(--warning-soft); border: 1px solid var(--warning);
    border-radius: 4px; padding: 6px 10px;
    font-size: 11px; color: var(--accent);
    margin-top: 8px;
  }
  .decision-flag strong { font-weight: 600; }

  /* ===== Comparison panel ===== */
  .compare-panel {
    margin-top: 16px;
    background: var(--bg-card); border: 1px solid var(--line);
    border-radius: 8px; overflow: hidden;
  }
  .compare-panel .head {
    padding: 10px 14px; background: var(--bg-sunken);
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    font-weight: 600; color: var(--ink-soft);
    border-bottom: 1px solid var(--line);
  }
  .compare-table { width: 100%; border-collapse: collapse; font-size: 12px; }
  .compare-table th, .compare-table td {
    padding: 6px 10px; text-align: right;
    border-bottom: 1px solid var(--line);
    font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace;
  }
  .compare-table th:first-child, .compare-table td:first-child {
    text-align: left; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--ink-soft);
  }
  .compare-table thead th {
    background: var(--bg-sunken);
    font-weight: 600; color: var(--ink-soft);
    font-size: 11px;
  }

  /* ===== Report modal ===== */
  .report-content {
    max-width: 760px; padding: 24px; line-height: 1.5;
    font-size: 13px;
  }
  .report-content h2 { font-size: 18px; margin: 0 0 4px 0; }
  .report-content .gen-meta { color: var(--ink-faint); font-size: 11px; margin-bottom: 20px; }
  .report-content h3 {
    font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--ink-soft); margin: 20px 0 8px 0;
    border-bottom: 1px solid var(--line); padding-bottom: 4px;
  }
  .report-content h4 {
    font-size: 12px; font-weight: 600; margin: 14px 0 6px 0;
    color: var(--ink);
  }
  .report-content table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 8px 0; }
  .report-content table td { padding: 4px 8px; border-bottom: 1px dotted var(--line); vertical-align: top; }
  .report-content table td:first-child { color: var(--ink-soft); width: 50%; }
  .report-content table td:last-child { font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace; font-weight: 500; text-align: right; }
  .report-content .formula {
    font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace; font-size: 11px;
    color: var(--ink-soft); background: var(--bg-sunken);
    padding: 6px 10px; border-radius: 4px; margin: 4px 0;
    border-left: 2px solid var(--ink-faint);
  }
  .report-content .total-line {
    margin: 18px 0; padding: 14px;
    background: var(--bg-sunken); border-radius: 6px;
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 10px; flex-wrap: wrap;
  }
  .report-content .total-line .label { font-size: 11px; text-transform: uppercase; color: var(--ink-soft); }
  .report-content .total-line .value { font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace; font-size: 24px; font-weight: 600; }
  .report-content .perunit-line {
    margin: 6px 0; padding: 8px 14px;
    background: var(--bg-card); border: 1px solid var(--line); border-radius: 4px;
    display: flex; justify-content: space-between; font-size: 12px;
  }
  .report-content .perunit-line .label { color: var(--ink-soft); }
  .report-content .perunit-line .value { font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', Consolas, monospace; font-weight: 500; }
  /* The formal WALGA disclaimer block at the foot of the report.
     Print: page-break-inside: avoid prevents orphaning (item 2). */
  .report-content .report-disclaimer {
    margin-top: 28px; padding: 14px 16px;
    border: 1px solid var(--ink-soft);
    background: var(--bg-sunken);
    font-size: 11px; color: var(--ink);
    line-height: 1.5;
    border-radius: 4px;
  }
  .report-content .report-disclaimer h4 {
    margin: 0 0 8px 0; font-size: 12px; color: var(--ink);
    text-transform: uppercase; letter-spacing: 0.04em;
  }
  .report-content .report-disclaimer p { margin: 0 0 8px 0; }
  .report-content .report-disclaimer p:last-child { margin-bottom: 0; }
  .report-content .report-disclaimer .attribution {
    margin-top: 10px; padding-top: 8px;
    border-top: 1px dashed var(--line);
    font-size: 10px; color: var(--ink-soft);
  }

  @media print {
    body { background: white; }
    header.app, .scenario-bar, main > .form-col, .results-col, .actions, .popover-backdrop:not(.print-this), .disclaimer-backdrop {
      display: none !important;
    }
    .popover-backdrop.open { background: white; display: block; position: static; }
    .popover { box-shadow: none; border: none; max-width: 100%; max-height: none; width: 100%; }
    .popover .head { display: none; }
    /* Item 2 — keep the report disclaimer intact across pages. Block-level
       page-break-inside is honoured by major print engines; the disclaimer
       must NEVER be partially cut off. */
    .report-disclaimer {
      page-break-inside: avoid;
      break-inside: avoid;
      -webkit-column-break-inside: avoid;
    }
    .report-section { page-break-inside: avoid; break-inside: avoid; }
    .report-section.allow-break { page-break-inside: auto; break-inside: auto; }
    /* Full calculation working starts on page 2; page 1 = scenario summary,
       headline results, source/methodology, and disclaimer. */
    .report-working-page {
      page-break-before: always;
      break-before: page;
    }
    h2, h3 { page-break-after: avoid; break-after: avoid; }
    table { page-break-inside: auto; }
    tr { page-break-inside: avoid; break-inside: avoid; }
  }
