/* ============================================================
   Adempitalia Report · A4 Print Stylesheet
   ============================================================ */

/* ---------- Screen preview (book-like) ---------- */
@media screen {
  html, body { background: oklch(0.94 0.005 80); padding: 0; margin: 0; }
  body { padding: 32px 0 80px; }
  .a4-doc { max-width: 220mm; margin: 0 auto; }
  /* Sprint 13: l'intero report può essere ruotato in landscape applicando
     .a4-doc--landscape al wrapper. Cascade su tutte le .a4-page figlie. */
  .a4-doc--landscape { max-width: 307mm; }
  .a4-page {
    width: 210mm;
    min-height: 297mm;
    background: var(--bg-elev);
    margin: 0 auto 24px;
    box-shadow: 0 6px 28px -8px oklch(0.40 0.015 250 / 0.18);
    padding: 18mm 16mm 22mm;
    box-sizing: border-box;
    position: relative;
    page-break-after: always;
    overflow: hidden;
  }
  .a4-page--landscape,
  .a4-doc--landscape .a4-page {
    width: 297mm;
    min-height: 210mm;
    padding: 14mm 18mm 20mm;
  }
  .a4-page--cover {
    padding: 0;
    background: var(--bg-elev);
  }
}

/* ---------- Print ---------- */
@media print {
  html, body { background: white; padding: 0; margin: 0; }
  @page { size: A4 portrait; margin: 18mm 16mm 20mm; }
  @page :first { margin: 0; }
  @page landscape { size: A4 landscape; margin: 14mm 16mm; }

  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .a4-page {
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 0;
    box-shadow: none;
    page-break-after: always;
    page-break-inside: auto;
    background: white;
    overflow: visible;
  }
  .a4-page:last-child { page-break-after: auto; }
  .a4-page--landscape,
  .a4-doc--landscape .a4-page { page: landscape; }
  .a4-page--cover { padding: 0; }

  .no-print { display: none !important; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Universal page chrome ---------- */
.a4-doc { font-family: var(--font-body); color: var(--ink); }

.a4-page__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.a4-page__head-mark {
  display: inline-flex; align-items: center; gap: 8px;
}
.a4-page__head-mark::before {
  content: ""; display: inline-block; width: 12px; height: 12px;
  border-radius: 50%; background: var(--ink);
  position: relative;
}
.a4-page__foot {
  position: absolute;
  bottom: 10mm;
  left: 16mm;
  right: 16mm;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.a4-page--landscape .a4-page__foot { left: 18mm; right: 18mm; }

/* ---------- Typography overrides for print ---------- */
.a4-doc h1 { font-size: 36pt; line-height: 1.02; letter-spacing: -0.022em; font-weight: 500; }
.a4-doc h2 { font-size: 20pt; line-height: 1.1; letter-spacing: -0.015em; font-weight: 600; }
.a4-doc h3 { font-size: 13pt; line-height: 1.2; font-weight: 600; letter-spacing: -0.005em; }
.a4-doc h4 { font-size: 11pt; line-height: 1.3; font-weight: 600; }
.a4-doc p  { font-size: 10pt; line-height: 1.5; max-width: none; }
.a4-doc ul, .a4-doc ol { font-size: 10pt; line-height: 1.5; }
.a4-doc small, .a4-doc .small { font-size: 9pt; }

.a4-doc .eyebrow {
  font-family: var(--font-mono);
  font-size: 8.5pt;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.a4-doc .label {
  font-family: var(--font-mono);
  font-size: 8.5pt;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

/* ---------- Cover page ---------- */
.cover {
  height: 100%;
  min-height: 297mm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26mm 22mm 22mm;
  position: relative;
  background: var(--bg-elev);
  box-sizing: border-box;
}
@media print { .cover { min-height: calc(297mm - 0pt); } }
.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 800px 600px at 70% -10%, oklch(0.93 0.04 235 / 0.5), transparent 60%);
  pointer-events: none;
}
.cover__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}
.cover__brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 11.5pt;
  letter-spacing: -0.005em;
}
.cover__brand-mark {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ink);
  position: relative;
}
.cover__brand-mark::after {
  content: ""; position: absolute; inset: 7px;
  border-radius: 50%; background: var(--bg-elev);
}
.cover__meta {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 9pt;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  line-height: 1.6;
}
.cover__body {
  position: relative;
  z-index: 1;
  margin-top: 32mm;
}
.cover__crumb {
  font-family: var(--font-mono);
  font-size: 10pt;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary-ink);
  margin-bottom: 18mm;
  display: flex;
  align-items: center;
  gap: 14px;
}
.cover__crumb::after {
  content: ""; flex: 1; height: 1px;
  background: color-mix(in oklch, var(--primary), transparent 70%);
}
.cover__title {
  font-family: var(--font-display);
  font-size: 56pt;
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.03em;
  max-width: 17ch;
  margin-bottom: 18mm;
}
.cover__title .serif {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--primary);
  font-weight: 400;
}
.cover__lead {
  font-size: 12pt;
  line-height: 1.5;
  max-width: 60ch;
  color: var(--ink-soft);
  margin-bottom: 12mm;
}
.cover__hero-number {
  display: inline-block;
  border-left: 4px solid var(--save);
  padding-left: 22px;
}
.cover__hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 9pt;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--save-ink);
  margin-bottom: 8px;
}
.cover__hero-value {
  font-family: var(--font-numeric);
  font-weight: 400;
  font-size: 60pt;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--save);
}
.cover__hero-value .unit {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16pt;
  color: var(--ink-soft);
  margin-left: 10px;
  letter-spacing: 0;
  vertical-align: 0.7em;
}
.cover__hero-sub {
  font-family: var(--font-display);
  font-size: 11pt;
  color: var(--save-ink);
  font-weight: 500;
  margin-top: 8px;
}
.cover__foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  padding-top: 12mm;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 8.5pt;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ---------- TOC ---------- */
.toc__title { margin-bottom: 16mm; }
.toc__list { list-style: none; padding: 0; margin: 0; }
.toc__entry {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.toc__entry--major {
  padding: 18px 0 12px;
  border-bottom: 1.5px solid var(--ink);
}
.toc__entry--major .toc__name { font-weight: 600; font-size: 13pt; }
.toc__entry--major .toc__num { font-family: var(--font-numeric); font-size: 24pt; color: var(--primary); font-weight: 400; line-height: 1; }
.toc__num {
  font-family: var(--font-mono);
  font-size: 10pt;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
}
.toc__name {
  font-family: var(--font-display);
  font-size: 11pt;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.toc__name .toc__sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 8.5pt;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 3px;
}
.toc__page {
  font-family: var(--font-numeric);
  font-size: 16pt;
  color: var(--ink-soft);
  letter-spacing: -0.01em;
}

/* ---------- Section opener ---------- */
.opener {
  page-break-before: always;
  break-before: page;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 240mm;
  position: relative;
}
.opener__num {
  font-family: var(--font-numeric);
  font-size: 120pt;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--primary);
  margin-bottom: 14mm;
}
.opener__label {
  font-family: var(--font-mono);
  font-size: 10pt;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 8mm;
}
.opener__title {
  font-family: var(--font-display);
  font-size: 42pt;
  line-height: 1;
  letter-spacing: -0.025em;
  max-width: 16ch;
  margin-bottom: 12mm;
  font-weight: 500;
}
.opener__title .serif { font-family: var(--font-serif); font-style: italic; color: var(--primary); font-weight: 400; }
.opener__dek {
  font-size: 13pt;
  line-height: 1.5;
  max-width: 56ch;
  color: var(--ink-soft);
}

/* ---------- Page content blocks ---------- */
.section-title {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.section-title__num {
  font-family: var(--font-mono);
  font-size: 9pt;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-ink);
  font-weight: 500;
}
.section-title__name {
  font-family: var(--font-display);
  font-size: 15pt;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.intro {
  font-size: 11pt;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 18px;
  max-width: 70ch;
}

/* ---------- KPI grid for print (smaller) ---------- */
.p-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  break-inside: avoid;
}
.p-kpi {
  background: var(--bg-elev);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 70px;
}
.p-kpi__label {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.p-kpi__sub { font-size: 8pt; color: var(--ink-soft); line-height: 1.3; }
.p-kpi__value {
  font-family: var(--font-numeric);
  font-weight: 400;
  font-size: 24pt;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-top: auto;
}
.p-kpi__value .unit {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 9pt;
  color: var(--ink-mute);
  letter-spacing: 0;
  margin-left: 4px;
  vertical-align: 0.55em;
}
.p-kpi--accent .p-kpi__value { color: var(--primary-ink); }
.p-kpi--waste .p-kpi__value { color: var(--waste-ink); }
.p-kpi--save .p-kpi__value { color: var(--save-ink); }

/* ---------- Gap (print) ---------- */
.p-gap {
  display: grid;
  grid-template-columns: 1fr 36px 1fr 1fr;
  gap: 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  break-inside: avoid;
}
.p-gap__col { display: flex; flex-direction: column; gap: 6px; }
.p-gap__sublabel {
  font-family: var(--font-mono);
  font-size: 8pt;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.p-gap__value {
  font-family: var(--font-numeric);
  font-weight: 400;
  font-size: 36pt;
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.p-gap__value .unit {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.3em;
  color: var(--ink-mute);
  margin-left: 4px;
  vertical-align: 0.6em;
  letter-spacing: 0;
}
.p-gap__sub { font-size: 9pt; color: var(--ink-soft); line-height: 1.4; }
.p-gap__total {
  font-family: var(--font-mono);
  font-size: 8pt;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 2px;
}
.p-gap__total b {
  font-family: var(--font-numeric); font-weight: 400; font-size: 12pt;
  letter-spacing: -0.01em; color: var(--ink-soft); text-transform: none;
}
.p-gap__col--before .p-gap__value { color: var(--waste-ink); }
.p-gap__col--after  .p-gap__value { color: var(--save-ink); }
.p-gap__col--save .p-gap__value { color: var(--save); }
.p-gap__col--save {
  background: oklch(0.97 0.025 160);
  border-radius: 6px;
  padding: 12px;
  margin: -12px;
}
.p-gap__arrow {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-mute);
}
.p-gap__arrow svg { width: 24px; height: 24px; }

/* ---------- Tables (print) ---------- */
.p-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 8.5pt;
  margin-bottom: 16px;
  break-inside: auto;
}
.p-table th, .p-table td {
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.p-table thead { display: table-header-group; }
.p-table th {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  background: var(--bg-sunken);
  border-bottom: 1.5px solid var(--line-strong);
}
.p-table td.num, .p-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.p-table tr.is-new td { background: color-mix(in oklch, var(--primary-soft), var(--bg-elev) 60%); }
.p-table tr.is-gap td { background: color-mix(in oklch, var(--waste-soft), var(--bg-elev) 70%); }
.p-table tr.is-total td {
  font-weight: 600;
  background: var(--bg-sunken);
  border-top: 1.5px solid var(--line-strong);
}
.p-table .code {
  font-family: var(--font-mono);
  font-size: 8pt;
  background: var(--bg-sunken);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.p-table tbody tr { break-inside: avoid; }

/* ---------- Tag (print sized) ---------- */
.p-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 7pt;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-sunken);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  font-weight: 500;
  white-space: nowrap;
  margin-left: 4px;
}
.p-tag--primary { background: var(--primary-soft); color: var(--primary-ink); border-color: color-mix(in oklch, var(--primary), transparent 70%); }
.p-tag--waste   { background: var(--waste-soft); color: var(--waste-ink); border-color: color-mix(in oklch, var(--waste), transparent 70%); }
.p-tag--save    { background: var(--save-soft); color: var(--save-ink); border-color: color-mix(in oklch, var(--save), transparent 70%); }
.p-tag--warn    { background: var(--warn-soft); color: oklch(0.40 0.10 75); border-color: color-mix(in oklch, var(--warn), transparent 70%); }

/* ---------- Cards (print) ---------- */
.p-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 16px;
  break-inside: avoid;
}
.p-card--accent { border-color: color-mix(in oklch, var(--primary), transparent 70%); background: color-mix(in oklch, var(--primary-soft), var(--bg-elev) 60%); }
.p-card--waste  { border-color: color-mix(in oklch, var(--waste), transparent 70%); background: color-mix(in oklch, var(--waste-soft), var(--bg-elev) 60%); }
.p-card--save   { border-color: color-mix(in oklch, var(--save), transparent 70%); background: color-mix(in oklch, var(--save-soft), var(--bg-elev) 50%); }

.p-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.p-card-grid--3 { grid-template-columns: repeat(3, 1fr); }
.p-card-grid--4 { grid-template-columns: repeat(4, 1fr); }

.p-card__head {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
  font-weight: 500;
}
.p-card__title { font-size: 10.5pt; font-weight: 600; letter-spacing: -0.005em; margin-bottom: 6px; }
.p-card__body { font-size: 9pt; color: var(--ink-soft); line-height: 1.45; }

/* ---------- Callout (print) ---------- */
.p-callout {
  border-left: 3px solid var(--primary);
  background: color-mix(in oklch, var(--primary-soft), var(--bg-elev) 70%);
  padding: 12px 14px;
  border-radius: 0 6px 6px 0;
  font-size: 9.5pt;
  color: var(--ink-soft);
  line-height: 1.5;
  break-inside: avoid;
}
.p-callout--waste { border-color: var(--waste); background: color-mix(in oklch, var(--waste-soft), var(--bg-elev) 70%); }
.p-callout--save  { border-color: var(--save);  background: color-mix(in oklch, var(--save-soft), var(--bg-elev) 70%); }
.p-callout strong { color: var(--ink); }

/* ---------- Flow strip (print sostituto della swimlane) ---------- */
.flow-strip {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  break-inside: avoid;
  margin-bottom: 8px;
}
.flow-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 9px;
  background: var(--bg-elev);
  border: 1.5px solid var(--ink-soft);
  border-radius: 5px;
  min-width: 64px;
  position: relative;
}
.flow-chip__code {
  font-family: var(--font-mono);
  font-size: 6.5pt;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  font-weight: 500;
}
.flow-chip__title {
  font-family: var(--font-display);
  font-size: 8pt;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.005em;
}
.flow-chip__lane {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.flow-chip__meta {
  font-family: var(--font-mono);
  font-size: 6.5pt;
  color: var(--primary-ink);
  letter-spacing: 0.02em;
  margin-top: 1px;
}
.flow-chip__meta .wait { color: var(--waste-ink); margin-left: 4px; }

.flow-chip--start, .flow-chip--end {
  background: var(--ink);
  border-color: var(--ink);
  border-radius: 24px;
  padding: 6px 14px;
}
.flow-chip--start .flow-chip__code, .flow-chip--end .flow-chip__code { color: oklch(0.85 0.005 80); }
.flow-chip--start .flow-chip__title, .flow-chip--end .flow-chip__title { color: white; }
.flow-chip--gate { background: var(--warn-soft); border-color: var(--warn); }
.flow-chip--gate .flow-chip__code { color: oklch(0.40 0.10 75); }
.flow-chip--gap { background: var(--waste-soft); border-color: var(--waste); border-style: dashed; }
.flow-chip--gap .flow-chip__code { color: var(--waste-ink); }
.flow-chip--new { background: color-mix(in oklch, var(--primary-soft), var(--bg-elev) 30%); border-color: var(--primary); }
.flow-chip--new .flow-chip__code { color: var(--primary-ink); }
.flow-chip--waste { background: var(--waste-soft); border-color: var(--waste); border-style: dashed; }
.flow-chip--waste .flow-chip__code { color: var(--waste-ink); }

.flow-arrow {
  align-self: center;
  font-family: var(--font-mono);
  font-size: 10pt;
  color: var(--ink-faint);
  margin: 0 -2px;
}

.flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 8pt;
  color: var(--ink-soft);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.flow-legend__item { display: flex; align-items: center; gap: 5px; }
.flow-legend__lane {
  width: 9px; height: 9px; border-radius: 50%;
}

.lane-comm { background: var(--primary); }
.lane-lead { background: oklch(0.55 0.13 30); }
.lane-part { background: oklch(0.55 0.11 290); }
.lane-ente { background: oklch(0.55 0.10 180); }
.lane-resp { background: var(--primary); }
.lane-tec  { background: oklch(0.55 0.13 30); }
.lane-rep  { background: oklch(0.55 0.11 290); }
.lane-cli  { background: oklch(0.55 0.10 180); }

/* ---------- Glossary table ---------- */
.glossary {
  display: grid;
  grid-template-columns: 1fr 2.5fr;
  gap: 4px 16px;
  font-size: 9pt;
  break-inside: auto;
}
.glossary dt {
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-weight: 600;
  font-size: 9pt;
  color: var(--ink);
}
.glossary dd {
  padding: 6px 0;
  border-top: 1px solid var(--line);
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.45;
}
.glossary dt:first-of-type, .glossary dd:first-of-type { border-top: 1.5px solid var(--ink); }

/* ---------- Mini list ---------- */
.p-list { list-style: none; padding: 0; margin: 0; font-size: 10pt; }
.p-list > li { padding: 8px 0; border-top: 1px solid var(--line); }
.p-list > li:first-child { border-top: none; padding-top: 0; }
.p-list h4 { font-size: 10pt; margin: 0 0 4px 0; }
.p-list p { font-size: 9.5pt; color: var(--ink-soft); margin: 0; }

/* ---------- Risparmio compare ---------- */
.p-compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
  margin-bottom: 16px;
}
.p-compare th, .p-compare td {
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.p-compare thead th {
  font-family: var(--font-mono);
  font-size: 7.5pt;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  background: var(--bg-sunken);
  border-bottom: 1.5px solid var(--line-strong);
  font-weight: 500;
}
.p-compare .num, .p-compare th.num { text-align: right; font-variant-numeric: tabular-nums; }
.p-compare .before { color: var(--waste-ink); font-family: var(--font-mono); font-weight: 500; }
.p-compare .after  { color: var(--save-ink); font-family: var(--font-mono); font-weight: 500; }
.p-compare .saving { font-family: var(--font-numeric); color: var(--save-ink); font-size: 11pt; }
.p-compare tr.is-total td { background: var(--bg-sunken); font-weight: 600; border-top: 1.5px solid var(--line-strong); }
.p-compare tr.is-invariant td { color: var(--ink-mute); }
.p-compare tr.is-gap td { background: color-mix(in oklch, var(--waste-soft), var(--bg-elev) 70%); }

/* ---------- Scenario card ---------- */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.scenario {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  break-inside: avoid;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scenario--core { border-color: var(--save); }
.scenario__badge {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 7pt;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--bg-sunken);
  color: var(--ink-soft);
}
.scenario__title { font-size: 10.5pt; font-weight: 600; }
.scenario__formula { font-size: 8.5pt; color: var(--ink-soft); line-height: 1.5; }
.scenario__formula b { color: var(--ink); }
.scenario__result {
  font-family: var(--font-numeric);
  font-size: 22pt;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--save-ink);
  margin-top: auto;
}
.scenario__result .unit { font-family: var(--font-display); font-size: 9pt; color: var(--ink-mute); margin-left: 4px; vertical-align: 0.55em; }

/* ---------- Big number block ---------- */
.bignumber-block {
  background: oklch(0.96 0.022 160);
  border: 1px solid var(--save);
  border-radius: 8px;
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
  align-items: center;
  break-inside: avoid;
}
.bignumber-block__value {
  font-family: var(--font-numeric);
  font-weight: 400;
  font-size: 56pt;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--save);
}
.bignumber-block__value .unit { font-family: var(--font-display); font-size: 14pt; color: var(--ink-soft); margin-left: 6px; vertical-align: 0.7em; font-weight: 500; }
.bignumber-block__sub {
  font-family: var(--font-mono);
  font-size: 9pt;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--save-ink);
  margin-top: 6px;
}

/* ---------- Avoid breaking inside ---------- */
.no-break { break-inside: avoid; page-break-inside: avoid; }
.break-before { break-before: page; page-break-before: always; }

/* ---------- Print toolbar (screen only) ---------- */
.print-toolbar {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--ink);
  color: white;
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  z-index: 100;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px -6px rgba(0,0,0,0.3);
}
.print-toolbar:hover { background: var(--primary-ink); }
@media print { .print-toolbar { display: none; } }
