/* Report V2 layout pass: consistent headers, real lead mix, page 3 distribution story, larger type, balanced pages. */

/* ---------- Page frame: flex column so the footer sits at the bottom and content fills A4 ---------- */
.page-v1:not([style*="none"]) { display: flex !important; flex-direction: column; }
@media print { .page-v1 { display: flex !important; flex-direction: column; } }
.page-v1 > .report-v1-head { flex: none; }
.page-v1 > .report-v1-footer { flex: none; margin-top: auto; }
.page-three:not(.page-three-mix) > .story-top { flex: none; height: 132mm; min-height: 0; margin-bottom: 8mm; }

/* ---------- Page 2: same header/footer system as pages 3–6 ---------- */
.page-two.overview.page-v1 { padding: 11mm 11mm 8mm; background: #fffdfa; }
.page-two .overview-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.page-two .kpi-grid { margin-top: 7mm; gap: 10px; }
.page-two .kpi { min-height: 96px; padding: 14px; border-radius: 5px; }
.page-two .kpi span { font-size: 8.5px; }
.page-two .kpi strong { font-size: 28px; }
.page-two .summary-block { grid-template-columns: 1fr 44%; gap: 28px; align-items: start; margin-top: 9mm; padding-top: 8mm; }
.page-two .summary-block h2 { font-size: 25px; }
.page-two .summary-block p { font-size: 11px; line-height: 1.55; }
.page-two .summary-block.no-mix { grid-template-columns: 1fr; }
.page-two .summary-block.no-mix .lead-mix { display: none; }
.lead-mix { display: grid; grid-template-columns: 118px 1fr; gap: 6px 16px; align-items: center; }
.lead-mix > .micro { grid-column: 1 / -1; margin: 0 0 6px; }
.lead-donut { position: relative; width: 118px; height: 118px; border-radius: 50%; }
.lead-donut::after { content: ""; position: absolute; inset: 27px; border-radius: 50%; background: #fffdfa; }
.lead-donut span { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; text-align: center; font: 600 20px/1 Georgia, serif; color: #151c32; }
.lead-donut small { display: block; margin-top: 3px; font: 700 6.5px/1 Arial, sans-serif; letter-spacing: .8px; color: #6e6663; }
.lead-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.lead-legend li { display: grid; grid-template-columns: 9px 1fr auto; gap: 7px; align-items: center; font-size: 9px; color: #333143; }
.lead-legend i { width: 9px; height: 9px; border-radius: 2px; }
.lead-legend span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lead-legend b { font-weight: 700; color: #151c32; }

/* ---------- Shared header/footer polish ---------- */
.report-v1-head { padding-bottom: 7mm; }
.report-v1-head .section-no { color: #b08132; font-weight: 700; }
.report-v1-head .micro { color: #6845a9; }
.report-v1-head h1 { font-size: 33px; }
.report-v1-head p:not(.micro) { max-width: 360px; font-size: 11px; }
.report-v1-footer { font-size: 8.5px; }

/* ---------- Page 3 fallback: distribution story ---------- */
.mix-story { flex: 1; display: flex; flex-direction: column; gap: 6mm; min-height: 0; padding-bottom: 4mm; }
.mix-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.mix-strip span { padding: 7px 12px; border: 1px solid #e6ddd5; border-radius: 999px; font-size: 10px; color: #594c46; background: #fffdf9; }
.mix-strip b { margin-left: 4px; color: #151c32; font: 600 12px Georgia, serif; }
.mix-chart { flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; padding: 14px 16px; border: 1px solid #e6ddd5; border-radius: 6px; background: #fffdf9; }
.mix-chart header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.mix-chart h3 { margin: 0; font-size: 8.5px; letter-spacing: .8px; color: #25233a; }
.mix-legend { display: flex; gap: 14px; font-size: 9px; color: #594c46; }
.mix-legend i { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
.mix-legend i.spend, .mix-bar.spend b { background: #24304f; }
.mix-legend i.result, .mix-bar.result b { background: #6945aa; }
.mix-row { display: grid; grid-template-columns: 112px 1fr 62px; gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid #f0e9e2; }
.mix-name { margin: 0; overflow: hidden; font-size: 10.5px; font-weight: 600; color: #25233a; white-space: nowrap; text-overflow: ellipsis; }
.mix-bars { display: grid; gap: 4px; }
.mix-bar { position: relative; display: grid; grid-template-columns: 1fr 44px; gap: 8px; align-items: center; }
.mix-bar::before { content: ""; grid-row: 1; grid-column: 1; height: 10px; border-radius: 3px; background: #ede7e1; }
.mix-bar b { grid-row: 1; grid-column: 1; height: 10px; border-radius: 3px; }
.mix-bar em { grid-row: 1; grid-column: 2; font-style: normal; font-size: 9.5px; color: #3d3938; text-align: right; }
.mix-gap { justify-self: end; padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.mix-gap.up { background: #e7f3ec; color: #1f6b47; }
.mix-gap.down { background: #f8e9e4; color: #9a3d24; }
.mix-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mix-card { padding: 14px; border: 1px solid #e6ddd5; border-radius: 6px; background: #fff; }
.mix-card span { display: block; font-size: 7.5px; font-weight: 700; letter-spacing: .8px; color: #8b6243; }
.mix-card strong { display: block; margin: 8px 0 6px; font: 500 26px/1 Georgia, serif; color: #151c32; }
.mix-card p { margin: 0; font-size: 10px; line-height: 1.45; color: #3d3938; }
.mix-note { margin: 0; font-size: 9px; color: #7a6c63; }

/* ---------- Page 4: larger type, fill the page ---------- */
.page-four .campaign-overview { margin-bottom: 5mm; }
.page-four .campaign-overview h3 { font-size: 8.5px; }
.page-four .campaign-table { font-size: 9.5px; }
.page-four .campaign-table th { padding: 8px 7px; font-size: 7.5px; }
.page-four .campaign-table td { padding: 10px 7px; }
.page-four .drivers-row { flex: 1; min-height: 0; margin-bottom: 4mm; }
.page-four .driver-lists > div, .page-four .contribution-chart { padding: 14px; }
.page-four .driver-lists h3, .page-four .contribution-chart h3 { font-size: 8.5px; }
.page-four .driver-lists li { margin-bottom: 12px; font-size: 10px; line-height: 1.5; }
.page-four .contribution-chart { display: flex; flex-direction: column; }
.page-four .contribution { grid-template-columns: 100px 1fr 46px; gap: 6px; margin: 9px 0; font-size: 9.5px; }
.page-four .contribution i { height: 9px; border-radius: 2px; }
.page-four .contribution i b { border-radius: 2px; }
.page-four .contribution em { font-size: 8.5px; }
.page-four .creative-unavailable { margin: 0; font-size: 9px; }

/* ---------- Page 5: readable, columns fill the page ---------- */
.page-five .analysis-columns { flex: 1; min-height: 0; gap: 12px; margin-bottom: 5mm; }
.page-five .analysis-columns > section { padding: 16px; }
.page-five .analysis-columns h2 { font-size: 9px; margin-bottom: 16px; }
.page-five .analysis-item { margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px solid #f0e9e2; }
.page-five .analysis-item:last-child { border-bottom: 0; }
.page-five .analysis-item h3 { font-size: 13px; line-height: 1.25; }
.page-five .analysis-item p { font-size: 10px; line-height: 1.55; }
.page-five .analysis-item p b { font-size: 7px; }

/* ---------- Page 6: aligned columns, rows fill the page ---------- */
.page-six .action-table { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-bottom: 5mm; }
.page-six .action-table > article { flex: 1; }
.page-six .action-table > header, .page-six .action-table > article { grid-template-columns: 92px 1.2fr 1.5fr .8fr; gap: 14px; }
.page-six .action-table > header { font-size: 8px; }
.page-six .action-table > article { min-height: 0; padding: 16px 14px; }
.page-six .action-table > article:last-child { border-bottom: 1px solid #e5ddd6; }
.action-priority { display: flex; align-items: center; gap: 8px; }
.page-six .action-table .action-priority > strong { margin: 0; padding: 0; font-size: 7.5px; letter-spacing: .7px; }
.page-six .action-number { width: 28px; height: 28px; font-size: 9px; }
.priority-high { color: #9a3d24; }
.priority-medium { color: #8b6243; }
.page-six .action-table h2 { font-size: 20px; }
.page-six .action-table p, .page-six .action-table em { font-size: 10.5px; line-height: 1.5; }
.page-six .action-note { font-size: 9px; }

/* ---------- Tweaks after A4 render check ---------- */
.page-v1 > .report-v1-footer { align-self: stretch; }
.page-two .kpi-grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 128px; }
.page-two .kpi.hero { grid-row: auto; }
.page-two .kpi { display: flex; flex-direction: column; justify-content: center; }
.page-two .kpi strong { font-size: 32px; margin: 10px 0 8px; }
.page-two .summary-block { flex: 1; align-content: center; margin-top: 10mm; }
.page-two .summary-block h2 { font-size: 28px; }
.page-two .summary-block p { font-size: 12px; }
.lead-mix { grid-template-columns: 150px 1fr; }
.lead-donut { width: 150px; height: 150px; }
.lead-donut::after { inset: 34px; }
.lead-donut span { font-size: 26px; }
.lead-legend li { font-size: 10px; }
.mix-bar::before, .mix-bar b { height: 13px; }
.mix-name { font-size: 11.5px; }
.mix-bar em { font-size: 10.5px; }
.page-four .driver-lists li { font-size: 10.5px; }
.page-four .contribution-chart { justify-content: space-around; }
.page-five .analysis-item h3 { font-size: 14px; }
.page-five .analysis-item p { font-size: 10.5px; }
.page-six .action-table.action-count-1, .page-six .action-table.action-count-2 { flex: none; }
.page-six .action-table.action-count-1 > article, .page-six .action-table.action-count-2 > article { flex: none; min-height: 210px; }
.page-six .action-table.action-count-1 > article { min-height: 300px; }
/* Readable headings in PDF text extraction (tight negative tracking drops word spaces) */
.report-v1-head h1 { letter-spacing: -0.3px; word-spacing: 1px; }
.page-two .kpi { min-height: 0; }

/* ---------- Account-level exports ---------- */
.account-story { justify-content: center; }
.account-cards { grid-template-columns: 1fr; gap: 14px; }
.account-cards .mix-card { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: 26px 24px; }
.account-cards .mix-card span { grid-column: 1; }
.account-cards .mix-card p { grid-column: 1; font-size: 11px; margin-top: 6px; }
.account-cards .mix-card strong { grid-column: 2; grid-row: 1 / span 2; margin: 0; font-size: 40px; }
.funnel { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 0 4mm 10mm; }
.funnel-step { display: grid; grid-template-columns: 110px 1fr; grid-template-rows: auto auto; gap: 6px 16px; align-items: center; }
.funnel-step > span { grid-row: 1; font-size: 9px; font-weight: 700; letter-spacing: .8px; color: #8b6243; }
.funnel-bar { min-width: 96px; grid-row: 1; grid-column: 2; display: flex; align-items: center; height: 64px; padding: 0 18px; border-radius: 6px; background: linear-gradient(90deg, #24304f, #5d3197); color: #fff; }
.funnel-bar b { font: 500 26px Georgia, serif; }
.funnel-step em { grid-column: 2; font-style: normal; font-size: 11px; color: #594c46; }
.comparison-table th small { font-weight: 400; letter-spacing: 0; color: #7a6c63; }

/* ---------- v8: cover robustness + full campaign names ---------- */
.cover-copy h1 { letter-spacing: -0.6px; word-spacing: 6px; }
.cover-hook { width: auto; max-width: 70mm; }
.cover-hook strong { overflow-wrap: anywhere; }
.cover-abstract .cover-hook { bottom: 64mm; }
.cover-metrics { width: auto; max-width: 52%; flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
.cover-metrics b { white-space: nowrap; }
.cover-metrics.is-long b { font-size: 13px; }
.lead-legend li { align-items: start; }
.lead-legend span, .page-four .contribution span, .contribution span, .mix-name {
  white-space: normal; overflow: hidden; text-overflow: clip;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; line-height: 1.25;
}
.page-four .contribution { align-items: start; }
