/* CGT Calculator — friendly, approachable styling */

:root {
  --bg: #fdfaf6;
  --surface: #ffffff;
  --ink: #2b2d42;
  --ink-soft: #5a6072;
  --line: #ebe6df;
  --line-strong: #d8d1c6;
  --accent: #e76f51;
  --accent-soft: #fdece5;
  --ev-green: #133817;        /* Excorp deep green — tertiary accent */
  --ev-green-soft: #e7ede8;   /* subtle sage tint */
  --ev-red:   #7a2e36;        /* deep red counterpart for negative outcomes */
  --pos: #2a9d8f;
  --neg: #c5505c;
  --prop-old: #e85a4f;
  --prop-new: #f4a261;
  --sh-old: #2a9d8f;
  --sh-new: #457b9d;
  /* chart-* vars are read by script.js to colour Chart.js datasets */
  --chart-prop-old: #e85a4f;
  --chart-prop-new: #f4a261;
  --chart-sh-old: #2a9d8f;
  --chart-sh-new: #457b9d;
  --chart-prop-old-bg: rgba(232,90,79,0.08);
  --chart-prop-new-bg: rgba(244,162,97,0.08);
  --chart-sh-old-bg: rgba(42,157,143,0.08);
  --chart-sh-new-bg: rgba(69,123,157,0.08);
  --chart-grid: rgba(0,0,0,0.05);
  --chart-axis: #5a6072;
  /* IRR chart re-uses the scenario palette (red = Property, teal = Shares) */
  --chart-irr-property: #e85a4f;  /* same as --prop-old */
  --chart-irr-shares:   #2a9d8f;  /* same as --sh-old */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(43, 45, 66, 0.06), 0 1px 2px rgba(43, 45, 66, 0.04);
  --shadow-lg: 0 8px 24px rgba(43, 45, 66, 0.10), 0 2px 4px rgba(43, 45, 66, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

/* Hero — compact, single band */
.hero {
  background: linear-gradient(135deg, #fdece5 0%, #fff5ea 50%, #f5f0e8 100%);
  padding: 22px 0 20px;
  border-bottom: 3px solid var(--ev-green);
}
.hero .eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ev-green);
  margin: 0 0 4px;
}
.hero h1 {
  font-size: clamp(24px, 3.2vw, 36px);
  margin: 0 0 4px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ev-green);
  line-height: 1.1;
}
.hero .tagline {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
  max-width: 760px;
}

/* Extra-cash explanation note (expandable) */
.extra-cash-note {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ev-green);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink);
  line-height: 1.6;
}
.extra-cash-note > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 13px;
  color: var(--ev-green);
  position: relative;
  padding-right: 36px;
  user-select: none;
}
.extra-cash-note > summary::-webkit-details-marker { display: none; }
.extra-cash-note > summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 400;
  color: var(--ev-green);
  line-height: 1;
  transition: transform 0.15s ease;
}
.extra-cash-note[open] > summary::after {
  content: "−";
}
.extra-cash-note > summary:hover { background: rgba(19, 56, 23, 0.03); }
.extra-cash-note-body {
  padding: 0 18px 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.extra-cash-note-body p { margin: 0 0 8px; }
.extra-cash-note-body p:last-child { margin-bottom: 0; }
.extra-cash-note strong { color: var(--ev-green); }
.extra-cash-note em { font-style: italic; color: var(--ink); }

/* Layout */
main { padding: 32px 0 64px; }
.layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.layout > .results { min-width: 0; }
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

/* Sticky compact verdict bar — slides down once the main Verdict scrolls out */
.sticky-verdict {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 70;
  background: var(--ev-green);
  color: var(--surface);
  padding: 9px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  line-height: 1.3;
  transform: translateY(-100%);
  transition: transform 0.22s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}
.sticky-verdict[hidden] { display: none; }
.sticky-verdict.visible { transform: translateY(0); }
.sv-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.7;
}
.sv-text { flex: 1; min-width: 0; }
.sv-text strong { font-weight: 700; color: var(--accent-soft); }
.sv-link {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.sv-link:hover { background: rgba(255,255,255,0.1); }
@media (max-width: 600px) {
  .sticky-verdict { padding: 8px 14px; font-size: 12px; gap: 8px; }
  .sv-link { display: none; }
}

/* Inputs */
.inputs {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
@media (max-width: 980px) {
  .inputs { position: static; max-height: none; }
}

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 20px;
}
legend {
font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--ev-green);
  border-bottom: 2px solid var(--ev-green);
  padding: 0 0 6px;
  margin-bottom: 12px;
  width: 100%;
}
.fields { display: flex; flex-direction: column; gap: 10px; }
.field {
  display: grid;
  grid-template-columns: 1fr 92px 14px;
  align-items: center;
  gap: 8px;
}
.field > span {
  font-size: 13px;
  color: var(--ink);
}
.field input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  text-align: right;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(231, 111, 81, 0.15);
}
.field em {
  font-style: normal;
  color: var(--ink-soft);
  font-size: 13px;
  text-align: left;
  line-height: 1;
}
.field select {
  width: 100%;
  padding: 7px 22px 7px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background-color: var(--surface);
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'><path fill='%235a6072' d='M0 0l4 5 4-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 7px center;
  text-align: center;
  text-align-last: center;
}

.fixed-assumptions {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.fixed-assumptions > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink-soft);
  list-style: none;
  position: relative;
  padding-right: 32px;
  user-select: none;
}
.fixed-assumptions > summary::-webkit-details-marker { display: none; }
.fixed-assumptions > summary::after {
  content: "+";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  font-weight: 400;
  color: var(--ink-soft);
}
.fixed-assumptions[open] > summary::after { content: "−"; }
.fixed-assumptions-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.fa-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 10px;
  line-height: 1.5;
}
.fa-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.fa-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px dashed var(--line);
}
.fa-list li:last-child { border-bottom: none; }
.fa-list span { color: var(--ink-soft); }
.fa-list strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.actions { display: flex; gap: 10px; margin-top: 12px; }
button {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.05s ease, box-shadow 0.15s ease;
}
button:active { transform: translateY(1px); }
button.primary {
  background: var(--accent);
  color: white;
  flex: 1;
}
button.primary:hover { background: #d35a3d; }
button.primary.copied {
  background: var(--pos);
}
button.secondary {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
button.secondary:hover { background: var(--bg); }

/* Results — editorial section labels (Excorp accent) */
.results h2 {
  margin: 36px 0 18px;
font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ev-green);
  border-bottom: 2px solid var(--ev-green);
  padding-bottom: 6px;
}
.results h2:first-child { margin-top: 0; }

/* Bottom-line conclusion banner */
.bottom-line {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--ev-green);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.bl-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ev-green);
  margin-bottom: 12px;
}
.bl-verdict {
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 20px;
  letter-spacing: -0.005em;
}
.bl-verdict strong { color: var(--ev-green); font-weight: 700; }
.bl-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.bl-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.bl-stat.accent-prop-old { border-top-color: var(--prop-old); }
.bl-stat.accent-prop-new { border-top-color: var(--prop-new); }
.bl-stat.accent-sh-old   { border-top-color: var(--sh-old); }
.bl-stat.accent-sh-new   { border-top-color: var(--sh-new); }
/* Default look — modifier classes below override the background by asset class.
   .pos = property gains relatively (red, the "property" colour)
   .neg = shares gains relatively (green, the "shares" colour) */
.bl-stat-gap { border-top-color: var(--ev-green); background: var(--ev-green); color: var(--surface); }
.bl-stat-gap.pos     { background: var(--ev-red);   border-top-color: var(--ev-red); }
.bl-stat-gap.neg     { background: var(--ev-green); border-top-color: var(--ev-green); }
.bl-stat-gap.neutral { background: var(--ink-soft); border-top-color: var(--ink-soft); }
.bl-stat-gap .bl-stat-label,
.bl-stat-gap .bl-stat-sub { color: rgba(255,255,255,0.85); }
.bl-stat-gap .bl-stat-value { color: var(--surface) !important; }
.bl-stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.bl-stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.bl-stat-value.pos { color: var(--pos); }
.bl-stat-value.neg { color: var(--neg); }
.bl-stat-sub { font-size: 12px; color: var(--ink-soft); }
.bl-footnote {
  margin-top: 14px;
  font-size: 12px;
  color: var(--ink-soft);
  font-style: italic;
}

/* Summary cards — paired 2x2 so Old/New for the same asset class sit side-by-side */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 600px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card.accent-prop-old { border-top-color: var(--prop-old); }
.card.accent-prop-new { border-top-color: var(--prop-new); }
.card.accent-sh-old   { border-top-color: var(--sh-old); }
.card.accent-sh-new   { border-top-color: var(--sh-new); }
.card-title { font-weight: 700; font-size: 14px; letter-spacing: 0.02em; color: var(--ev-green); }
.card-sub { font-size: 12px; color: var(--ink-soft); margin-bottom: 12px; }
.card-num { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.card-meta { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* Section blurb under h2 */
.section-blurb {
  margin: -8px 0 16px;
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 720px;
}

.chart-wrap.chart-irr { height: 280px; }

/* Headline */
.headline {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 20px;
  box-shadow: var(--shadow);
}
.headline h3 { margin: 0 0 16px; font-size: 18px; color: var(--ev-green); }
.headline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.hl-label { font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.hl-num { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.hl-num.pos { color: var(--pos); }
.hl-num.neg { color: var(--neg); }
.hl-sub { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.reading {
  margin: 16px 0 0;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink-soft);
}

/* Charts */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  height: 380px;
}
.chart-wrap.chart-bar { height: 300px; }

/* Sale breakdown — 2x2 so Old/New for the same asset class sit side-by-side */
.sale-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 700px) {
  .sale-grid { grid-template-columns: minmax(0, 1fr); }
}
.sale {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.sale.accent-prop-old { border-top-color: var(--prop-old); }
.sale.accent-prop-new { border-top-color: var(--prop-new); }
.sale.accent-sh-old   { border-top-color: var(--sh-old); }
.sale.accent-sh-new   { border-top-color: var(--sh-new); }
.sale h4 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.sb { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.sb-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  gap: 12px;
}
.sb-label { color: var(--ink-soft); }
.sb-value {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink);
  white-space: nowrap;
}
.sb-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ev-green);
  margin: 10px 0 2px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.sb-section:first-child { margin-top: 0; }
.sb-row.sb-subtotal {
  border-top: 1px dashed var(--line-strong);
  padding-top: 6px;
  margin-top: 2px;
}
.sb-row.sb-subtotal .sb-label { font-weight: 700; color: var(--ink); }
.sb-row.sb-subtotal .sb-value { font-weight: 700; color: var(--ink); }
.sb-row.neg .sb-value { color: var(--neg); }
.sb-spacer { height: 6px; }
.sb-row.sb-total {
  border-top: 2px solid var(--ev-green);
  padding-top: 10px;
  margin-top: 4px;
}
.sb-row.sb-total .sb-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ev-green);
}
.sb-row.sb-total .sb-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--pos);
  letter-spacing: -0.01em;
}

/* Collapsible section (e.g. year-by-year tables) */
.collapsible-section {
  margin-top: 36px;
}
.collapsible-section > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 28px;
}
.collapsible-section > summary::-webkit-details-marker { display: none; }
.collapsible-section > summary > h2 {
  display: inline-block;
  margin: 0 0 18px;
}
.collapsible-section > summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 0;
  font-size: 18px;
  font-weight: 400;
  color: var(--ev-green);
  line-height: 1;
}
.collapsible-section[open] > summary::after { content: "−"; }
.collapsible-section > summary:hover > h2 { color: var(--accent); border-bottom-color: var(--accent); }

/* Tabs */
.tabs-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.tabs button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 12px 18px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 13px;
}
.tabs button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}
.tabs button:hover { color: var(--ink); }
.panel { display: none; }
.panel.active { display: block; }
.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
th, td {
  padding: 5px 9px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  background: var(--bg);
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td.num { text-align: right; }
tbody tr:hover { background: rgba(231, 111, 81, 0.03); }

/* Reading help */
.reading-help {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-top: 24px;
  box-shadow: var(--shadow);
}
.reading-help summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  color: var(--ev-green);
  padding: 4px 0;
  letter-spacing: 0.01em;
}
.reading-help h4 {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ev-green);
}
.reading-help h4:first-of-type { margin-top: 14px; }
.reading-help ul { margin: 0 0 12px; padding-left: 22px; }
.reading-help li { margin-bottom: 6px; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.reading-help p { margin: 0 0 8px; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.reading-help strong { color: var(--ink); }

/* Footer */
.footer {
  margin-top: 48px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}
.footer p { margin: 0 0 10px; }
.footer p:last-child { margin: 0; }
.footer .small { font-size: 11px; }
.footer strong { color: var(--ink); }

/* Print friendliness */
/* === Print / PDF output =================================================
   "Download as PDF" uses window.print() with this stylesheet.
   Goals:
   - Hide UI chrome (inputs panel, sticky verdict, action buttons)
   - Show the "Assumptions used" snapshot at the top
   - Force collapsibles (methodology, extra-cash note) open
   - Drop the year-by-year tables (too dense for a PDF snapshot)
   - Preserve colours; tame page breaks
*/
.assumptions-used { display: none; }

@media print {
  @page { size: A4; margin: 1.5cm; }
  body { background: #fff; }

  /* Strip all interactive UI */
  .inputs,
  .sticky-verdict,
  .floating-fab,
  .actions,
  .extra-cash-note > summary::after,
  .reading-help > summary::after,
  .collapsible-section { display: none !important; }

  /* Single column flow */
  .layout { display: block; }
  .container { max-width: none; padding: 0; }

  /* Compact hero — title + tagline only, no decorative band */
  .hero { padding: 0 0 12px; background: none; border-bottom: 2px solid var(--ev-green); }
  .hero h1 { font-size: 22px; }
  .hero .tagline { font-size: 12px; }
  .hero .eyebrow { font-size: 9px; }

  /* Show the Assumptions snapshot at the top of the PDF */
  .assumptions-used { display: block; margin-top: 12px; }
  .assumptions-used h2 { margin-top: 0; }
  .au-list { columns: 2; column-gap: 24px; list-style: none; padding: 0; margin: 0; font-size: 11px; }
  .au-list li {
    display: flex; justify-content: space-between;
    padding: 3px 0; border-bottom: 1px dotted #ccc;
    break-inside: avoid;
  }
  .au-list li span { color: var(--ink-soft); }
  .au-list li strong { color: var(--ink); font-variant-numeric: tabular-nums; }

  /* Verdict prominent */
  .bottom-line { box-shadow: none; page-break-inside: avoid; }

  /* Charts smaller; avoid splitting across pages.
     Constrain the canvas explicitly so even if Chart.js mis-sizes, it can't overflow. */
  .chart-wrap { height: 240px; box-shadow: none; page-break-inside: avoid; margin-bottom: 12px; }
  .chart-wrap canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
  }
  /* Force the second chart onto its own block of vertical space — never share a row
     with the line chart in the printed view. */
  .chart-wrap.chart-bar { page-break-before: avoid; clear: both; }
  .chart-bar { page-break-before: auto; }

  /* Cards: keep paired together, no shadows in print */
  .card, .sale, .bl-stat, .headline, .reading-help, .footer {
    box-shadow: none !important;
  }
  .cards, .sale-grid, .bl-stats, .headline-grid {
    page-break-inside: avoid;
  }
  .sale, .card { page-break-inside: avoid; }
  h2 { page-break-after: avoid; }

  /* Methodology: open and clean */
  .reading-help > summary { font-weight: 700; color: var(--ev-green); pointer-events: none; }

  /* Preserve colours (deep green, scenario accents, etc.) */
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
