@font-face {
  font-family: "Nunito";
  src: url("./assets/Nunito-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("./assets/Nunito-Italic-Variable.ttf") format("truetype");
  font-style: italic;
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --midnight: #0f2b5b;
  --surf: #0279a8;
  --orange: #ff8500;
  --orange-text: #9a4700;
  --green: #0d7c66;
  --pink: #ed556a;
  --pink-text: #a92743;
  --line: #d8e5ec;
  --muted: #5b7188;
  --soft-blue: #eaf6fc;
  --soft-green: #e7f5f1;
  --soft-orange: #fff3e4;
  --soft-pink: #fcedef;
  --page: #edf4f7;
}

#feed-status:not([hidden]) {
  margin: 0 auto 1rem;
  max-width: 88rem;
  padding: .65rem 1rem;
  color: var(--orange-text);
  background: var(--soft-orange);
  border: 1px solid var(--orange);
  border-radius: .5rem;
  font-size: .875rem;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--page);
}

body {
  margin: 0;
  color: var(--midnight);
  background:
    radial-gradient(circle at 10% 4%, rgba(120, 195, 235, 0.2), transparent 26rem),
    linear-gradient(180deg, #f3f8fa 0%, var(--page) 100%);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

button { font: inherit; }

.report-toolbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(94vw, 1760px);
  min-height: 58px;
  margin: 0 auto;
  padding: 8px 16px;
  border: 1px solid rgba(15, 43, 91, 0.08);
  border-top: 0;
  border-radius: 0 0 16px 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 7px 24px rgba(15, 43, 91, 0.08);
  backdrop-filter: blur(16px);
}

.toolbar-brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.toolbar-brand strong {
  overflow: hidden;
  max-width: 32ch;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-brand span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-controls button {
  min-width: 44px;
  min-height: 40px;
  padding: 8px 13px;
  color: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.toolbar-controls button:hover,
.toolbar-controls button:focus-visible {
  color: #fff;
  border-color: var(--surf);
  outline: 0;
  background: var(--surf);
}

#current-section {
  min-width: 62px;
  color: var(--surf);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

#report {
  display: grid;
  gap: clamp(34px, 4vw, 64px);
  padding: clamp(26px, 3vw, 50px) 0 76px;
}

.report-slide {
  position: relative;
  display: grid;
  grid-template-rows: auto 4px auto auto minmax(0, 1fr) auto;
  width: min(94vw, 1760px);
  aspect-ratio: 16 / 9;
  min-height: 720px;
  margin: 0 auto;
  padding: clamp(22px, 2.25vw, 40px) clamp(28px, 2.55vw, 46px) 0;
  overflow: hidden;
  border: 1px solid rgba(15, 43, 91, 0.08);
  background: #fff;
  box-shadow: 0 20px 54px rgba(15, 43, 91, 0.12);
  scroll-margin-top: 72px;
}

.slide-header {
  display: grid;
  grid-template-columns: minmax(140px, 174px) minmax(0, 1fr) 210px;
  align-items: center;
  gap: clamp(20px, 2vw, 34px);
  min-height: 79px;
  padding-bottom: 12px;
}

.onda-logo {
  display: block;
  width: 174px;
  height: 67px;
  object-fit: contain;
  object-position: left center;
}

.title-block { min-width: 0; }

.title-block h2 {
  margin: 0;
  color: var(--midnight);
  font-size: clamp(25px, 1.85vw, 34px);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.04;
  text-transform: uppercase;
}

.title-block p {
  margin: 9px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(13px, 0.95vw, 17px);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-block p b {
  margin: 0 5px;
  color: #a7b7c5;
}

.slide-meta {
  display: grid;
  justify-items: end;
  align-self: stretch;
  align-content: center;
  gap: 4px;
}

.slide-meta strong {
  color: var(--surf);
  font-size: 21px;
  font-weight: 900;
}

.slide-meta span {
  color: var(--orange-text);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-align: right;
}

.orange-rule {
  height: 4px;
  background: var(--orange);
}

.health-band {
  display: grid;
  grid-template-columns: 125px minmax(0, 1fr) 160px;
  align-items: center;
  gap: 16px;
  min-height: 46px;
  margin-top: 16px;
  padding: 9px 20px;
  border-radius: 10px;
  background: var(--soft-green);
}

.health-band.warning { background: var(--soft-orange); }
.health-band.alert { background: var(--soft-pink); }
.health-band.neutral { background: var(--soft-blue); }

.health-band strong,
.health-band b {
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.055em;
}

.health-band.warning strong { color: var(--orange-text); }
.health-band.alert strong { color: var(--pink-text); }
.health-band.neutral strong { color: var(--surf); }

.health-band span {
  /* The quick note wraps; a one-line ellipsis cut the explanation mid-word. */
  color: var(--midnight);
  font-size: clamp(13px, 0.88vw, 15px);
  line-height: 1.35;
  white-space: normal;
}

.health-band b { text-align: right; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  min-height: 100px;
  margin: 15px 0 8px;
}

.kpi {
  position: relative;
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 7px clamp(12px, 1.2vw, 22px);
  border-left: 1px solid var(--line);
}

.kpi:first-child {
  padding-left: 0;
  border-left: 0;
}

.kpi > span {
  overflow: hidden;
  color: var(--muted);
  font-size: clamp(11px, 0.76vw, 13px);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.kpi > strong {
  margin-top: 3px;
  overflow: hidden;
  color: var(--midnight);
  font-size: clamp(27px, 2vw, 38px);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi > strong.compact-value {
  font-size: clamp(16px, 1.35vw, 24px);
  letter-spacing: 0;
}

.kpi small {
  /* Wrap to two lines instead of truncating with an ellipsis: the method
     note is the only explanation a reader gets for the number above it. */
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: clamp(12px, 0.8vw, 14px);
  font-weight: 700;
  line-height: 1.3;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.kpi > .kpi-delta {
  margin-top: 7px;
  font-size: clamp(12px, 0.78vw, 14px);
  /* A narrow card wraps the pill rather than cut the comparison off. */
  white-space: normal;
}

.kpi small.surf { color: var(--surf); }
.kpi small.orange { color: var(--orange-text); }
.kpi small.green { color: var(--green); }
.kpi small.pink { color: var(--pink-text); }

.slide-body {
  min-height: 0;
  padding: 2px 0 18px;
}

.deck-grid {
  display: grid;
  /* Rows size to their content. A grid pinned to the slide's height squeezed
     chart boxes shorter than the charts inside them, which then spilled over
     the next block (Google slide at 90D on wide screens). */
  align-content: start;
  align-items: start;
  gap: clamp(22px, 2.4vw, 42px);
}

.outcome-grid { grid-template-columns: minmax(0, 1.65fr) minmax(370px, 1fr); }
.blend-grid { grid-template-columns: minmax(0, 1.75fr) minmax(360px, 1fr); }
.equal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.meta-grid { grid-template-columns: minmax(0, 1.8fr) minmax(410px, 1fr); }

.stacked-panel {
  display: grid;
  grid-template-rows: auto auto;
  gap: 12px;
  min-height: 0;
}

.chart-card {
  display: grid;
  grid-template-rows: auto auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
}

.chart-card figcaption,
.allocation-panel h3,
.meta-control-panel > h3 {
  min-height: 26px;
  margin: 0;
  color: var(--midnight);
  font-size: clamp(14px, 0.95vw, 17px);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.chart-stage {
  position: relative;
  /* The PLOT has a fixed height (--plot-h, set per chart size below) and the
     stage grows by however many legend rows a chart needs. A fixed stage
     height let a long legend (five campaign names plus their comparison
     lines) overflow the card and sit on the next block. */
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chart-large .chart-stage { --plot-h: calc(clamp(285px, 22.5vw, 390px) - 42px); }
.chart-medium .chart-stage { --plot-h: calc(clamp(210px, 15.5vw, 290px) - 42px); }
.chart-mini .chart-stage { --plot-h: calc(clamp(165px, 11.5vw, 215px) - 42px); }
.chart-email .chart-stage { --plot-h: calc(clamp(215px, 16vw, 295px) - 42px); }

.chart-stage svg {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  height: var(--plot-h, 240px);
  overflow: visible;
}

.axis-label {
  fill: var(--muted);
  font-family: "Nunito", sans-serif;
  font-size: 19px;
  font-weight: 700;
}

.grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.crosshair {
  stroke: #7590a8;
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
}

.chart-legend {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 13px;
  min-height: 38px;
  padding: 2px 4px 0;
}

.chart-legend button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 7px;
  color: var(--midnight);
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: clamp(11px, 0.78vw, 14px);
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
}

.chart-legend button:hover,
.chart-legend button:focus-visible {
  outline: 2px solid var(--tide, #78c3eb);
  background: var(--soft-blue);
}

.chart-legend button.muted { opacity: 0.4; }
.chart-legend i,
.chart-tooltip i {
  display: inline-block;
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.chart-tooltip {
  position: absolute;
  z-index: 20;
  width: min(260px, calc(100% - 16px));
  padding: 12px 14px;
  color: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 30px rgba(15, 43, 91, 0.2);
  pointer-events: none;
}

.chart-tooltip > strong {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.chart-tooltip > div:not(.tooltip-health) {
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin: 5px 0;
  font-size: 12px;
}

.chart-tooltip span {
  overflow: hidden;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-tooltip b { font-size: 13px; }
.chart-tooltip small {
  grid-column: 2 / -1;
  color: var(--muted);
  text-align: right;
}

.tooltip-health {
  margin-top: 8px;
  padding-top: 7px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 800;
}

.source-card,
.allocation-panel,
.meta-control-panel,
.email-health {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7fbfd;
}

.source-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 20px;
  min-height: 82px;
  padding: 13px 20px;
}

.source-card span {
  grid-row: 1 / span 2;
  color: var(--surf);
  font-size: 12px;
  font-weight: 900;
}

.source-card strong { font-size: 18px; }
.source-card small { color: var(--muted); font-size: 12px; font-weight: 700; }

.allocation-panel {
  min-height: 0;
  padding: 16px 20px;
}

.allocation-panel ol {
  display: grid;
  gap: 11px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.allocation-panel li > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.allocation-panel li strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.allocation-panel li span { font-weight: 900; }

.allocation-panel li > i {
  display: block;
  height: 10px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--line);
}

.allocation-panel li > i b {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.warning-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin-top: 12px;
  padding: 6px 12px;
  color: #fff;
  border-radius: 999px;
  background: var(--orange-text);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.meta-control-panel {
  display: grid;
  /* Natural-height rows: the list above, the chart below. A shrinkable
     middle row let a long campaign list overflow under the chart. */
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 8px;
  min-height: 0;
  padding: 15px 18px 8px;
}

.campaign-table {
  display: grid;
  min-height: 0;
}

/* Long campaign lists scroll inside the panel (top campaigns first) rather
   than stretching the slide or running under the chart beneath them. */
.meta-control-panel > .campaign-table,
.meta-control-panel > .diagnostic-table {
  max-height: 430px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.campaign-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 4px 8px;
  min-height: 58px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.campaign-row > b {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
  border-radius: 50%;
  background: var(--midnight);
  font-size: 11px;
}

.campaign-row > div {
  display: flex;
  min-width: 0;
  gap: 8px;
  align-items: baseline;
}

.campaign-row > div strong {
  overflow: hidden;
  font-size: 11.5px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-row > div span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.campaign-row dl {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-column: 2;
  gap: 5px;
  margin: 0;
}

.campaign-row dl div {
  display: flex;
  gap: 4px;
  font-size: 9.5px;
}

.campaign-row dt { color: var(--muted); font-weight: 800; }
.campaign-row dd { margin: 0; font-weight: 900; }

.email-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  height: 100%;
}

.three-charts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  min-height: 0;
}

.email-health {
  display: grid;
  grid-template-columns: 260px repeat(3, minmax(120px, 180px)) minmax(240px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 88px;
  padding: 12px 18px;
}

.email-health .warning-chip { margin: 0; }

.email-health > div:not(.warning-chip) {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
}

.email-health > div span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.email-health > div strong { font-size: 21px; }
.email-health > div b { align-self: center; color: var(--orange-text); font-size: 13px; }
.email-health p { margin: 0; color: var(--muted); font-size: 11px; font-weight: 750; line-height: 1.35; text-align: right; }

.slide-footer {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  min-height: 58px;
  margin: 0 clamp(-46px, -2.55vw, -28px);
  padding: 14px clamp(28px, 2.55vw, 46px);
  color: var(--muted);
  background: var(--soft-blue);
  font-size: clamp(10px, 0.72vw, 13px);
  font-weight: 750;
  line-height: 1.25;
}

.slide-footer span { max-width: 49%; }
.slide-footer span:last-child { text-align: right; }

.section-nav {
  position: fixed;
  z-index: 55;
  top: 50%;
  right: 12px;
  display: none;
  transform: translateY(-50%);
  padding: 8px;
  border: 1px solid rgba(15, 43, 91, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(15, 43, 91, 0.1);
}

.section-nav button {
  display: block;
  width: 38px;
  height: 34px;
  color: var(--muted);
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.section-nav button.active {
  color: #fff;
  background: var(--surf);
}

.fatal {
  width: min(720px, 90vw);
  margin: 80px auto;
  padding: 28px;
  border: 1px solid #f2a9b3;
  border-radius: 16px;
  background: var(--soft-pink);
}

body.presentation-mode { scroll-snap-type: y mandatory; }
body.presentation-mode .report-slide { scroll-snap-align: center; }

@media (min-width: 1870px) {
  .section-nav { display: block; }
}

@media (max-width: 1440px) and (min-width: 1180px) {
  .report-slide { min-height: 860px; aspect-ratio: auto; }
  .slide-header { grid-template-columns: 145px minmax(0, 1fr) 180px; }
  .onda-logo { width: 145px; height: 58px; }
  .outcome-grid { grid-template-columns: minmax(0, 1.55fr) minmax(330px, 1fr); }
  .meta-grid { grid-template-columns: minmax(0, 1.55fr) minmax(370px, 1fr); }
  .chart-large .chart-stage { --plot-h: calc(330px - 42px); }
  .chart-medium .chart-stage { --plot-h: calc(230px - 42px); }
  .chart-mini .chart-stage { --plot-h: calc(165px - 42px); }
  .chart-email .chart-stage { --plot-h: calc(230px - 42px); }
  .email-health { grid-template-columns: 220px repeat(3, 1fr) minmax(220px, 1.2fr); gap: 14px; }
}

@media (max-width: 1179px) {
  .report-toolbar { width: 100%; border-radius: 0; }
  #report { padding-top: 24px; }
  .report-slide {
    width: min(94vw, 980px);
    min-height: 0;
    aspect-ratio: auto;
    overflow: visible;
    padding: 28px 30px 0;
  }
  .slide-header { grid-template-columns: 135px minmax(0, 1fr) 150px; }
  .onda-logo { width: 135px; }
  .health-band span { white-space: normal; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(4) { border-left: 0; }
  .deck-grid { min-height: 500px; }
  .outcome-grid,
  .blend-grid,
  .meta-grid { grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); }
  .chart-large .chart-stage { --plot-h: calc(310px - 42px); }
  .chart-medium .chart-stage { --plot-h: calc(235px - 42px); }
  .email-body { gap: 18px; }
  .three-charts { grid-template-columns: 1fr; }
  .chart-email .chart-stage { --plot-h: calc(300px - 42px); }
  .email-health { grid-template-columns: repeat(3, 1fr); }
  .email-health .warning-chip,
  .email-health p { grid-column: 1 / -1; }
  .email-health p { text-align: left; }
  .slide-footer { margin: 18px -30px 0; padding: 14px 30px; }
}

@media (max-width: 767px) {
  .report-toolbar { min-height: 64px; padding: 8px 10px; }
  .toolbar-brand { display: grid; gap: 0; }
  .toolbar-brand strong { max-width: 22ch; font-size: 15px; }
  .toolbar-brand span { font-size: 10px; }
  #fullscreen { display: none; }
  .report-slide { width: 100%; padding: 22px 18px 0; border-right: 0; border-left: 0; }
  .slide-header { grid-template-columns: 96px minmax(0, 1fr) 48px; gap: 13px; }
  .onda-logo { width: 96px; height: 48px; }
  .title-block h2 { font-size: 20px; }
  .title-block p { font-size: 11px; white-space: normal; }
  .slide-meta span { display: none; }
  .health-band { grid-template-columns: 1fr; gap: 3px; padding: 10px 14px; }
  .health-band span { font-size: 13px; }
  .health-band b { display: none; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .kpi { min-height: 90px; border-left: 0; border-bottom: 1px solid var(--line); }
  .kpi > strong { font-size: 27px; }
  .kpi small { white-space: normal; }
  .deck-grid,
  .outcome-grid,
  .blend-grid,
  .equal-grid,
  .meta-grid { grid-template-columns: 1fr; min-height: 0; }
  .stacked-panel { gap: 22px; }
  .chart-large .chart-stage,
  .chart-medium .chart-stage,
  .chart-email .chart-stage { --plot-h: calc(350px - 42px); }
  .chart-mini .chart-stage { --plot-h: calc(230px - 42px); }
  .chart-legend button { font-size: 12px; }
  .allocation-panel { min-height: 400px; }
  .meta-control-panel { min-height: 680px; }
  .three-charts { grid-template-columns: 1fr; }
  .email-health { grid-template-columns: 1fr; }
  .email-health .warning-chip,
  .email-health p { grid-column: auto; }
  .slide-footer { display: grid; margin: 20px -18px 0; padding: 16px 18px; }
  .slide-footer span { max-width: none; }
  .slide-footer span:last-child { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body.presentation-mode .report-toolbar {
  position: fixed;
  top: 10px;
  right: 10px;
  left: auto;
  width: auto;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  opacity: 0.22;
  transition: opacity 160ms ease;
}

body.presentation-mode .report-toolbar:hover,
body.presentation-mode .report-toolbar:focus-within { opacity: 1; }
body.presentation-mode .toolbar-brand { display: none; }
body.presentation-mode #report { gap: 0; padding: 10px 0; }
body.presentation-mode .report-slide {
  width: min(96vw, calc((100vh - 20px) * 16 / 9));
  min-height: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   V2 interaction and analysis layer

   This layer intentionally extends the approved V1 slide system. New renderer
   components should use the class contracts grouped below: filter/scope,
   comparison, playbook, economics, and product diagnostics.
   -------------------------------------------------------------------------- */

:root {
  --tide: #78c3eb;
  --frost: #b8e3dc;
  --white: #ffffff;
  --panel: #f7fbfd;
  --panel-strong: #eef7fb;
  --deep-surf: #006a94;
  --deck-max: 1920px;
  --deck-width: 96vw;
  --control-shadow: 0 10px 34px rgba(15, 43, 91, 0.1);
  --slide-shadow: 0 24px 68px rgba(15, 43, 91, 0.14);
}

button,
select,
input { font: inherit; }

button,
select { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
select:focus-visible,
input:focus-visible,
[role="tab"]:focus-visible,
.chart-stage [tabindex]:focus-visible {
  outline: 3px solid rgba(2, 121, 168, 0.32);
  outline-offset: 2px;
}

/* V2 global controls ------------------------------------------------------- */

.report-toolbar,
.filter-shell,
.scope-guardrail,
.report-slide {
  width: min(var(--deck-width), var(--deck-max));
}

.report-toolbar {
  min-height: 62px;
  padding: 9px clamp(14px, 1.15vw, 22px);
  border-color: rgba(15, 43, 91, 0.1);
  box-shadow: 0 6px 20px rgba(15, 43, 91, 0.07);
}

.toolbar-brand strong { font-size: clamp(17px, 1vw, 20px); }

.toolbar-controls button {
  min-height: 42px;
  font-size: 14px;
  font-weight: 850;
}

.filter-shell {
  position: sticky;
  z-index: 45;
  top: 62px;
  display: grid;
  grid-template-columns: auto minmax(168px, 0.9fr) minmax(180px, 1fr) minmax(250px, 1.45fr) auto;
  align-items: end;
  gap: clamp(12px, 1.2vw, 22px);
  margin: 10px auto 0;
  padding: 13px clamp(15px, 1.3vw, 24px);
  border: 1px solid rgba(15, 43, 91, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--control-shadow);
  backdrop-filter: blur(18px);
}

.filter-group,
.filter-field {
  display: grid;
  align-content: end;
  gap: 6px;
  min-width: 0;
  margin: 0;
}

.filter-label,
.filter-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.075em;
  line-height: 1;
  text-transform: uppercase;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(52px, 1fr);
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft-blue);
}

.segmented button {
  min-width: 52px;
  min-height: 42px;
  padding: 7px 13px;
  color: var(--midnight);
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.segmented button:first-child { border-left: 0; }

.segmented button:hover { background: rgba(120, 195, 235, 0.2); }

.segmented button.active,
.segmented button[aria-pressed="true"] {
  color: var(--white);
  background: var(--midnight);
}

.filter-field select {
  width: 100%;
  min-height: 42px;
  padding: 8px 36px 8px 12px;
  color: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--white);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.scope-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: center;
  min-width: 0;
  padding: 0 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.25;
}

.scope-summary strong,
.scope-summary b { color: var(--midnight); font-weight: 900; }

.copy-view {
  min-height: 42px;
  padding: 8px 16px;
  color: var(--white);
  border: 1px solid var(--surf);
  border-radius: 10px;
  background: var(--surf);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.copy-view:hover { border-color: var(--midnight); background: var(--midnight); }

.copy-view.copied,
.copy-view[data-state="copied"] { border-color: var(--green); background: var(--green); }

.scope-guardrail {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin: 10px auto 0;
  padding: 10px 18px;
  color: var(--midnight);
  border-left: 6px solid var(--orange);
  border-radius: 9px;
  background: var(--soft-orange);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.scope-guardrail::before {
  content: "SCOPE";
  flex: 0 0 auto;
  color: var(--orange-text);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.09em;
}

.scope-guardrail.info,
.scope-guardrail[data-tone="info"] { border-left-color: var(--surf); background: var(--soft-blue); }
.scope-guardrail.info::before,
.scope-guardrail[data-tone="info"]::before { color: var(--deep-surf); }
.scope-guardrail.alert,
.scope-guardrail[data-tone="alert"] { border-left-color: var(--pink); background: var(--soft-pink); }
.scope-guardrail.alert::before,
.scope-guardrail[data-tone="alert"]::before { color: var(--pink-text); }
.scope-guardrail[hidden] { display: none !important; }

#report {
  gap: clamp(42px, 4vw, 74px);
  padding-top: clamp(28px, 2.6vw, 48px);
}

.report-slide {
  min-height: 760px;
  box-shadow: var(--slide-shadow);
  scroll-margin-top: 150px;
}

/* Comparison language ----------------------------------------------------- */

.metric-delta,
.comparison-delta,
.kpi-delta,
.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--soft-blue);
  color: var(--muted);
  font-size: clamp(11px, 0.7vw, 13px);
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.metric-delta.positive,
.comparison-delta.positive,
.kpi-delta.positive,
.delta.positive,
[data-direction="positive"] { color: var(--green); background: var(--soft-green); }

.metric-delta.negative,
.comparison-delta.negative,
.kpi-delta.negative,
.delta.negative,
[data-direction="negative"] { color: var(--pink-text); background: var(--soft-pink); }

.metric-delta.caution,
.comparison-delta.caution,
.kpi-delta.caution,
.delta.caution,
[data-direction="caution"] { color: var(--orange-text); background: var(--soft-orange); }

.metric-delta.neutral,
.comparison-delta.neutral,
.kpi-delta.neutral,
.delta.neutral { color: var(--surf); background: var(--soft-blue); }

.comparison-strip,
.comparison-legend,
.comparison-periods {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 14px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.comparison-strip strong,
.comparison-legend strong,
.comparison-periods strong { color: var(--midnight); }

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.comparison-card {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 82px;
  padding: 12px 15px;
  border-left: 4px solid var(--tide);
  background: var(--panel);
}

.comparison-card > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.comparison-card > strong { font-size: clamp(20px, 1.35vw, 27px); font-weight: 950; }

.comparison-card > small { color: var(--muted); font-size: 12px; font-weight: 750; }

.kpi.has-comparison { align-content: start; padding-top: 13px; }

/* Guardrails and Stroud Theory readout ----------------------------------- */

.playbook-shell,
.playbook-panel,
.diagnostic-panel {
  min-height: 0;
}

.playbook-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.55fr);
  gap: clamp(18px, 2vw, 34px);
  height: 100%;
  min-height: 0;
}

.playbook-readout,
.playbook-priority {
  display: grid;
  align-content: start;
  min-height: 0;
  padding: clamp(20px, 1.5vw, 28px);
  color: var(--white);
  border-left: 9px solid var(--orange);
  border-radius: 12px;
  background: var(--midnight);
}

.playbook-readout > span,
.playbook-priority > span,
.playbook-eyebrow,
.playbook-label {
  color: var(--frost);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.playbook-readout > h3,
.playbook-priority > h3 {
  margin: 10px 0 8px;
  color: var(--white);
  font-size: clamp(24px, 1.8vw, 34px);
  font-weight: 950;
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.playbook-readout > p,
.playbook-priority > p {
  margin: 0;
  color: #e7f2f7;
  font-size: clamp(14px, 0.92vw, 17px);
  font-weight: 700;
  line-height: 1.45;
}

.playbook-status,
.status-chip,
.signal-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 29px;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--deep-surf);
  background: var(--soft-blue);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.055em;
  line-height: 1;
  text-transform: uppercase;
}

.playbook-status.protect,
.status-chip.protect,
.signal-chip.healthy,
[data-status="protect"],
[data-status="healthy"] { color: var(--green); background: var(--soft-green); }

.playbook-status.repair,
.status-chip.repair,
.signal-chip.warning,
[data-status="repair"],
[data-status="warning"] { color: var(--orange-text); background: var(--soft-orange); }

.playbook-status.stop,
.status-chip.stop,
.signal-chip.alert,
[data-status="stop"],
[data-status="alert"] { color: var(--pink-text); background: var(--soft-pink); }

.playbook-status.measure,
.status-chip.measure,
[data-status="measure"] { color: var(--surf); background: var(--soft-blue); }

.playbook-actions,
.diagnostic-list,
.signal-list,
.evidence-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.playbook-action,
.diagnostic-row,
.signal-row,
.evidence-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.42fr) minmax(0, 1fr) minmax(180px, 0.65fr);
  align-items: center;
  gap: 14px;
  min-height: 70px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.playbook-action:first-child,
.diagnostic-row:first-child,
.signal-row:first-child,
.evidence-row:first-child { border-top: 3px solid var(--surf); }

.playbook-action > strong,
.diagnostic-row > strong,
.signal-row > strong,
.evidence-row > strong {
  font-size: clamp(14px, 0.9vw, 17px);
  font-weight: 950;
  line-height: 1.2;
}

.playbook-action > p,
.diagnostic-row > p,
.signal-row > p,
.evidence-row > p {
  margin: 0;
  color: var(--midnight);
  font-size: clamp(13px, 0.8vw, 15px);
  font-weight: 750;
  line-height: 1.35;
}

.playbook-action > small,
.diagnostic-row > small,
.signal-row > small,
.evidence-row > small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  text-align: right;
}

.playbook-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: auto;
  padding-top: 20px;
}

.playbook-meta > div { padding: 10px 12px; border-left: 1px solid rgba(255, 255, 255, 0.2); }
.playbook-meta > div:first-child { padding-left: 0; border-left: 0; }
.playbook-meta span { display: block; color: var(--frost); font-size: 9px; font-weight: 950; letter-spacing: 0.08em; text-transform: uppercase; }
.playbook-meta strong { display: block; margin-top: 4px; color: var(--white); font-size: 13px; line-height: 1.25; }

/* Holistic cost economics ------------------------------------------------- */

.cost-grid,
.economics-grid,
.cost-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1vw, 17px);
  align-content: start;
}

.cost-card,
.economics-card {
  position: relative;
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 135px;
  padding: clamp(14px, 1.2vw, 20px);
  overflow: hidden;
  border-top: 5px solid var(--surf);
  border-radius: 10px;
  background: var(--panel);
}

.cost-card.orange,
.economics-card.orange,
.cost-card[data-tone="orange"] { border-top-color: var(--orange); }
.cost-card.green,
.economics-card.green,
.cost-card[data-tone="green"] { border-top-color: var(--green); }
.cost-card.pink,
.economics-card.pink,
.cost-card[data-tone="pink"] { border-top-color: var(--pink); }

.cost-card > span,
.economics-card > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cost-card > strong,
.economics-card > strong {
  margin-top: 7px;
  overflow: hidden;
  color: var(--midnight);
  font-size: clamp(27px, 2vw, 39px);
  font-weight: 950;
  letter-spacing: -0.035em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-card > small,
.economics-card > small,
.cost-formula {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
}

.cost-burden,
.burden-meter,
.ratio-track {
  position: relative;
  height: 10px;
  margin-top: 13px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--line);
}

.cost-burden > i,
.burden-meter > i,
.ratio-track > i,
.ratio-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--surf);
}

.cost-card.orange .cost-burden > i,
.cost-card[data-tone="orange"] .cost-burden > i { background: var(--orange); }
.cost-card.pink .cost-burden > i,
.cost-card[data-tone="pink"] .cost-burden > i { background: var(--pink); }

.economics-note,
.formula-note,
.metric-definition {
  padding: 10px 14px;
  color: var(--muted);
  border-left: 4px solid var(--tide);
  background: var(--soft-blue);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

/* Product and landing-page diagnostics ----------------------------------- */

.product-layout,
.product-diagnostics {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 13px;
  height: 100%;
  min-height: 0;
}

.product-tabs,
.product-tablist,
.table-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 42px;
}

.product-tabs button,
.product-tablist button,
.table-tabs button,
.product-tab {
  min-height: 38px;
  padding: 7px 14px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.product-tabs button:hover,
.product-tablist button:hover,
.table-tabs button:hover,
.product-tab:hover { color: var(--surf); border-color: var(--tide); background: var(--soft-blue); }

.product-tabs button.active,
.product-tablist button.active,
.table-tabs button.active,
.product-tab.active,
.product-tabs button[aria-selected="true"],
.product-tablist button[aria-selected="true"],
.table-tabs button[aria-selected="true"],
.product-tab[aria-selected="true"] {
  color: var(--white);
  border-color: var(--midnight);
  background: var(--midnight);
}

.product-table-wrap,
.product-table-shell,
.table-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border-top: 3px solid var(--surf);
  background: var(--white);
  scrollbar-color: var(--tide) var(--soft-blue);
  scrollbar-width: thin;
}

.product-table,
.diagnostic-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  border-spacing: 0;
  color: var(--midnight);
  font-size: clamp(11px, 0.72vw, 13px);
}

.product-table caption,
.diagnostic-table caption {
  padding: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-align: left;
}

.product-table thead th,
.diagnostic-table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 10px 9px;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  background: var(--panel-strong);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.035em;
  line-height: 1.2;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

.product-table thead th:first-child,
.diagnostic-table thead th:first-child { left: 0; text-align: left; }

.product-table tbody th,
.product-table tbody td,
.diagnostic-table tbody th,
.diagnostic-table tbody td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.product-table tbody th,
.diagnostic-table tbody th {
  position: sticky;
  z-index: 1;
  left: 0;
  max-width: 280px;
  overflow: hidden;
  background: var(--white);
  color: var(--midnight);
  font-weight: 950;
  text-align: left;
  text-overflow: ellipsis;
}

.product-table tbody tr:nth-child(even) td,
.diagnostic-table tbody tr:nth-child(even) td { background: rgba(234, 246, 252, 0.38); }

.product-table tbody tr:hover td,
.product-table tbody tr:hover th,
.diagnostic-table tbody tr:hover td,
.diagnostic-table tbody tr:hover th { background: var(--soft-blue); }

.product-table td.positive,
.diagnostic-table td.positive { color: var(--green); }
.product-table td.negative,
.diagnostic-table td.negative { color: var(--pink-text); }
.product-table td.caution,
.diagnostic-table td.caution { color: var(--orange-text); }

.product-name { display: block; overflow: hidden; max-width: 28ch; text-overflow: ellipsis; }
.product-subtitle { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 750; }
.product-table-note { margin: 8px 0 0; color: var(--muted); font-size: 11px; font-weight: 750; line-height: 1.35; }

.empty-state,
.not-available {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 26px;
  color: var(--muted);
  border: 1px dashed var(--line);
  background: var(--panel);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  text-align: center;
}

/* Hover and explanatory details ------------------------------------------ */

.chart-tooltip {
  width: min(330px, calc(100% - 16px));
  padding: 14px 16px;
  border-color: rgba(15, 43, 91, 0.18);
  box-shadow: 0 16px 42px rgba(15, 43, 91, 0.24);
}

.chart-tooltip > strong { font-size: 13px; }
.chart-tooltip > div:not(.tooltip-health) { margin: 7px 0; font-size: 13px; }
.chart-tooltip b { font-size: 14px; }
.tooltip-health { font-size: 11px; line-height: 1.35; }

.metric-help,
.info-tip,
[data-tooltip] {
  cursor: help;
  text-decoration: underline dotted rgba(91, 113, 136, 0.65);
  text-underline-offset: 3px;
}

.hover-card,
.metric-popover,
.info-popover {
  position: absolute;
  z-index: 30;
  width: min(320px, calc(100vw - 28px));
  padding: 12px 14px;
  color: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 38px rgba(15, 43, 91, 0.2);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

/* Improve the inherited deck components at V2 density ------------------- */

.slide-header {
  grid-template-columns: minmax(148px, 184px) minmax(0, 1fr) 230px;
  min-height: 86px;
}

.onda-logo { width: 184px; height: 70px; }

.title-block h2 { font-size: clamp(28px, 1.85vw, 38px); }
.title-block p { font-size: clamp(14px, 0.88vw, 18px); }

.health-band { min-height: 49px; }
.health-band span { font-size: clamp(14px, 0.82vw, 16px); }

.kpi-row { min-height: 108px; }
.kpi > span { font-size: clamp(11px, 0.72vw, 14px); }
.kpi > strong { font-size: clamp(29px, 1.9vw, 41px); }
.kpi small { font-size: clamp(12px, 0.8vw, 14px); }

.chart-card figcaption,
.allocation-panel h3,
.meta-control-panel > h3 { font-size: clamp(15px, 0.9vw, 18px); }

.axis-label { font-size: 18px; }
.chart-legend button { font-size: clamp(12px, 0.72vw, 15px); }

.source-card,
.allocation-panel,
.meta-control-panel,
.email-health,
.cost-card,
.economics-card,
.comparison-card {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.section-nav {
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

.section-nav button { height: 32px; }

/* Responsive behavior ---------------------------------------------------- */

@media (min-width: 1900px) {
  .section-nav { display: block; }
  .report-slide { min-height: 920px; }
  .chart-large .chart-stage { --plot-h: calc(430px - 42px); }
  .chart-medium .chart-stage { --plot-h: calc(315px - 42px); }
  .chart-mini .chart-stage { --plot-h: calc(220px - 42px); }
  .chart-email .chart-stage { --plot-h: calc(315px - 42px); }
}

@media (max-width: 1500px) {
  .filter-shell {
    grid-template-columns: auto minmax(160px, 0.8fr) minmax(175px, 0.9fr) minmax(220px, 1.2fr) auto;
    gap: 12px;
  }

  .report-slide { min-height: 860px; aspect-ratio: auto; }
  .playbook-grid { grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.35fr); }
  .cost-grid,
  .economics-grid,
  .cost-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1179px) {
  .report-toolbar { width: 100%; }

  .filter-shell {
    position: relative;
    top: auto;
    width: min(94vw, 980px);
    grid-template-columns: auto repeat(2, minmax(160px, 1fr));
    align-items: end;
  }

  .scope-summary { grid-column: 1 / span 2; }
  .copy-view { grid-column: 3; grid-row: 2; }
  .scope-guardrail { width: min(94vw, 980px); }
  .report-slide { scroll-margin-top: 76px; }
  .playbook-grid { grid-template-columns: 1fr; }
  .playbook-readout,
  .playbook-priority { min-height: 260px; }
  .product-table,
  .diagnostic-table { font-size: 12px; }
}

@media (max-width: 860px) {
  .filter-shell {
    width: calc(100% - 24px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
  }

  .filter-group { grid-column: 1 / -1; }
  .segmented { width: 100%; }
  .scope-summary { grid-column: 1 / -1; }
  .copy-view { grid-column: 1 / -1; grid-row: auto; }
  .scope-guardrail { width: calc(100% - 24px); }

  .playbook-action,
  .diagnostic-row,
  .signal-row,
  .evidence-row {
    grid-template-columns: minmax(96px, 0.35fr) minmax(0, 1fr);
  }

  .playbook-action > small,
  .diagnostic-row > small,
  .signal-row > small,
  .evidence-row > small { grid-column: 2; text-align: left; }

  .cost-grid,
  .economics-grid,
  .cost-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  :root { --deck-width: 100%; }

  .report-toolbar { position: relative; top: auto; }
  .toolbar-controls { gap: 5px; }
  .toolbar-controls button { min-width: 42px; min-height: 42px; padding: 7px 10px; }

  .filter-shell {
    position: relative;
    top: auto;
    width: calc(100% - 20px);
    margin-top: 9px;
    padding: 12px;
    border-radius: 12px;
  }

  .filter-field { grid-column: 1 / -1; }
  .filter-field select,
  .segmented button,
  .copy-view { min-height: 44px; font-size: 16px; }
  .filter-label,
  .filter-field > span { font-size: 11px; }
  .scope-summary { font-size: 12px; }
  .scope-guardrail { width: calc(100% - 20px); align-items: flex-start; font-size: 12px; }

  #report { gap: 26px; padding-top: 20px; }
  .report-slide { min-height: 0; scroll-margin-top: 10px; }
  .title-block h2 { font-size: 21px; }
  .title-block p { font-size: 12px; }
  .axis-label { font-size: 14px; }

  .metric-delta,
  .comparison-delta,
  .kpi-delta,
  .delta { white-space: normal; }

  .comparison-grid,
  .cost-grid,
  .economics-grid,
  .cost-card-grid { grid-template-columns: 1fr; }

  .cost-card,
  .economics-card { min-height: 118px; }

  .playbook-readout,
  .playbook-priority { min-height: 0; padding: 20px; }
  .playbook-meta { grid-template-columns: 1fr; }
  .playbook-meta > div { padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, 0.2); border-left: 0; }

  .playbook-action,
  .diagnostic-row,
  .signal-row,
  .evidence-row {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 7px;
    padding: 13px 14px;
  }

  .playbook-action > small,
  .diagnostic-row > small,
  .signal-row > small,
  .evidence-row > small { grid-column: auto; }

  .product-tabs,
  .product-tablist,
  .table-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }

  .product-tabs button,
  .product-tablist button,
  .table-tabs button,
  .product-tab { flex: 0 0 auto; min-height: 44px; font-size: 13px; }

  .product-table-wrap,
  .product-table-shell,
  .table-scroll { max-width: 100%; }

  .product-table,
  .diagnostic-table { min-width: 900px; font-size: 12px; }

  .chart-tooltip { width: min(300px, calc(100% - 12px)); padding: 12px; }
  .chart-tooltip > div:not(.tooltip-health) { font-size: 12px; }
}

@media (max-width: 430px) {
  .toolbar-brand strong { max-width: 16ch; }
  .toolbar-controls button { min-width: 40px; padding-inline: 8px; }
  #current-section { min-width: 48px; }
  .segmented button { min-width: 0; }
  .kpi-row { grid-template-columns: 1fr; }
  .kpi { min-height: 82px; }
  .comparison-card { min-height: 74px; }
}

/* Full-screen presentation favors the content after the scope is selected. */
body.presentation-mode .filter-shell,
body.presentation-mode .scope-guardrail,
body.presentation-mode .section-nav { display: none; }

body.presentation-mode #report { padding: 8px 0; }

body.presentation-mode .report-slide {
  width: min(98vw, calc((100vh - 16px) * 16 / 9), var(--deck-max));
}

@media print {
  html,
  body { background: var(--white); }
  .report-toolbar,
  .filter-shell,
  .scope-guardrail,
  .section-nav { display: none !important; }
  #report { gap: 0; padding: 0; }
  .report-slide {
    width: 100%;
    min-height: 0;
    break-after: page;
    box-shadow: none;
  }
}

/* Renderer compatibility: exact V2 component classes -------------------- */

.readout-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.58fr);
  gap: clamp(18px, 2vw, 34px);
  height: 100%;
  min-height: 0;
}

.theory-stage-map {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 0;
  padding: clamp(17px, 1.35vw, 25px);
  color: var(--white);
  border-left: 9px solid var(--orange);
  border-radius: 12px;
  background: var(--midnight);
}

.theory-stage {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  grid-template-areas:
    "number label value"
    "number note value";
  align-items: center;
  gap: 2px 10px;
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.theory-stage:first-child { border-top: 0; }

.theory-stage > b {
  grid-area: number;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  color: var(--midnight);
  border-radius: 50%;
  background: var(--frost);
  font-size: 10px;
  font-weight: 950;
}

.theory-stage > span {
  grid-area: label;
  overflow: hidden;
  color: var(--white);
  font-size: clamp(12px, 0.78vw, 14px);
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theory-stage > strong {
  grid-area: value;
  color: var(--white);
  font-size: clamp(18px, 1.2vw, 23px);
  font-weight: 950;
  letter-spacing: -0.025em;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.theory-stage > small {
  grid-area: note;
  overflow: hidden;
  color: var(--frost);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readout-grid {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.readout-card {
  display: grid;
  grid-template-columns: minmax(135px, 0.58fr) minmax(170px, 1fr) minmax(150px, 0.82fr) minmax(150px, 0.82fr);
  align-items: center;
  gap: 13px;
  min-width: 0;
  min-height: 76px;
  padding: 10px 14px;
  border-left: 5px solid var(--surf);
  border-bottom: 1px solid var(--line);
  border-radius: 0 9px 9px 0;
  background: var(--panel);
}

.readout-card.warning,
.readout-card.repair { border-left-color: var(--orange); }
.readout-card.alert,
.readout-card.stop { border-left-color: var(--pink); }
.readout-card.healthy,
.readout-card.protect { border-left-color: var(--green); }

.readout-card > div {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
}

.readout-card > div > span {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  color: var(--deep-surf);
  border-radius: 999px;
  background: var(--soft-blue);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.06em;
  line-height: 1;
}

.readout-card.warning > div > span,
.readout-card.repair > div > span { color: var(--orange-text); background: var(--soft-orange); }
.readout-card.alert > div > span,
.readout-card.stop > div > span { color: var(--pink-text); background: var(--soft-pink); }
.readout-card.healthy > div > span,
.readout-card.protect > div > span { color: var(--green); background: var(--soft-green); }

.readout-card > div > strong {
  overflow: hidden;
  font-size: clamp(13px, 0.86vw, 16px);
  font-weight: 950;
  line-height: 1.18;
  text-overflow: ellipsis;
}

.readout-card > p {
  margin: 0;
  color: var(--midnight);
  font-size: clamp(12px, 0.76vw, 14px);
  font-weight: 800;
  line-height: 1.3;
}

.readout-card > small {
  color: var(--muted);
  font-size: clamp(10px, 0.66vw, 12px);
  font-weight: 750;
  line-height: 1.3;
}

.readout-card > small b {
  display: block;
  margin-bottom: 2px;
  color: var(--surf);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.055em;
}

.cost-map {
  display: grid;
  align-content: start;
  gap: clamp(10px, 1vw, 16px);
  min-width: 0;
  min-height: 0;
}

.cost-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: 0;
  overflow: hidden;
  border-top: 5px solid var(--surf);
  border-radius: 10px;
  background: var(--panel);
}

.cost-band:nth-child(2) { border-top-color: var(--orange); }
.cost-band:nth-child(3) { border-top-color: var(--green); }

.cost-band > h3 {
  grid-column: 1 / -1;
  margin: 0;
  padding: 9px 12px 7px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.cost-band > div {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 65px;
  padding: 9px 11px;
  border-left: 1px solid var(--line);
}

.cost-band > div:nth-child(2) { border-left: 0; }

.cost-band > div > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.cost-band > div > strong {
  overflow: hidden;
  margin-top: 5px;
  color: var(--midnight);
  font-size: clamp(17px, 1.2vw, 23px);
  font-weight: 950;
  letter-spacing: -0.025em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-grid {
  grid-template-columns: minmax(0, 1.08fr) minmax(480px, 1fr);
  min-height: 0;
}

.diagnostic-tabs {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.tab-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 42px;
}

.tab-list button {
  min-height: 38px;
  padding: 7px 14px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.tab-list button:hover { color: var(--surf); border-color: var(--tide); background: var(--soft-blue); }

.tab-list button.active,
.tab-list button[aria-selected="true"] {
  color: var(--white);
  border-color: var(--midnight);
  background: var(--midnight);
}

.diagnostic-tabs > [data-diagnostic-panel] {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.diagnostic-tabs > [data-diagnostic-panel][hidden] { display: none; }

/* The renderer uses compact article rows here rather than a semantic table. */
div.diagnostic-table {
  display: grid;
  align-content: start;
  width: 100%;
  min-width: 0;
  max-height: 100%;
  overflow: auto;
  border-top: 3px solid var(--surf);
  border-collapse: separate;
  background: var(--white);
  font-size: inherit;
}

div.diagnostic-table > article {
  display: grid;
  grid-template-columns: 27px minmax(150px, 0.9fr) minmax(280px, 1.25fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 49px;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
}

div.diagnostic-table > article:nth-child(even) { background: rgba(234, 246, 252, 0.38); }
div.diagnostic-table > article:hover { background: var(--soft-blue); }

div.diagnostic-table > article > b {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--surf);
  border-radius: 50%;
  background: var(--soft-blue);
  font-size: 10px;
  font-weight: 950;
}

div.diagnostic-table > article > strong {
  overflow: hidden;
  color: var(--midnight);
  font-size: clamp(11px, 0.72vw, 13px);
  font-weight: 950;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

div.diagnostic-table dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 1px;
  min-width: 0;
  margin: 0;
}

div.diagnostic-table dl > div {
  min-width: 0;
  padding-left: 8px;
  border-left: 1px solid var(--line);
  text-align: right;
}

div.diagnostic-table dt {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.035em;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

div.diagnostic-table dd {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--midnight);
  font-size: clamp(11px, 0.76vw, 14px);
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1500px) {
  .readout-layout { grid-template-columns: minmax(280px, 0.72fr) minmax(0, 1.45fr); }
  .readout-card { grid-template-columns: minmax(125px, 0.55fr) minmax(155px, 1fr) minmax(130px, 0.72fr); }
  .readout-card > small:last-child { grid-column: 2 / -1; }
  .product-grid { grid-template-columns: minmax(0, 0.95fr) minmax(440px, 1fr); }
}

@media (max-width: 1179px) {
  .readout-layout { grid-template-columns: 1fr; }
  .theory-stage-map { grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
  .theory-stage { padding: 9px 12px; border-top: 1px solid rgba(255, 255, 255, 0.16); }
  .theory-stage:nth-child(-n + 2) { border-top: 0; }
  .readout-card { grid-template-columns: minmax(145px, 0.52fr) minmax(0, 1fr) repeat(2, minmax(145px, 0.68fr)); }
  .readout-card > small:last-child { grid-column: auto; }
  .product-grid { grid-template-columns: 1fr; }
  .diagnostic-tabs { min-height: 420px; }
}

@media (max-width: 860px) {
  .readout-card { grid-template-columns: minmax(130px, 0.46fr) minmax(0, 1fr); }
  .readout-card > small { grid-column: 2; }
  .cost-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-band > div:nth-child(4) { border-left: 0; }
}

@media (max-width: 767px) {
  .readout-layout { gap: 18px; }
  .theory-stage-map { grid-template-columns: 1fr; padding: 17px; }
  .theory-stage,
  .theory-stage:nth-child(-n + 2) { padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.16); }
  .theory-stage:first-child { border-top: 0; }
  .readout-card { grid-template-columns: 1fr; align-items: start; gap: 7px; padding: 13px 14px; }
  .readout-card > small { grid-column: auto; }
  .cost-band { grid-template-columns: 1fr; }
  .cost-band > div { min-height: 58px; border-top: 1px solid var(--line); border-left: 0; }
  .tab-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .tab-list button { flex: 0 0 auto; min-height: 44px; font-size: 13px; }
  .diagnostic-tabs > [data-diagnostic-panel] { overflow-x: auto; }
  div.diagnostic-table { min-width: 720px; }
}

@media print {
  .readout-layout,
  .product-grid { grid-template-columns: 1fr; }
  .theory-stage-map { break-inside: avoid; }
  .diagnostic-tabs { min-height: 0; }
  div.diagnostic-table { max-height: none; overflow: visible; }
}

/* V2.1: graph sharing, readable product labels and mobile-first diagnostics. */
.chart-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  min-height: 46px;
}

.chart-heading > span {
  min-width: 0;
  min-height: 0;
  /* Long titles wrap rather than run under the Share button. */
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.chart-share-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 88px;
  min-height: 44px;
  padding: 8px 12px;
  color: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font: 900 12px/1 "Nunito", sans-serif;
  cursor: pointer;
}

.chart-share-button:hover,
.chart-share-button:focus-visible {
  color: var(--surf);
  border-color: var(--tide);
  outline: 3px solid rgba(120, 195, 235, 0.3);
  background: var(--soft-blue);
}

.chart-share-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-stage { touch-action: pan-y; }
.chart-legend button { min-height: 44px; }
.chart-legend-static > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  color: var(--midnight);
  font-size: clamp(11px, 0.78vw, 14px);
  font-weight: 800;
}

.bar-label {
  fill: var(--midnight);
  font-family: "Nunito", sans-serif;
  font-size: 17px;
  font-weight: 850;
}

.bar-value {
  fill: var(--midnight);
  font-family: "Nunito", sans-serif;
  font-size: 16px;
  font-weight: 950;
}

.horizontal-bars .chart-stage { --plot-h: 426px; }

.chart-share-menu {
  position: fixed;
  z-index: 2000;
  top: var(--share-top, 90px);
  left: var(--share-left, 20px);
  width: min(326px, calc(100vw - 24px));
  padding: 15px;
  color: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 22px 70px rgba(15, 43, 91, 0.28);
}

.chart-share-menu[hidden] { display: none !important; }

.share-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 11px;
}

.share-menu-head strong { font-size: 17px; font-weight: 950; }

.share-menu-head button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--muted);
  border: 0;
  border-radius: 50%;
  background: var(--soft-blue);
  font: 900 24px/1 "Nunito", sans-serif;
  cursor: pointer;
}

.share-menu-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.share-menu-actions button {
  min-height: 48px;
  padding: 9px 11px;
  color: var(--midnight);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbfd;
  font: 850 12px/1.15 "Nunito", sans-serif;
  cursor: pointer;
}

.share-menu-actions button:hover,
.share-menu-actions button:focus-visible {
  border-color: var(--tide);
  outline: 2px solid rgba(120, 195, 235, 0.28);
  background: var(--soft-blue);
}

.share-menu-actions button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.share-capability-note,
.share-status {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
}

.share-status { min-height: 30px; color: var(--green); font-weight: 850; }

@media (max-width: 767px) {
  .axis-label { font-size: 20px; }
  .chart-heading { align-items: flex-start; }
  .chart-heading > span { padding-top: 9px; }
  .chart-share-button { min-width: 46px; padding: 8px 11px; }
  .chart-share-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .chart-card .chart-stage { overflow-x: hidden; }
  .horizontal-bars .chart-stage {
    --plot-h: 441px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    touch-action: pan-x pan-y;
  }
  .horizontal-bars .chart-stage svg { width: 760px; min-width: 760px; }
  .horizontal-bars::after {
    content: "Swipe the product chart sideways to see full labels";
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }
  .chart-share-menu {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(82vh, 650px);
    overflow-y: auto;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }
  .share-menu-actions { grid-template-columns: 1fr; }
  .share-menu-actions button { min-height: 50px; text-align: left; }
  .diagnostic-tabs > [data-diagnostic-panel] { overflow: visible; }
  div.diagnostic-table { min-width: 0; overflow: visible; }
  div.diagnostic-table > article {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px 10px;
    padding: 12px 8px;
  }
  div.diagnostic-table > article > strong {
    overflow: visible;
    font-size: 13px;
    text-overflow: initial;
    white-space: normal;
  }
  div.diagnostic-table dl {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  div.diagnostic-table dl > div {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    text-align: left;
  }
  div.diagnostic-table dt { white-space: normal; }
  div.diagnostic-table dd { margin-top: 5px; font-size: 15px; }
}

@media print {
  .chart-share-button,
  .chart-share-menu,
  .horizontal-bars::after { display: none !important; }
}


/* A third block in a two-column slide (the Google campaign table) takes its
   own full-width row under both charts instead of a squeezed half column. */
.equal-grid > .meta-control-panel:nth-child(3) { grid-column: 1 / -1; }

/* A slide is at least a 16:9 frame but grows with its content in the normal
   scrolling view. A fixed frame with overflow hidden clipped the Meta and
   Google campaign tables under the slide footer. */
@media (min-width: 1180px) {
  body:not(.presentation-mode) .report-slide {
    aspect-ratio: auto;
    min-height: max(760px, calc(min(var(--deck-width, 94vw), var(--deck-max, 1760px)) * 9 / 16));
  }
}

/* Full presentation keeps the exact 16:9 frame; a slide with more content
   scrolls inside the frame rather than hiding it. */
body.presentation-mode .report-slide { overflow-y: auto; }
