/* THE Q FACTOR - PRINT STYLESHEET v16 - Fixed Page Layout */

@page { 
    size: A4; 
    margin: 1.5cm 1.5cm 2cm 1.5cm;
}

* {
    background: white !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

html, body { 
    color: #1a1a1a !important; 
    font-family: 'Segoe UI', 'Helvetica', sans-serif !important; 
    font-size: 10pt !important; 
    line-height: 1.4 !important;
}

html, body, #content, .page-wrapper, main {
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
}

/* === HIDE UI ELEMENTS === */
.no-print, nav, header.header, footer, .footer, .unlock-badge, .cookie-consent, .cookie-banner, [class*="cookie"], 
.pro-badge, .premium-badge, span.pro-badge,
.theme-toggle, .auth-btn, .back-link, 
#constellation, canvas, .paywall-overlay, #paywallOverlay, .auth-modal, 
#authModal, #userModal, .modal-overlay, button, select, .glossary-link,
.print-cover-page, #yearsBackSelect {
    display: none !important;
}

/* Diagonal watermark removed - using professional header instead */

/* ============================================
   PAGE 1: HERO + SCORE TRAJECTORY
   ============================================ */
.hero {
    text-align: center !important;
    padding: 15pt !important;
    margin: 0 0 8pt 0 !important;
    border: 2pt solid #b8860b !important;
    background: #fafafa !important;
}

.hero-symbol { 
    font-size: 22pt !important; 
    font-weight: 700 !important; 
    color: #b8860b !important; 
    letter-spacing: 2px !important;
}
.hero-company { 
    font-size: 11pt !important; 
    color: #333 !important; 
    margin: 5pt 0 20pt 0 !important; 
}
.hero-score { 
    font-size: 48pt !important; 
    font-weight: 700 !important; 
    line-height: 1 !important; 
}
.hero-score.strong { color: #16a34a !important; }
.hero-score.moderate { color: #ca8a04 !important; }
.hero-score.weak { color: #dc2626 !important; }

.hero-badge { 
    display: inline-block !important; 
    padding: 6pt 20pt !important; 
    border-radius: 4pt !important; 
    font-size: 11pt !important; 
    font-weight: 600 !important; 
    margin: 10pt 0 !important; 
    text-transform: uppercase !important;
    letter-spacing: 2px !important;
}
.hero-badge.strong { background: #16a34a !important; color: white !important; }
.hero-badge.moderate { background: #ca8a04 !important; color: white !important; }
.hero-badge.weak { background: #dc2626 !important; color: white !important; }

.hero-sub { font-size: 10pt !important; color: #333 !important; margin-top: 10pt !important; }

/* Score Trajectory - stays on page 1 */
.trajectory-chart, .pro-section:has(.trajectory-chart) {
    padding: 15pt !important;
    margin: 15pt 0 !important;
    border: 1pt solid #e5e5e5 !important;
    page-break-before: avoid !important;
}

.trajectory-chart svg { 
    max-width: 100% !important; 
    height: auto !important; 
    max-height: 180pt !important; 
}

/* ============================================
   PAGE BREAKS - EACH SECTION ON NEW PAGE
   ============================================ */

/* Page 2: Executive Summary */
.pro-section:has(h2:contains("Executive Summary")),
.pro-section h2.section-title:first-of-type {
    page-break-before: auto !important;
}

/* Force page breaks using nth-child since :has/:contains not universal */
.section, .pro-section, .premium-section {
    padding: 20pt 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* Executive Summary - Page 2 */
#content > .pro-section:nth-of-type(1) {
    page-break-before: auto !important;
}

/* Financial Metrics - Page 3 */
#content > .section:nth-of-type(1) {
    page-break-before: auto !important;
}

/* Cash Flow - stays with Financial Metrics */
#content > .section:nth-of-type(2) {
    page-break-before: avoid !important;
}

/* Key Insights - Page 4 */
#content > .section:nth-of-type(3) {
    page-break-before: avoid !important;
}

/* Deep Dive Scores - Page 5 */
#content > .pro-section:nth-of-type(2) {
    page-break-before: auto !important;
}

/* Management Credibility - Page 6 */
#content > .premium-section:nth-of-type(1) {
    page-break-before: auto !important;
}

/* Forward Guidance - Page 7 */
#content > .premium-section:nth-of-type(2) {
    page-break-before: avoid !important;
}

/* Risk & Changes - Page 8/9 */
#content > .premium-section:nth-of-type(3) {
    page-break-before: auto !important;
}

/* Red Flags - Page 10 */
#content > .premium-section:nth-of-type(4) {
    page-break-before: auto !important;
}

/* Decision Framework - Page 11 */
#content > .premium-section:nth-of-type(5) {
    page-break-before: avoid !important;
}

/* === SECTION TITLES === */
h2, .section-title {
    font-size: 14pt !important;
    font-weight: 700 !important;
    margin: 0 0 12pt 0 !important;
    padding-bottom: 6pt !important;
    border-bottom: 2pt solid #b8860b !important;
    color: #1a1a1a !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
}

h3 { 
    font-size: 11pt !important; 
    font-weight: 700 !important; 
    margin: 12pt 0 8pt 0 !important; 
    color: #333 !important;
}

p, li, span { 
    font-size: 10pt !important; 
    line-height: 1.5 !important; 
    color: #1a1a1a !important;
}

/* FORCE ALL TEXT DARK FOR READABILITY */
p, li, span, div, td, th, label, a {
    color: #1a1a1a !important;
}

/* Section subtitles and muted text - make readable */
.hero-company, .hero-sub, .metric-label, .pro-metric-label {
    color: #444 !important;
}

/* Keep accent colors for scores */
.hero-score.strong, .good { color: #16a34a !important; }
.hero-score.moderate, .neutral { color: #ca8a04 !important; }
.hero-score.weak, .bad { color: #dc2626 !important; }

/* Table headers */
th {
    color: #1a1a1a !important;
}

/* Override any rgba light colors */
[style*="color:"], [style*="color:"] * {
    color: #1a1a1a !important;
}
.card { padding: 0 !important; margin: 0 !important; border: none !important; }

/* === GRIDS === */
.metrics-grid { 
    display: grid !important; 
    grid-template-columns: repeat(4, 1fr) !important; 
    gap: 10pt !important; 
    margin: 12pt 0 !important;
}

.cash-flow-grid { 
    display: grid !important; 
    grid-template-columns: repeat(3, 1fr) !important; 
    gap: 10pt !important; 
}

.insights-grid { 
    display: grid !important; 
    grid-template-columns: 1fr 1fr !important; 
    gap: 15pt !important; 
}

.pro-grid { 
    display: grid !important; 
    grid-template-columns: repeat(5, 1fr) !important; 
    gap: 8pt !important; 
}

.metric-card, .pro-metric {
    background: #f8f9fa !important;
    border: 1pt solid #e0e0e0 !important;
    padding: 10pt !important;
    text-align: center !important;
}

.metric-label, .pro-metric-label { 
    font-size: 7pt !important; 
    text-transform: uppercase !important; 
    color: #333 !important; 
    margin-bottom: 3pt !important;
}

.metric-value, .pro-metric-value { 
    font-size: 14pt !important; 
    font-weight: 700 !important; 
}

/* === COLORS === */
.good { color: #16a34a !important; }
.neutral { color: #ca8a04 !important; }
.bad { color: #dc2626 !important; }

/* === INSIGHTS === */
.insight-card {
    background: white !important;
    border: 1pt solid #e5e5e5 !important;
    padding: 12pt !important;
}

.insight-card h3 {
    font-size: 11pt !important;
    margin: 0 0 8pt 0 !important;
    padding-bottom: 5pt !important;
    border-bottom: 1pt solid #eee !important;
}

.insight-card h3.green { color: #16a34a !important; }
.insight-card h3.red { color: #dc2626 !important; }

.insight-list { list-style: none !important; padding: 0 !important; margin: 0 !important; }

.insight-list li {
    padding: 5pt 0 5pt 16pt !important;
    position: relative !important;
    font-size: 9pt !important;
    line-height: 1.5 !important;
}

.insight-list.strengths li::before { 
    content: "✓" !important; 
    position: absolute !important; 
    left: 0 !important; 
    color: #16a34a !important; 
    font-weight: 700 !important;
}

.insight-list.concerns li::before { 
    content: "!" !important; 
    position: absolute !important; 
    left: 2pt !important; 
    color: #dc2626 !important; 
    font-weight: 700 !important;
}

/* === TABLES === */
table { 
    width: 100% !important; 
    border-collapse: collapse !important; 
    font-size: 8pt !important; 
    margin: 10pt 0 !important; 
}

th, td { 
    padding: 6pt 8pt !important; 
    border: 1pt solid #ddd !important; 
    text-align: left !important;
}

th { 
    background: #f5f5f5 !important; 
    font-weight: 700 !important; 
    text-transform: uppercase !important;
    font-size: 7pt !important;
}

/* === EXPAND COLLAPSED SECTIONS === */
#guidanceHistoryTable, #scoreHistoryTable {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#guidanceToggleIcon, #scoreToggleIcon { display: none !important; }

/* === UNBLUR PRO/PREMIUM CONTENT === */
.blurred, .blurred > * { filter: none !important; }
.pro-section > *, .premium-section > * { 
    filter: none !important; 
    opacity: 1 !important; 
    visibility: visible !important; 
}

/* === FOOTER === */
/* Timestamp element for print */
.print-timestamp {
    display: none;
}

@media print {
    .print-timestamp {
        display: block !important;
        text-align: center !important;
        font-size: 9pt !important;
        color: #666 !important;
        font-style: italic !important;
        margin-top: 8pt !important;
        padding-top: 8pt !important;
        border-top: 1px solid #ddd !important;
    }
}

body::after {
    content: "Generated from theQfactor.io | For personal use only" !important;
    position: fixed !important;
    bottom: 0.5cm !important;
    left: 0 !important;
    right: 0 !important;
    text-align: center !important;
    font-size: 8pt !important;
    color: #444 !important;
    z-index: 9999 !important;
    display: block !important;
    visibility: visible !important;
}

/* === DISCLAIMER PAGE (add via JS) === */
.print-disclaimer {
    page-break-before: auto !important;
    padding: 40pt 20pt !important;
}

.print-disclaimer h2 {
    text-align: center !important;
    margin-bottom: 30pt !important;
}

.print-disclaimer p {
    font-size: 9pt !important;
    line-height: 1.6 !important;
    margin-bottom: 12pt !important;
    text-align: justify !important;
}

/* Show disclaimer in print */
@media print {
    .print-disclaimer {
        display: block !important;
    }
}

/* Disclaimer - hide on screen, show in print */
.print-disclaimer {
    display: none !important;
}

@media print {
    .print-disclaimer {
        display: block !important;
        padding: 30pt !important;
    }
}

/* Show disclaimer in print */
.print-disclaimer {
    display: block !important;
    padding: 40pt 20pt !important;
    text-align: left !important;
}

.print-disclaimer h2 {
    text-align: center !important;
    font-size: 16pt !important;
    margin-bottom: 25pt !important;
    color: #1a1a1a !important;
}

.print-disclaimer p {
    font-size: 9pt !important;
    line-height: 1.7 !important;
    margin-bottom: 12pt !important;
    text-align: justify !important;
}

/* Disclaimer - FORCE show in print */
@media print {
    .print-disclaimer {
        display: block !important;
        page-break-before: auto !important;
        padding: 40pt 20pt !important;
    }
    
    .print-disclaimer h2 {
        text-align: center !important;
        font-size: 18pt !important;
        margin-bottom: 30pt !important;
    }
    
    .print-disclaimer p {
        font-size: 9pt !important;
        line-height: 1.7 !important;
        margin-bottom: 12pt !important;
        text-align: justify !important;
    }
}

/* FORCE disclaimer to show in print - override inline style */
@media print {
    .print-disclaimer {
        display: block !important;
        visibility: visible !important;
        page-break-before: auto !important;
        padding: 50pt 30pt !important;
        background: white !important;
    }
}

/* Override screen-hide in print */
@media print {
    .screen-hide.print-disclaimer {
        display: block !important;
        page-break-before: auto !important;
    }
}

/* Disclaimer - full page, centered */
@media print {
    .print-disclaimer {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        min-height: 100vh !important;
        height: 100vh !important;
        page-break-before: auto !important;
        page-break-after: avoid !important;
        padding: 50pt !important;
        box-sizing: border-box !important;
    }
    
    .print-disclaimer h2 {
        font-size: 20pt !important;
        margin-bottom: 30pt !important;
        color: #1a1a1a !important;
    }
    
    .print-disclaimer p {
        font-size: 9pt !important;
        line-height: 1.8 !important;
        margin-bottom: 15pt !important;
        text-align: center !important;
        max-width: 500pt !important;
    }
}

/* ================================================
   DISCLAIMER - Last page, centered
   ================================================ */
.print-disclaimer {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 100vh !important;
    page-break-before: auto !important;
    text-align: center !important;
    padding: 60pt 40pt !important;
    box-sizing: border-box !important;
}

.print-disclaimer h2 {
    font-size: 22pt !important;
    font-weight: 700 !important;
    margin-bottom: 40pt !important;
    color: #1a1a1a !important;
}

.print-disclaimer p {
    font-size: 9pt !important;
    line-height: 1.8 !important;
    margin-bottom: 15pt !important;
    text-align: center !important;
    max-width: 450pt !important;
    color: #333 !important;
}

/* Force show disclaimer in print */
.print-disclaimer {
    display: flex !important;
}

/* FORCE disclaimer visible in print - override inline style */
@media print {
    .print-disclaimer {
        display: flex !important;
        visibility: visible !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        min-height: 80vh !important;
        text-align: center !important;
        padding: 40px !important;
        page-break-before: auto !important;
    }
}


/* === FORCE DARK TEXT ON ALL CONTENT === */
.assessment-content,
.assessment-content p,
.guidance-content,
.guidance-content p,
.guidance-content td,
.red-flag-item,
.red-flag-item span,
.red-flag-text,
.credibility-assessment,
.credibility-assessment p,
.outlook-text,
.outlook-content,
.guidance-table td,
[class*="content"],
[class*="text"],
[class*="description"] {
    color: #1a1a1a !important;
    opacity: 1 !important;
}

/* Override any light/muted text */
.text-muted,
.text-secondary,
[style*="color: var(--text"],
[style*="color:var(--text"],
[style*="opacity"],
[style*="rgba"] {
    color: #1a1a1a !important;
    opacity: 1 !important;
}

/* Red flags text must be dark */
.red-flags-list li,
.red-flag-item p,
.flag-text {
    color: #1a1a1a !important;
}

/* Forward guidance table */
.guidance-table,
.guidance-table th,
.guidance-table td,
.guidance-evolution td,
.guidance-evolution th {
    color: #1a1a1a !important;
}

/* Management credibility assessment */
.credibility-content,
.credibility-text,
.assessment-text {
    color: #1a1a1a !important;
}


/* ============================================= */
/* PDF FONT COLOR FIX - Override CSS Variables  */
/* ============================================= */

/* Force ALL CSS variable colors to dark for print */
[style*="var(--text-muted)"],
[style*="var(--text-secondary)"],
[style*="var(--text-tertiary)"],
[style*="var(--text-primary)"] {
    color: #1a1a1a !important;
}

/* Specific overrides for common light-colored elements */
.section-title,
.metric-label,
.pro-metric-label,
.hero-sub,
.hero-company,
h2, h3, h4,
.card-title,
label,
caption,
figcaption {
    color: #1a1a1a !important;
}

/* Table text */
table, thead, tbody, tr, td, th {
    color: #1a1a1a !important;
}

/* Paragraph and list text */
p, li, span, div {
    color: #1a1a1a !important;
}

/* Links (except navigation) */
a:not(.nav-link) {
    color: #1a1a1a !important;
}

/* Badge text on colored backgrounds stays white */
.hero-badge, .pro-badge, .badge {
    color: white !important;
}

/* Score colors - keep these colorful for meaning */
.hero-score.strong,
.score-value.strong,
.good,
[class*="green"] {
    color: #16a34a !important;
}

.hero-score.moderate,
.score-value.moderate,
.neutral,
[class*="amber"],
[class*="yellow"] {
    color: #ca8a04 !important;
}

.hero-score.weak,
.score-value.weak,
.bad,
[class*="red"] {
    color: #dc2626 !important;
}

/* Force inline style overrides - nuclear option */
*[style*="color:"] {
    color: #1a1a1a !important;
}

/* But preserve status colors */
*[style*="green"], *[style*="#16a34a"], *[style*="accent-green"] {
    color: #16a34a !important;
}
*[style*="red"], *[style*="#dc2626"], *[style*="accent-red"] {
    color: #dc2626 !important;
}
*[style*="gold"], *[style*="#b8860b"], *[style*="accent-gold"] {
    color: #b8860b !important;
}


/* ============================================= */
/* NUCLEAR TEXT COLOR FIX - Force all text dark */
/* ============================================= */

/* Override ANY element with inline color styles */
[style] {
    color: #1a1a1a !important;
}

/* But preserve status colors explicitly */
.hero-score.strong, [style*="16a34a"], [style*="accent-green"] { color: #16a34a !important; }
.hero-score.moderate, [style*="ca8a04"], [style*="accent-gold"] { color: #ca8a04 !important; }
.hero-score.weak, [style*="dc2626"], [style*="accent-red"] { color: #dc2626 !important; }
.hero-badge { color: white !important; }

/* Target specific light-colored text patterns from analysis.html */
[style*="text-muted"], 
[style*="text-secondary"], 
[style*="text-tertiary"],
[style*="text-primary"] {
    color: #1a1a1a !important;
}

/* Guidance Evolution table - force dark text */
.guidance-table td,
.guidance-table th,
table td,
table th {
    color: #1a1a1a !important;
}

/* Red flags list items */
.red-flag-item,
.red-flag-text,
[class*="red-flag"] {
    color: #1a1a1a !important;
}

/* Assessment/description text */
.assessment-text,
.description,
.summary-text,
[class*="description"],
[class*="assessment"] {
    color: #1a1a1a !important;
}

/* Force all spans and divs inside sections */
.pro-section span,
.pro-section div,
.pro-section p,
section span,
section div,
section p {
    color: #1a1a1a !important;
}


/* Hide LATEST badge in print tables */
@media print {
    span[style*="LATEST"],
    td span[style*="accent-gold"][style*="0.7rem"] {
        display: none !important;
    }
}


/* ============================================
   COMPACT PRINT LAYOUT - Reduce whitespace
   ============================================ */

/* Reduce section padding for print */
.premium-section,
.pro-section,
.section {
    padding: 10pt 0 !important;
    margin: 0 !important;
}

/* Compact the Management Credibility assessment box */
.premium-section > div[style*="display:flex"] {
    margin-bottom: 10pt !important;
}

/* Reduce card/box padding in print */
div[style*="background:var(--bg-secondary)"] {
    padding: 8pt !important;
    margin-bottom: 6pt !important;
}

/* Reduce gaps in grids */
div[style*="display:grid"][style*="gap"] {
    gap: 8pt !important;
}

/* Compact tables */
table {
    margin: 10pt 0 !important;
}

td, th {
    padding: 6pt 8pt !important;
}

/* Remove excessive margins after sections */
.premium-section + .premium-section,
.pro-section + .pro-section,
.section + .section {
    margin-top: 0 !important;
}


/* ============================================
   FORCE SHOW COLLAPSED SECTIONS IN PRINT
   ============================================ */

/* Force show history tables */
#scoreHistoryTable,
#guidanceHistoryTable,
[id="scoreHistoryTable"],
[id="guidanceHistoryTable"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Hide toggle icons in print */
#scoreToggleIcon,
#guidanceToggleIcon,
[id*="ToggleIcon"] {
    display: none !important;
}

/* ============================================
   COMPACT SPACING FOR PRINT
   ============================================ */

/* Reduce padding on all sections */
.premium-section,
.pro-section,
.section {
    padding: 8pt 0 !important;
    margin: 0 0 5pt 0 !important;
}

/* Compact flex containers */
[style*="margin-bottom:var(--space-lg)"] {
    margin-bottom: 8pt !important;
}

[style*="gap:var(--space-lg)"] {
    gap: 8pt !important;
}

[style*="gap:var(--space-md)"] {
    gap: 6pt !important;
}

/* Compact cards */
[style*="padding:var(--space-md)"] {
    padding: 6pt !important;
}

/* Compact grids */
[style*="display:grid"] {
    gap: 6pt !important;
}

/* Tables more compact */
.guidance-table td,
.guidance-table th,
table td,
table th {
    padding: 4pt 6pt !important;
    font-size: 8pt !important;
    line-height: 1.3 !important;
}

/* Section titles */
h2.section-title {
    margin-bottom: 8pt !important;
    padding-bottom: 4pt !important;
}


/* ============================================
   FORCE DETAILS/SUMMARY OPEN IN PRINT
   ============================================ */

/* Force all details elements to be open */
details {
    display: block !important;
}

details[open] {
    display: block !important;
}

details > summary {
    display: none !important;  /* Hide "VIEW EVIDENCE" toggle */
}

details > *:not(summary) {
    display: block !important;
    visibility: visible !important;
}

/* Show the content inside details */
details > div,
details > p {
    display: block !important;
}

/* ============================================
   REDUCE WHITESPACE IN SECTIONS
   ============================================ */

/* Management Credibility - reduce the assessment box margin */
.premium-section > div:first-of-type {
    margin-bottom: 10pt !important;
}

/* Reduce vertical spacing */
[style*="margin-bottom:var(--space-lg)"] {
    margin-bottom: 6pt !important;
}

[style*="margin-top:var(--space-lg)"] {
    margin-top: 6pt !important;
}

[style*="margin-top:var(--space-md)"] {
    margin-top: 4pt !important;
}

[style*="margin-bottom:var(--space-md)"] {
    margin-bottom: 4pt !important;
}

/* Cards and boxes - compact padding */
[style*="padding:var(--space-md)"] {
    padding: 6pt !important;
}

[style*="padding:var(--space-sm)"] {
    padding: 4pt !important;
}

/* Evidence title - add it back since we hid summary */
details > p[style*="italic"] {
    display: block !important;
    font-size: 8pt !important;
    margin: 4pt 0 !important;
}

details > p::before {
    content: "Evidence from Annual Reports" !important;
    display: block !important;
    font-weight: 600 !important;
    font-size: 9pt !important;
    color: #1a1a1a !important;
    margin-bottom: 4pt !important;
}


/* ============================================
   FORCE HERO + TRAJECTORY ON PAGE 1
   ============================================ */
.hero {
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
}

.trajectory-chart,
.trajectory-chart.pro-section,
div.trajectory-chart,
div.trajectory-chart.pro-section,
.pro-section.trajectory-chart {
    page-break-before: avoid !important;
    page-break-inside: avoid !important;
    margin-top: 0 !important;
}

/* Override any nth-of-type rules for trajectory */
#content > .trajectory-chart:first-of-type,
#content > div.trajectory-chart {
    page-break-before: avoid !important;
}

/* Print timestamp header */
.print-header {
    display: none;
}

@media print {
    .print-header {
        display: block !important;
        position: fixed !important;
        top: 0.5cm !important;
        right: 1cm !important;
        font-size: 9pt !important;
        color: rgba(0, 0, 0, 0.5) !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ============================================
   DISCLAIMER PAGE BREAK (ONLY ONE)
   ============================================ */
.print-disclaimer {
    page-break-before: always !important;
}

/* ============================================
   FIX ORPHANED HEADERS - Keep with content
   ============================================ */
h2, h3, h4,
.section-title,
.section-header,
[class*="section"] > h2:first-child,
[class*="section"] > h3:first-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
}

/* Keep at least 3 lines after heading */
h2, h3, .section-title {
    orphans: 3 !important;
    widows: 3 !important;
}

/* ============================================
   STRONGER ORPHAN FIX - Keep header with table
   ============================================ */
/* Target the wrapper divs containing header + table */
div:has(> div > h4):has(> div > table),
div:has(> [onclick*="toggle"]) {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
}

/* Force header and its next element to stay together */
[onclick*="toggle"],
div:has(> h4[style*="SCORE EVOLUTION"]),
div:has(> h4[style*="FORWARD GUIDANCE"]) {
    page-break-after: avoid !important;
    break-after: avoid !important;
}

/* ============================================
   PRINT COVER PAGE
   ============================================ */
.print-cover-page {
    display: none;
}

@media print {
    .print-cover-page {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 90vh;
        text-align: center;
        page-break-after: always !important;
    }
    
    .print-cover-logo {
        width: 120px;
        height: auto;
        margin-bottom: 40px;
    }
    
    .print-cover-brand {
        font-size: 14pt;
        letter-spacing: 4px;
        color: #d4a84b;
        margin-bottom: 60px;
    }
    
    .print-cover-company {
        font-size: 36pt;
        font-weight: 700;
        color: #1a1a1a;
        margin-bottom: 10px;
    }
    
    .print-cover-name {
        font-size: 14pt;
        color: #666;
        margin-bottom: 40px;
    }
    
    .print-cover-score {
        font-size: 72pt;
        font-weight: 700;
        margin-bottom: 10px;
    }
    
    .print-cover-score.strong { color: #22c55e; }
    .print-cover-score.moderate { color: #eab308; }
    .print-cover-score.weak { color: #ef4444; }
    
    .print-cover-rating {
        display: inline-block;
        padding: 8px 24px;
        border-radius: 20px;
        font-size: 14pt;
        font-weight: 600;
        color: white;
        margin-bottom: 40px;
    }
    
    .print-cover-rating.strong { background: #22c55e; }
    .print-cover-rating.moderate { background: #eab308; }
    .print-cover-rating.weak { background: #ef4444; }
    
    .print-cover-date {
        font-size: 10pt;
        color: #999;
        margin-top: 40px;
    }
}

/* ============================================
   PRINT TABLE OF CONTENTS
   ============================================ */
.print-toc {
    display: none;
}

@media print {
    .print-toc {
        display: block !important;
        padding: 40px;
        page-break-after: always !important;
    }
    
    .print-toc h2 {
        font-size: 18pt;
        color: #1a1a1a;
        margin-bottom: 30px;
        padding-bottom: 10px;
        border-bottom: 2px solid #d4a84b;
    }
    
    .print-toc-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    
    .print-toc-item {
        display: flex;
        align-items: baseline;
        padding: 12px 0;
        border-bottom: none;
        font-size: 11pt;
    }
    
    .print-toc-item:last-child {
        border-bottom: none;
    }
    
    .print-toc-num {
        width: 30px;
        color: #d4a84b;
        font-weight: 600;
    }
    
    .print-toc-title {
        flex: 1;
        color: #1a1a1a;
    }
}

/* ============================================
   HIDE COVER & TOC ON SCREEN (show only in print)
   ============================================ */
.print-cover-page,
.print-toc {
    display: none !important;
}

@media print {
    .print-cover-page {
        display: flex !important;
    }
    .print-toc {
        display: block !important;
    }
}

/* ============================================
   DISCLAIMER - CONSOLIDATED RULES
   ============================================ */
.print-disclaimer {
    display: none;
}

@media print {
    .print-disclaimer {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 80vh;
        text-align: center;
        padding: 40px;
        page-break-before: always;
    }
    
    .print-disclaimer h2 {
        margin-bottom: 30px;
        font-size: 18pt;
    }
    
    .print-disclaimer p {
        max-width: 500px;
        margin-bottom: 15px;
        font-size: 10pt;
        line-height: 1.6;
    }
}
