/* ============================================================
   EXEC Assessment System — Notion-Inspired Design System
   Warm minimalism for child development assessment tools
   ============================================================ */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Inter font — locally hosted, Latin subset, variable weight (300-700) */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('../fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Warm neutral primary: soft near-black with subtle warmth */
    --primary: #31302e;
    --primary-light: #615d59;
    /* Single accent: Notion Blue — the only saturated core UI color */
    --accent: #0075de;
    --accent-dark: #005bab;
    --accent-light: #097fe8;
    /* Semantic status */
    --success: #2a9d99;
    --success-bg: #ecfaf9;
    --success-dark: #1f7a77;
    --warning: #dd5b00;
    --warning-bg: #fff6f0;
    --warning-dark: #b84800;
    --danger: #c41c1c;
    --danger-bg: #fef5f5;
    --danger-dark: #9a1414;
    /* Accent surface (AI/badge/focus-hover) */
    --accent-bg: #f2f9ff;
    /* Severity scale — Notion-tuned, WCAG AA compliant */
    --sev-normal: #2a9d99;
    --sev-normal-bg: #ecfaf9;
    --sev-normal-border: rgba(42,157,153,0.22);
    --sev-mild: #b8860b;
    --sev-mild-bg: #fdf6e3;
    --sev-mild-border: rgba(184,134,11,0.22);
    --sev-moderate: #dd5b00;
    --sev-moderate-bg: #fff6f0;
    --sev-moderate-border: rgba(221,91,0,0.22);
    --sev-high: #c41c1c;
    --sev-high-bg: #fef5f5;
    --sev-high-border: rgba(196,28,28,0.22);
    /* Warm surface hierarchy */
    --bg: #fbfbfa;
    --bg-alt: #f6f5f4;
    --card-bg: #ffffff;
    /* Text: near-black not pure black */
    --text: rgba(0,0,0,0.95);
    --text-secondary: #615d59;
    --text-light: #76726c; /* WCAG AA: 4.6:1 on #fbfbfa (was #a39e98 @ 2.8:1) */
    /* Whisper border */
    --border: rgba(0,0,0,0.1);
    --border-light: rgba(0,0,0,0.06);
    /* Multi-layer shadow system */
    --shadow: rgba(0,0,0,0.04) 0px 4px 18px, rgba(0,0,0,0.027) 0px 2.025px 7.85px, rgba(0,0,0,0.02) 0px 0.8px 2.93px, rgba(0,0,0,0.01) 0px 0.175px 1.04px;
    --shadow-lg: rgba(0,0,0,0.01) 0px 1px 3px, rgba(0,0,0,0.02) 0px 3px 7px, rgba(0,0,0,0.02) 0px 7px 15px, rgba(0,0,0,0.04) 0px 14px 28px, rgba(0,0,0,0.05) 0px 23px 52px;
    --shadow-card-hover: rgba(0,0,0,0.06) 0px 6px 24px, rgba(0,0,0,0.035) 0px 3px 10px;
    /* Border radius scale */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-btn: 4px;
    --radius-pill: 9999px;
    /* Typography scale — modular, WCAG-friendly (16px base) */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    --fs-xs: 0.75rem;    /* 12px — captions, badges */
    --fs-sm: 0.875rem;   /* 14px — secondary text, table cells */
    --fs-base: 1rem;     /* 16px — body, inputs */
    --fs-lg: 1.125rem;   /* 18px — lead text, card titles */
    --fs-xl: 1.25rem;    /* 20px — section headings */
    --fs-2xl: 1.5rem;    /* 24px — page sub-titles */
    --fs-3xl: 1.875rem;  /* 30px — page titles */
    --fs-4xl: 2.25rem;   /* 36px — hero / report headline */
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --lh-tight: 1.25;    /* headings */
    --lh-snug: 1.4;      /* card titles */
    --lh-normal: 1.6;    /* body */
    --lh-relaxed: 1.75;  /* long-form reading */
    /* Spacing scale — 4px base unit, 8pt rhythm */
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */
    --space-12: 3rem;    /* 48px */
    --space-16: 4rem;    /* 64px */
    --space-20: 5rem;    /* 80px — section gaps */
    /* Z-index scale — consistent stacking context */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 1000;
    --z-modal: 1100;
    --z-toast: 1200;
    /* Transition */
    --transition: all 0.2s ease;
    --transition-fast: 120ms ease;
    --transition-slow: 320ms ease;
    /* Header — dark in both themes */
    --header-bg: #31302e;
}

/* ============================================================
   Dark Theme — Warm dark, WCAG AA compliant
   Activated via [data-theme="dark"] on <html>
   ============================================================ */
[data-theme="dark"] {
    /* Primary — inverted to warm white for text on dark */
    --primary: #e8e6e3;
    --primary-light: #a8a39e;

    /* Accent — brighter blue for contrast on dark surfaces */
    --accent: #4d9bf0;
    --accent-dark: #6db0f5;
    --accent-light: #3d8be0;

    /* Semantic — keep hues, adjust brightness for dark bg */
    --success: #3dbab5;
    --success-bg: rgba(42,157,153,0.12);
    --success-dark: #5ecac6;
    --warning: #f0762e;
    --warning-bg: rgba(221,91,0,0.12);
    --warning-dark: #f58a47;
    --danger: #e54545;
    --danger-bg: rgba(196,28,28,0.12);
    --danger-dark: #ef5c5c;

    /* Accent surface */
    --accent-bg: rgba(77,155,240,0.1);

    /* Severity — same hues, dark-tinted backgrounds */
    --sev-normal: #3dbab5;
    --sev-normal-bg: rgba(42,157,153,0.12);
    --sev-normal-border: rgba(61,186,181,0.25);
    --sev-mild: #d4a030;
    --sev-mild-bg: rgba(184,134,11,0.12);
    --sev-mild-border: rgba(212,160,48,0.25);
    --sev-moderate: #e96d80;
    --sev-moderate-bg: rgba(233,109,128,0.12);
    --sev-moderate-border: rgba(233,109,128,0.25);
    --sev-high: #c62828;
    --sev-high-bg: rgba(196,28,28,0.12);
    --sev-high-border: rgba(198,40,40,0.25);

    /* Warm surface hierarchy — dark */
    --bg: #1a1918;
    --bg-alt: #232221;
    --card-bg: #2a2928;

    /* Text — warm white, WCAG AA on dark bg */
    --text: rgba(255,255,255,0.92);
    --text-secondary: #a8a39e;
    --text-light: #8a8580; /* 4.5:1 on #1a1918 */

    /* Whisper border — light on dark */
    --border: rgba(255,255,255,0.1);
    --border-light: rgba(255,255,255,0.06);

    /* Shadow — deeper, more subtle on dark */
    --shadow: rgba(0,0,0,0.3) 0px 4px 18px, rgba(0,0,0,0.2) 0px 2px 7px, rgba(0,0,0,0.15) 0px 1px 3px;
    --shadow-lg: rgba(0,0,0,0.4) 0px 1px 3px, rgba(0,0,0,0.3) 0px 3px 7px, rgba(0,0,0,0.3) 0px 7px 15px, rgba(0,0,0,0.4) 0px 14px 28px;
    --shadow-card-hover: rgba(0,0,0,0.4) 0px 6px 24px, rgba(0,0,0,0.3) 0px 3px 10px;

    /* Header — even darker in dark mode */
    --header-bg: #131211;
}

/* Respect OS preference if no explicit choice */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --primary: #e8e6e3;
        --primary-light: #a8a39e;
        --accent: #4d9bf0;
        --accent-dark: #6db0f5;
        --accent-light: #3d8be0;
        --success: #3dbab5;
        --success-bg: rgba(42,157,153,0.12);
        --success-dark: #5ecac6;
        --warning: #f0762e;
        --warning-bg: rgba(221,91,0,0.12);
        --warning-dark: #f58a47;
        --danger: #e54545;
        --danger-bg: rgba(196,28,28,0.12);
        --danger-dark: #ef5c5c;
        --accent-bg: rgba(77,155,240,0.1);
        --sev-normal: #3dbab5;
        --sev-normal-bg: rgba(42,157,153,0.12);
        --sev-normal-border: rgba(61,186,181,0.25);
        --sev-mild: #d4a030;
        --sev-mild-bg: rgba(184,134,11,0.12);
        --sev-mild-border: rgba(212,160,48,0.25);
        --sev-moderate: #f0762e;
        --sev-moderate-bg: rgba(221,91,0,0.12);
        --sev-moderate-border: rgba(240,118,46,0.25);
        --sev-high: #e54545;
        --sev-high-bg: rgba(196,28,28,0.12);
        --sev-high-border: rgba(229,69,69,0.25);
        --bg: #1a1918;
        --bg-alt: #232221;
        --card-bg: #2a2928;
        --text: rgba(255,255,255,0.92);
        --text-secondary: #a8a39e;
        --text-light: #8a8580;
        --border: rgba(255,255,255,0.1);
        --border-light: rgba(255,255,255,0.06);
        --shadow: rgba(0,0,0,0.3) 0px 4px 18px, rgba(0,0,0,0.2) 0px 2px 7px, rgba(0,0,0,0.15) 0px 1px 3px;
        --shadow-lg: rgba(0,0,0,0.4) 0px 1px 3px, rgba(0,0,0,0.3) 0px 3px 7px, rgba(0,0,0,0.3) 0px 7px 15px, rgba(0,0,0,0.4) 0px 14px 28px;
        --shadow-card-hover: rgba(0,0,0,0.4) 0px 6px 24px, rgba(0,0,0,0.3) 0px 3px 10px;
        --header-bg: #131211;
    }
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Global focus indicator — WCAG 2.4.7 Focus Visible */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}
.btn:focus-visible, .nav-link:focus-visible, .filter-chip:focus-visible {
    outline-offset: 2px;
}
/* Mouse-only: suppress outline for mouse users on interactive elements */
:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================================
   Layout
   ============================================================ */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* Header — warm dark, clean */
.app-header {
    background: var(--header-bg);
    color: white;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: rgba(0,0,0,0.06) 0px 1px 3px, rgba(0,0,0,0.1) 0px 2px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: white;
}

.logo-icon {
    font-size: 1.4rem;
}

/* Lucide Icons — premium outline iconography */
i[data-lucide] {
    width: 1.15em;
    height: 1.15em;
    stroke-width: 1.8;
    vertical-align: -0.15em;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.header-nav {
    display: flex;
    gap: 0.8rem;
}

.nav-link {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
}

.nav-link:hover, .nav-link.active {
    color: white;
    background: rgba(255,255,255,0.08);
}

/* Footer — warm dark, subtle */
.app-footer {
    background: #31302e;
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.82rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.footer-note {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
}

/* ============================================================
   Hero Section (Index Page)
   ============================================================ */
.hero {
    text-align: center;
    padding: 3rem 0 2rem;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.8rem;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-light);
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Info Section */
.info-section {
    margin: 2rem 0 3rem;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-icon {
    font-size: 1.3rem;
}

.section-desc {
    color: var(--text-light);
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}

.info-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.8rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(0,0,0,0.14);
}

.info-icon {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
}

.info-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.info-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* Form Cards */
.forms-section {
    margin: 3rem 0;
}

.form-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.form-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.form-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(0,0,0,0.14);
}

.form-card-header {
    padding: 1.5rem 1.5rem 1rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.form-card-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.form-icon {
    font-size: 1.8rem;
}

.parent-bg { background: #4a7db5; }
.teacher-bg { background: #7c5cbf; }
.self-bg { background: #2a9d99; }

.form-card-body {
    padding: 1.2rem 1.5rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-card-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.form-card-info {
    list-style: none;
    margin-bottom: 1.5rem;
    flex: 1;
}

.form-card-info li {
    font-size: 0.88rem;
    padding: 0.35rem 0;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.form-card-info li:last-child {
    border-bottom: none;
}

/* ============================================================
   Component Library — Buttons
   Token-driven · WCAG AA · consistent interaction model
   Variants: primary / neutral / danger / success / ghost / outline
   Sizes: default / sm / lg · Modifier: block
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-btn);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    line-height: var(--lh-tight);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    text-align: center;
    transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
    font-family: inherit;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Sizes */
.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--fs-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--fs-base); }
.btn-block { display: flex; width: 100%; }

/* Primary — Notion Blue, main CTA */
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-dark);
    box-shadow: 0 2px 8px rgba(0,117,222,0.25);
}

/* Neutral — secondary actions, professional tone */
.btn-neutral {
    background: var(--card-bg);
    color: var(--text);
    border-color: var(--border);
}
.btn-neutral:hover:not(:disabled) {
    background: var(--bg-alt);
    border-color: rgba(0,0,0,0.18);
}

/* Danger — destructive actions */
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
    box-shadow: 0 2px 8px rgba(196,28,28,0.25);
}

/* Success — positive / affirmative actions */
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
    box-shadow: 0 2px 8px rgba(42,157,153,0.25);
}

/* Outline — accent-tinted secondary */
.btn-outline {
    background: var(--card-bg);
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
}

/* Ghost — minimal, low-emphasis */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    padding: var(--space-2) var(--space-3);
    font-size: var(--fs-xs);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-alt);
    color: var(--accent);
}

/* Legacy aliases — deprecated, will be removed after full migration */
.btn-secondary { background: var(--danger); color: #fff; }
.btn-secondary:hover:not(:disabled) { background: var(--danger-dark); }
.btn-accent { background: var(--success); color: #fff; }
.btn-accent:hover:not(:disabled) { background: var(--success-dark); }

/* ============================================================
   Component Library — Theme Toggle (floating, dark/light switch)
   ============================================================ */
.theme-toggle {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-pill);
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: var(--z-overlay);
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: scale(1.08);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Hide toggle in print */
@media print {
    .theme-toggle { display: none !important; }
}

/* Scoring Info */
.scoring-info {
    margin: 3rem 0;
}

.scoring-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
}

.scoring-item {
    background: var(--card-bg);
    padding: 1.3rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
}

.scoring-item h4 {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: var(--primary);
}

.scoring-item p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* ============================================================
   Assessment Page
   ============================================================ */
.assessment-main {
    max-width: 800px;
}

.progress-container {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    position: sticky;
    top: 60px;
    z-index: 50;
}

.progress-bar {
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.35s ease;
    width: 0%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.assessment-info-bar {
    display: flex;
    gap: 2rem;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.info-item {
    font-size: 0.9rem;
}

.info-label { color: var(--text-light); }
.info-value { font-weight: 600; color: var(--primary); }

/* Instructions Box */
.instructions-box {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.instructions-box h3 {
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.instructions-content {
    text-align: left;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.instructions-content p {
    font-size: 0.92rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.scale-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.legend-item {
    font-size: 0.88rem;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 500;
}

.legend-n { background: var(--success-bg); color: var(--success); }
.legend-s { background: var(--warning-bg); color: var(--warning); }
.legend-o { background: var(--danger-bg); color: var(--danger); }

/* Child Info Form */
.child-info-form {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.child-info-form h3 {
    margin-bottom: 1.2rem;
    font-size: 1.2rem;
    color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text);
    margin-bottom: var(--space-2);
}

.required { color: var(--danger); }

/* Unified input — .form-input works standalone or inside .form-group */
.form-input,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--fs-base);
    font-family: inherit;
    line-height: var(--lh-normal);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background: var(--card-bg);
    color: var(--text);
}

.form-input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,117,222,0.12);
}

.form-input::placeholder,
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

/* ---- Form Validation ---- */
.form-input.is-invalid,
.form-group input.is-invalid,
.form-group select.is-invalid {
    border-color: var(--danger);
    box-shadow: none;
}

.form-input.is-invalid:focus,
.form-group input.is-invalid:focus,
.form-group select.is-invalid:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.invalid-feedback {
    display: none;
    color: var(--danger);
    font-size: var(--fs-xs);
    margin-top: var(--space-1);
    line-height: 1.4;
}

.is-invalid ~ .invalid-feedback,
.is-invalid + .invalid-feedback {
    display: block;
}

/* Valid state (subtle green accent) */
.form-input.is-valid,
.form-group input.is-valid {
    border-color: var(--success);
}

.form-input.is-valid:focus,
.form-group input.is-valid:focus {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

/* Assessment Form */
.assessment-form {
    margin-top: 1rem;
}

.question-card {
    background: var(--card-bg);
    padding: 1.5rem;
    margin-bottom: 0.8rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-left: 3px solid var(--border-light);
    transition: var(--transition);
}

.question-card:hover {
    border-left-color: var(--accent-light);
    box-shadow: var(--shadow-card-hover);
}

.question-card:active {
    transform: scale(0.99);
    transition: transform 60ms ease;
}

.question-card.answered {
    border-left-color: var(--success);
    background: var(--success-bg);
}

.question-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.6rem;
}

.question-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.question-card.answered .question-number {
    background: var(--success);
}

.scale-badge {
    font-size: 0.72rem;
    padding: 0.18rem 0.6rem;
    border-radius: var(--radius-pill);
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.1px;
}

.question-text {
    font-size: 1rem;
    color: var(--text);
    margin: 0.8rem 0 1rem;
    line-height: 1.5;
}

.options-group {
    display: flex;
    gap: 1rem;
}

.option-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.option-item:hover {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.option-item:active {
    transform: scale(0.97);
    transition: transform 60ms ease;
}

.option-item input[type="radio"] {
    /* Visually hidden but accessible — NOT display:none (would remove from a11y tree) */
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

/* Focus indicator on the label when its radio is focused — WCAG 2.4.7 */
.option-item:has(input:focus-visible) {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-color: var(--accent);
}

.option-item:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 0 0 2px rgba(0,117,222,0.15);
}

.option-n:has(input:checked) { border-color: var(--success); background: var(--success-bg); box-shadow: 0 0 0 2px rgba(42,157,153,0.15); }
.option-s:has(input:checked) { border-color: var(--warning); background: var(--warning-bg); box-shadow: 0 0 0 2px rgba(221,91,0,0.15); }
.option-o:has(input:checked) { border-color: var(--danger); background: var(--danger-bg); box-shadow: 0 0 0 2px rgba(196,28,28,0.15); }

.option-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.option-n .option-indicator { color: var(--sev-normal); }
.option-s .option-indicator { color: var(--sev-moderate); }
.option-o .option-indicator { color: var(--sev-high); }

.option-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

/* Submission */
.submit-section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    position: sticky;
    bottom: 1rem;
}

.submit-info {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* ============================================================
   Report Page
   ============================================================ */
.report-content {
    max-width: 950px;
}

/* Report Header — warm dark gradient */
.report-header {
    background: linear-gradient(160deg, #2a2a28 0%, #31302e 60%, #262523 100%);
    color: white;
    padding: 2.5rem 2.5rem 1.8rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.report-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
    text-align: center;
}

.report-subtitle {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.7);
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.report-meta {
    display: block;
    max-width: 900px;
    margin: 0 auto;
}

.meta-group {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: var(--space-4) var(--space-6);
    backdrop-filter: blur(4px);
}

.meta-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3) var(--space-6);
    align-items: start;
}

.meta-divider {
    height: 1px;
    background: rgba(255,255,255,0.12);
    margin: var(--space-3) 0;
}

.meta-item {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    text-align: left;
}

.meta-item--wide {
    grid-column: span 2;
}

.meta-label {
    display: block;
    font-size: var(--fs-xs);
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.meta-value {
    display: block;
    font-size: var(--fs-base);
    font-weight: 600;
    color: white;
    line-height: var(--lh-normal);
}



/* Report Sections */
.report-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.report-section .section-title {
    margin-bottom: 0.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
}

/* Validity */
.validity-section { }

.validity-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.validity-card {
    padding: 1.2rem;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 2px solid transparent;
}

.validity-ok { background: var(--sev-normal-bg); border-color: var(--sev-normal-border); }
.validity-warn { background: var(--sev-moderate-bg); border-color: var(--sev-moderate-border); }
.validity-bad { background: var(--sev-high-bg); border-color: var(--sev-high-border); }

.validity-card h4 {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.validity-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.validity-score small {
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 400;
}

.validity-class {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.3rem 0;
}

.validity-desc {
    font-size: 0.8rem;
    color: var(--text-light);
    line-height: 1.5;
    margin-top: 0.5rem;
}

.missing-notice {
    margin-top: 1rem;
    padding: 0.8rem;
    background: var(--warning-bg);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--warning-dark);
}

/* Chart */
.chart-container {
    height: 380px;
    margin: 1.5rem 0;
    padding-bottom: 1rem;
}

.chart-sub-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-light);
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    text-align: left;
}

#chartIndexContainer {
    height: 250px;
}

.chart-legend-info {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.8rem;
}

.legend-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: 0.3rem;
}

.legend-normal { background: var(--sev-normal); }
.legend-mild { background: var(--sev-mild); }
.legend-moderate { background: var(--sev-moderate); }
.legend-high { background: var(--sev-high); }

/* Scales Table */
.scales-table-wrapper {
    overflow-x: auto;
    margin: 1rem 0;
}

.scales-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.scales-table th {
    background: #31302e;
    color: white;
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 500;
    font-size: 0.85rem;
}

.scales-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.scales-table th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

.scales-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.scale-row { transition: var(--transition); }
.scale-row:hover { background: #f8f9fa; }

.scale-row-desc {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}

.row-high { background: var(--sev-high-bg); }
.row-moderate { background: var(--sev-moderate-bg); }
.row-mild { background: var(--sev-mild-bg); }

.t-score-cell {
    font-weight: 700;
    font-size: 1.1rem;
}

.t-score-flag { color: var(--danger); margin-left: 0.3rem; }

/* Badges — pill style */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.1px;
}

.badge-normal { background: var(--success-bg); color: var(--success); }
.badge-mild { background: var(--warning-bg); color: var(--warning); }
.badge-moderate { background: var(--sev-moderate-bg); color: var(--sev-moderate); }
.badge-high { background: var(--danger-bg); color: var(--danger); }

/* ============================================================
   Reusable Layout Components (extracted from dashboard.html)
   ============================================================ */

/* ---- Card (base) ---- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    border: 1px solid var(--border-light);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.card-header h2 {
    font-size: 1.15rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* ---- Status Badge (assessment status) ---- */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-completed { background: var(--success-bg); color: var(--success-dark); }
.status-draft { background: var(--warning-bg); color: var(--warning-dark); }

/* ---- Filter Chip ---- */
.filter-chip {
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 500;
    border: 1.5px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
    user-select: none;
}

.filter-chip:hover {
    border-color: var(--accent);
    color: var(--primary);
}

.filter-chip:active {
    transform: scale(0.95);
    transition: transform 60ms ease;
}

.filter-chip.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ---- Stat Card ---- */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-4) var(--space-6);
    text-align: center;
    border: 1.5px solid transparent;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.stat-card:active {
    transform: scale(0.97);
    transition: transform 60ms ease;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.3rem;
}

.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-4);
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-2);
    color: var(--text-light);
    opacity: 0.5;
}

.empty-state .empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.empty-state .empty-desc {
    font-size: 0.85rem;
    margin-bottom: var(--space-3);
}

.empty-state p {
    margin-bottom: var(--space-1);
}

.empty-state .btn {
    margin-top: var(--space-2);
}

/* ============================================================
   Skeleton Loading — Shimmer placeholders for async content
   ============================================================ */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--border-light) 25%,
        var(--bg-alt) 50%,
        var(--border-light) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
    display: block;
    line-height: 1;
}

/* Text line skeleton — use --w custom property for width */
.skeleton-text {
    height: 0.9rem;
    width: var(--w, 100%);
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    margin-bottom: 0;
    width: var(--w-last, 60%);
}

/* Title skeleton */
.skeleton-title {
    height: 1.4rem;
    width: 40%;
    margin-bottom: 0.8rem;
}

/* Circle skeleton (avatars) */
.skeleton-circle {
    width: var(--d, 40px);
    height: var(--d, 40px);
    border-radius: 50%;
    flex-shrink: 0;
}

/* Card skeleton */
.skeleton-card {
    padding: var(--space-4);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--card-bg);
}

/* Table row skeleton */
.skeleton-row {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

/* Reduced motion: static gray bar, no animation */
@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
        background: var(--bg-alt);
    }
}

/* Scale Interpretations */
.scale-interpretations {
    margin-top: 2rem;
}

.interpretation-card {
    padding: 1.2rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.8rem;
    border-left: 5px solid;
}

.interpretation-card h4 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.interpretation-card p {
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text);
}

.card-high { background: var(--sev-high-bg); border-left-color: var(--danger); }
.card-moderate { background: var(--sev-moderate-bg); border-left-color: var(--warning); }
.card-mild { background: var(--sev-mild-bg); border-left-color: var(--sev-mild); }

/* Index Grid */
.index-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.index-card {
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    transition: var(--transition);
}

.index-card:hover {
    box-shadow: var(--shadow);
}

.index-normal { border-color: var(--sev-normal-border); }
.index-mild { border-color: var(--sev-mild-border); }
.index-moderate { border-color: var(--sev-moderate-border); }
.index-high { border-color: var(--sev-high-border); background: var(--sev-high-bg); }

.index-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.index-header h4 {
    font-size: 0.95rem;
    color: var(--primary);
}

.index-badge {
    font-size: 0.72rem;
    padding: 0.15rem 0.55rem;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-pill);
    font-weight: 600;
}

.index-score-display {
    text-align: center;
    margin: 0.8rem 0;
}

.index-t {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

.index-unit {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-left: 0.3rem;
}

.index-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 0.8rem;
}

.index-interpretation {
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text);
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

/* Summary */
.summary-box {
    background: var(--bg-alt);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
}

.summary-box p {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 0.8rem;
}

.summary-box p:last-child {
    margin-bottom: 0;
}

/* Recommendations */
.recommendations-box {
    background: var(--accent-bg);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0,117,222,0.1);
    border-left: 3px solid var(--accent);
}

.recommendations-box h4 {
    font-size: 1rem;
    color: var(--primary);
    margin: 1rem 0 0.5rem;
}

.recommendations-box h4:first-child {
    margin-top: 0;
}

.recommendations-box p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 0.4rem;
    padding-left: 1rem;
}

/* Disclaimer */
.disclaimer {
    background: var(--warning-bg);
    border: 1px solid rgba(221,91,0,0.15);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    font-size: 0.82rem;
    color: #8a4a10;
    line-height: 1.6;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--sev-high-border);
}

/* ============================================================
   AI Report Section
   ============================================================ */

.ai-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.15rem 0.55rem;
    background: var(--accent);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ============================================================
   AI Interpretation & Recommendations Section
   ============================================================ */

/* --- Placeholder (before generation) --- */
.ai-placeholder {
    text-align: center;
    padding: 1rem 0;
}

.ai-placeholder-card {
    background: var(--accent-bg);
    border: 1.5px dashed rgba(0,117,222,0.25);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    max-width: 520px;
    margin: 0 auto;
    transition: var(--transition);
}

.ai-placeholder-card:hover {
    border-color: rgba(0,117,222,0.5);
    box-shadow: 0 4px 20px rgba(0,117,222,0.08);
}

.ai-placeholder-icon {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    opacity: 0.85;
}

.ai-placeholder-desc {
    color: var(--text-light);
    font-size: 0.92rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.ai-generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 2rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,117,222,0.25);
}

.ai-generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,117,222,0.35);
    background: var(--accent-dark);
}

.ai-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai-retry-btn {
    background: var(--warning);
    box-shadow: 0 2px 8px rgba(221,91,0,0.25);
}

.ai-retry-btn:hover {
    box-shadow: 0 4px 16px rgba(221,91,0,0.35);
    background: var(--warning-dark);
}

.ai-note {
    margin-top: 1rem;
    font-size: 0.78rem;
    color: var(--text-light);
}

/* --- Loading spinner --- */
.ai-loading {
    text-align: center;
    padding: 3.5rem 1rem;
    background: var(--accent-bg);
    border-radius: var(--radius);
    border: 1px solid rgba(0,117,222,0.1);
}

.ai-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3.5px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}

.ai-loading p {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.ai-loading-hint {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* --- Extended Psychometric Data Section --- */
.extended-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.extended-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.extended-card:last-child {
    margin-bottom: 0;
}

.extended-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.extended-card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* --- AQ-Child Report Module --- */
.aq-child-section {
    border-left: 4px solid var(--accent);
}

.aq-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.aq-score-card {
    position: relative;
    overflow: hidden;
}

.aq-score-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,117,222,0.10), transparent 55%);
    pointer-events: none;
}

.aq-level-high::before {
    background: linear-gradient(135deg, var(--sev-high-border), transparent 55%);
}

.aq-level-mid::before {
    background: linear-gradient(135deg, var(--sev-mild-border), transparent 55%);
}

.aq-level-low::before {
    background: linear-gradient(135deg, var(--sev-normal-border), transparent 55%);
}

.aq-score-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.8rem 0;
    position: relative;
}

.aq-score-number {
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.aq-level-high .aq-score-number {
    color: var(--sev-high);
}

.aq-level-mid .aq-score-number {
    color: var(--sev-mild);
}

.aq-level-low .aq-score-number {
    color: var(--sev-normal);
}

.aq-score-number span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 0.15rem;
}

.aq-score-meta {
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.aq-score-meta strong {
    display: block;
    color: var(--text);
    font-size: 1.25rem;
    margin-top: 0.2rem;
}

.aq-intensity-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
}

.aq-intensity-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--sev-normal) 0%, var(--sev-mild) 50%, var(--sev-high) 100%);
}

.aq-note-list {
    display: grid;
    gap: 0.65rem;
}

.aq-note-list p {
    margin: 0;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 0.86rem;
    line-height: 1.65;
    color: var(--text);
}

.aq-focus-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.aq-mini-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.65rem;
}

.aq-list {
    margin: 0;
    padding-left: 1.1rem;
}

.aq-list li {
    font-size: 0.86rem;
    line-height: 1.65;
    color: var(--text);
    margin-bottom: 0.45rem;
}

/* --- Generic Screening Visual Report Module --- */
.screening-visual-section {
    border-left: 4px solid #2a9d99;
}

.screening-visual-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.screening-total-card {
    position: relative;
    overflow: hidden;
}

.screening-total-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--sev-normal-border), transparent 58%);
    pointer-events: none;
}

.screening-total-card.screening-mid::before {
    background: linear-gradient(135deg, var(--sev-mild-border), transparent 58%);
}

.screening-total-card.screening-high::before {
    background: linear-gradient(135deg, var(--sev-high-border), transparent 58%);
}

.screening-score-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.8rem 0 1rem;
    position: relative;
}

.screening-score-number {
    font-size: 3rem;
    font-weight: 800;
    color: var(--sev-normal);
    line-height: 1;
}

.screening-mid .screening-score-number { color: var(--sev-mild); }
.screening-high .screening-score-number { color: var(--sev-high); }

.screening-score-number span {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-left: 0.15rem;
}

.screening-score-meta {
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.screening-score-meta strong {
    display: block;
    color: var(--text);
    font-size: 1.25rem;
    margin-top: 0.2rem;
}

.screening-gauge {
    position: relative;
    display: grid;
    grid-template-columns: 34fr 33fr 33fr;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.screening-gauge-zone.low { background: var(--sev-normal-border); }
.screening-gauge-zone.mid { background: var(--sev-mild-border); }
.screening-gauge-zone.high { background: var(--sev-high-border); }

.screening-gauge-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--sev-normal) 0%, var(--sev-mild) 55%, var(--sev-high) 100%);
    opacity: 0.85;
}

.screening-gauge-marker {
    position: absolute;
    top: -4px;
    width: 2px;
    height: 22px;
    background: var(--text);
    box-shadow: 0 0 0 2px var(--bg-secondary);
}

.screening-gauge-labels {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.72rem;
    margin-top: 0.35rem;
}

.screening-note-stack {
    display: grid;
    gap: 0.65rem;
}

.screening-note-item {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 0.75rem;
    align-items: start;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    line-height: 1.55;
}

.screening-note-item strong {
    color: var(--primary);
}

.screening-note-item span {
    color: var(--text);
}

.screening-bars {
    display: grid;
    gap: 0.75rem;
}

.screening-bar-row {
    display: grid;
    grid-template-columns: minmax(150px, 1.1fr) minmax(160px, 1.5fr) minmax(90px, 0.55fr);
    gap: 0.8rem;
    align-items: center;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.screening-bar-label strong {
    display: block;
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}

.screening-bar-label span {
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.45;
}

.screening-bar-track {
    height: 12px;
    border-radius: 999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    overflow: hidden;
}

.screening-bar-fill {
    height: 100%;
    border-radius: 999px;
}

.screening-bar-fill.low { background: var(--sev-normal); }
.screening-bar-fill.mid { background: var(--sev-mild); }
.screening-bar-fill.high { background: var(--sev-high); }

.screening-bar-value {
    text-align: right;
}

.screening-bar-value strong {
    display: block;
    color: var(--text);
    font-size: 0.9rem;
}

.screening-bar-value span {
    display: inline-block;
    margin-top: 0.2rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.screening-single-interpretation,
.screening-recommend-text {
    margin: 0;
    padding: 0.8rem 0.9rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.75;
}

@media (max-width: 768px) {
    .screening-visual-grid {
        grid-template-columns: 1fr;
    }

    .screening-bar-row {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    .screening-bar-value {
        text-align: left;
    }

    .screening-note-item {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }
}

/* --- PHQ-9 Adolescent Report Module --- */
.phq9-section {
    border-left: 4px solid #7c3aed;
}

.phq9-flag-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.phq9-flag-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.phq9-flag-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 132px;
    border-top: 3px solid rgba(124,58,237,0.25);
}

.phq9-flag-card.active {
    border-color: rgba(220,38,38,0.45);
    background: linear-gradient(135deg, rgba(220,38,38,0.08), var(--bg-secondary) 58%);
}

.phq9-flag-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
}

.phq9-flag-card strong {
    color: #7c3aed;
    font-size: 1.45rem;
    line-height: 1.2;
}

.phq9-flag-card.active strong {
    color: #dc2626;
}

.phq9-flag-desc {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.45;
}

.phq9-followup-card {
    border-left: 3px solid #7c3aed;
}

.phq9-followup-card.urgent {
    border-left-color: #dc2626;
    background: linear-gradient(135deg, rgba(220,38,38,0.07), var(--bg-secondary) 62%);
}

.phq9-refused-card.active {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245,158,11,0.07), var(--bg-secondary) 62%);
}

/* === PHQ-9 Custom Visual Section === */
.phq9-visual-section { border-left: 4px solid #6c5ce7; }

/* ----- PHQ-9 NEW LAYOUT: Header / Info Card / Two-Col Blocks ----- */
.phq9-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.phq9-section-title { margin: 0 0 0.15rem 0; font-size: 1.4rem; line-height: 1.3; }
.phq9-head-sub { margin: 0 0 0 0; font-size: 0.78rem; color: var(--text-secondary); }
.phq9-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #e0f7fa, #e8eaf6);
    border: 1px solid rgba(108,92,231,0.18);
}
.phq9-brand-logo {
    font-size: 1.4rem;
    line-height: 1;
    color: #e91e63;
}
.phq9-brand-text { display: inline-flex; flex-direction: column; line-height: 1.05; }
.phq9-brand-name { font-size: 0.78rem; font-weight: 700; color: #4338ca; letter-spacing: 0.5px; }
.phq9-brand-sub { font-size: 0.6rem; color: var(--text-secondary); letter-spacing: 1.2px; }

/* Patient info card */
.phq9-info-card {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.6rem;
    background: linear-gradient(180deg, #f8fbff 0%, #f1f5fb 100%);
    border: 1px solid rgba(108,92,231,0.15);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    margin: 0.6rem 0 0.8rem;
}
.phq9-info-col { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.phq9-info-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    border-bottom: 1px dashed rgba(0,0,0,0.06);
    padding: 0.18rem 0;
}
.phq9-info-row:last-child { border-bottom: none; }
.phq9-info-label { color: var(--text-secondary); min-width: 4em; flex-shrink: 0; font-size: 0.72rem; }
.phq9-info-val { color: var(--text); font-weight: 600; word-break: break-all; }
.phq9-info-no { font-family: var(--font-mono, "SFMono-Regular", Menlo, Consolas, monospace); font-size: 0.72rem; color: #4338ca; }

/* Total block (gauge + alerts side by side) */
.phq9-total-block {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}
.phq9-total-left, .phq9-total-right {
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
}
.phq9-block-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 0.55rem; color: var(--text); }
.phq9-block-sub { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }

/* Restyle severity marker to make it bold */
.phq9-sev-marker-label {
    font-weight: 800;
}
.phq9-sev-labels {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.25rem;
    margin-top: 0.3rem;
    font-size: 0.68rem;
}
.phq9-sev-labels > span {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
    padding: 0.25rem 0.1rem;
    border-radius: 4px;
    color: var(--text-secondary);
}
.phq9-sev-labels > span.active { background: rgba(108,92,231,0.1); color: #4338ca; font-weight: 700; }
.phq9-sev-range { font-size: 0.62rem; opacity: 0.75; }
.phq9-sev-name { font-size: 0.72rem; }

.phq9-alert-suggestion {
    margin-top: 0.55rem;
    padding: 0.55rem 0.7rem;
    background: rgba(33,150,243,0.06);
    border-left: 3px solid #2196f3;
    border-radius: 4px;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text);
}
.phq9-alert-suggestion strong { color: #1565c0; margin-right: 0.3em; }

.phq9-safety-alert {
    margin-top: 0.6rem;
    padding: 0.65rem 0.8rem;
    background: rgba(211,47,47,0.06);
    border: 1.5px dashed rgba(211,47,47,0.45);
    border-radius: 6px;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text);
}
.phq9-safety-alert-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #d32f2f;
    margin-bottom: 0.3rem;
}
.phq9-safety-alert-icon { font-size: 1.05rem; color: #d32f2f; }
.phq9-safety-alert p { margin: 0.15rem 0; }

/* Mid grid: symptom table + score ref side by side */
.phq9-mid-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 0.7rem;
    margin-bottom: 0.7rem;
}
.phq9-mid-grid .extended-card { padding: 0.7rem 0.9rem; }

.phq9-freq-legend {
    margin: 0.5rem 0 0;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--border);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Score ref table — make text dark for readability & add third column */
.phq9-sev-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.phq9-sev-table th, .phq9-sev-table td {
    padding: 0.4rem 0.5rem;
    text-align: center;
    border: 1px solid var(--border);
    color: var(--text);
}
.phq9-sev-table th { background: rgba(108,92,231,0.08); font-weight: 700; color: #4338ca; }
.phq9-sev-table td:last-child { text-align: left; padding-left: 0.7rem; }
.phq9-sev-table tr.active td { font-weight: 700; }

/* Score column: range first then severity level */
.phq9-sev-table td:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: center;
}
.phq9-sev-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.phq9-sev-dot.none { background: #4caf50; }
.phq9-sev-dot.mild { background: #d4a030; }
.phq9-sev-dot.moderate { background: #ff9500; }
.phq9-sev-dot.moderate_severe { background: #e8542e; }
.phq9-sev-dot.severe { background: #d32f2f; }
.phq9-sev-table tr.active.none td { background: rgba(76,175,80,0.12); }
.phq9-sev-table tr.active.mild td { background: rgba(212,160,48,0.12); }
.phq9-sev-table tr.active.moderate td { background: rgba(255,149,0,0.12); }
.phq9-sev-table tr.active.moderate_severe td { background: rgba(232,84,46,0.12); }
.phq9-sev-table tr.active.severe td { background: rgba(211,47,47,0.12); }

/* Symptom table: show full text */
.phq9-symptom-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; table-layout: fixed; }
.phq9-symptom-table th {
    background: rgba(108,92,231,0.08);
    color: #4338ca;
    font-weight: 700;
    padding: 0.4rem 0.5rem;
    text-align: left;
    border-bottom: 1.5px solid rgba(108,92,231,0.2);
    vertical-align: middle;
    line-height: 1.3;
}
.phq9-symptom-table th:first-child { width: 30px; text-align: center; }
.phq9-symptom-table th:nth-child(2) { width: auto; }
.phq9-symptom-table th:nth-child(3) { width: 44px; text-align: center; }
.phq9-symptom-table th:last-child { width: 90px; text-align: center; }
.phq9-symptom-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    line-height: 1.5;
    word-wrap: break-word;
}
.phq9-symptom-table td:first-child { text-align: center; color: var(--text-secondary); font-weight: 600; }
.phq9-symptom-table td:nth-child(3) { text-align: center; }
.phq9-symptom-table td:last-child { text-align: center; font-size: 0.72rem; }
.phq9-symptom-table tr.danger-row { background: rgba(211,47,47,0.06); }
.phq9-symptom-table tr.danger-row td:first-child { color: #d32f2f; }
.phq9-symptom-table tr.danger-row td:last-child { color: #d32f2f; font-weight: 700; }
.phq9-symptom-table tr.danger-row { background: rgba(211,47,47,0.06); }
.phq9-symptom-table tr.danger-row td:first-child { color: #d32f2f; }

/* Next steps list */
.phq9-next-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.phq9-next-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.45rem 0.55rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    line-height: 1.5;
}
.phq9-next-list li > div { display: flex; flex-direction: column; min-width: 0; }
.phq9-next-list li strong { color: var(--text); margin-bottom: 0.1rem; }
.phq9-next-list li span { color: var(--text-secondary); font-size: 0.75rem; }
.phq9-next-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(108,92,231,0.1);
    color: #4338ca;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    font-weight: 700;
}
.phq9-next-list li.urgent .phq9-next-icon { background: rgba(211,47,47,0.12); }
.phq9-next-list li.urgent { color: #d32f2f; font-weight: 600; }

/* Emergency box (red) vs safety response (blue) */
.phq9-emergency-box {
    background: rgba(211,47,47,0.05);
    border: 1px solid rgba(211,47,47,0.25);
    border-left: 4px solid #d32f2f;
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    margin-top: 0.5rem;
}
.phq9-emergency-title { font-size: 0.95rem; font-weight: 700; color: #d32f2f; margin: 0 0 0.4rem; }
.phq9-emergency-desc { font-size: 0.78rem; color: var(--text); margin: 0 0 0.55rem; }
.phq9-emergency-contacts {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}
.phq9-emergency-contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(0,0,0,0.06);
    min-width: 160px;
}
.phq9-emergency-phone-icon { font-size: 1rem; color: #d32f2f; }
.phq9-emergency-label { font-size: 0.7rem; color: var(--text-secondary); }
.phq9-emergency-contact strong { font-size: 1rem; color: #d32f2f; font-weight: 800; }
.phq9-emergency-hours { font-size: 0.62rem; color: var(--text-secondary); }
.phq9-emergency-note {
    margin-top: 0.6rem;
    padding: 0.5rem 0.7rem;
    background: rgba(255,193,7,0.1);
    border-left: 3px solid #ff9800;
    border-radius: 4px;
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--text);
}

/* Safe response (no suicide_risk detected) */
.phq9-safety-resp {
    background: rgba(33,150,243,0.05);
    border: 1px solid rgba(33,150,243,0.2);
    border-left: 4px solid #2196f3;
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    margin-top: 0.5rem;
}
.phq9-safety-resp h3 { font-size: 0.95rem; font-weight: 700; color: #1565c0; margin: 0 0 0.4rem; }
.phq9-safety-resp .phq9-emergency-contact {
    border-color: rgba(33,150,243,0.18);
}
.phq9-safety-resp .phq9-emergency-phone-icon { color: #1565c0; }
.phq9-safety-resp .phq9-emergency-contact strong { color: #1565c0; }

/* Signature + Disclaimer */
.phq9-sign {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 0.6rem 0;
}
.phq9-sign-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    display: block;
}
.phq9-sign-line {
    display: block;
    border-bottom: 1px solid #999;
    height: 1.4rem;
}
.phq9-disclaimer {
    margin: 0.7rem 0 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.65;
}
.phq9-disclaimer strong { color: var(--text); }

/* Responsive */
@media (max-width: 760px) {
    .phq9-head { flex-direction: column; align-items: flex-start; }
    .phq9-info-card { grid-template-columns: 1fr; }
    .phq9-total-block { grid-template-columns: 1fr; }
    .phq9-mid-grid { grid-template-columns: 1fr; }
    .phq9-sign { grid-template-columns: 1fr; }
}

/* Gauge */
.phq9-gauge-wrapper {
    position: relative;
    max-width: 280px;
    margin: 0 auto 0.5rem;
}
.phq9-gauge-svg { width: 100%; height: auto; display: block; }
.phq9-gauge-center {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.phq9-gauge-score {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    display: block;
}
.phq9-gauge-score small { font-size: 0.9rem; color: var(--text-secondary); font-weight: 500; }
.phq9-gauge-score.none { color: #4caf50; }
.phq9-gauge-score.mild { color: #d4a030; }
.phq9-gauge-score.moderate { color: #ff9500; }
.phq9-gauge-score.moderate_severe { color: #e8542e; }
.phq9-gauge-score.severe { color: #d32f2f; }
.phq9-gauge-badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    margin-top: 0.2rem;
}
.phq9-gauge-badge.none { background: #4caf50; }
.phq9-gauge-badge.mild { background: #d4a030; }
.phq9-gauge-badge.moderate { background: #ff9500; }
.phq9-gauge-badge.moderate_severe { background: #e8542e; }
.phq9-gauge-badge.severe { background: #d32f2f; }

/* Linear scale bar */
.phq9-linear-scale { margin-bottom: 0.75rem; }
.phq9-sev-bar {
    position: relative;
    display: flex;
    height: 12px;
    border-radius: 999px;
    overflow: visible;
    margin-bottom: 1.4rem;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.phq9-sev-zone { height: 100%; }
.phq9-sev-zone.none { background: rgba(76,175,80,0.3); }
.phq9-sev-zone.mild { background: rgba(212,160,48,0.3); }
.phq9-sev-zone.moderate { background: rgba(255,149,0,0.3); }
.phq9-sev-zone.moderate_severe { background: rgba(232,84,46,0.3); }
.phq9-sev-zone.severe { background: rgba(211,47,47,0.3); }
.phq9-sev-zone:first-child { border-radius: 999px 0 0 999px; }
.phq9-sev-zone:last-child { border-radius: 0 999px 999px 0; }
.phq9-sev-marker {
    position: absolute;
    top: -2px;
    width: 2px;
    height: 16px;
    background: var(--text);
    transform: translateX(-50%);
}
.phq9-sev-marker-label {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--bg-card);
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}
.phq9-sev-marker-label::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 5px;
    height: 5px;
    background: var(--text);
}
.phq9-sev-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: -0.8rem;
}
.phq9-sev-labels span.active { color: var(--text); font-weight: 700; }

/* Result alert box */
.phq9-alert {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    border: 1px solid transparent;
}
.phq9-alert.none { background: rgba(76,175,80,0.08); border-color: rgba(76,175,80,0.2); }
.phq9-alert.mild { background: rgba(212,160,48,0.08); border-color: rgba(212,160,48,0.2); }
.phq9-alert.moderate { background: rgba(255,149,0,0.08); border-color: rgba(255,149,0,0.2); }
.phq9-alert.moderate_severe { background: rgba(232,84,46,0.08); border-color: rgba(232,84,46,0.25); }
.phq9-alert.severe { background: rgba(211,47,47,0.08); border-color: rgba(211,47,47,0.25); }
.phq9-alert-icon { font-size: 1.1rem; line-height: 1.4; flex-shrink: 0; }
.phq9-alert.none .phq9-alert-icon { color: #4caf50; }
.phq9-alert.mild .phq9-alert-icon { color: #d4a030; }
.phq9-alert.moderate .phq9-alert-icon { color: #ff9500; }
.phq9-alert.moderate_severe .phq9-alert-icon { color: #e8542e; }
.phq9-alert.severe .phq9-alert-icon { color: #d32f2f; }
.phq9-alert-body { flex: 1; }
.phq9-alert-title { font-size: 0.78rem; font-weight: 700; margin: 0 0 0.15rem; }
.phq9-alert-text { font-size: 0.8rem; line-height: 1.45; margin: 0; color: var(--text); }

/* Symptom table */
.phq9-symptom-table-card { padding: 0.75rem 1rem; }
.phq9-symptom-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.phq9-symptom-table th {
    background: var(--bg-secondary);
    padding: 0.35rem 0.5rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
}
.phq9-symptom-table th:first-child { width: 28px; text-align: center; }
.phq9-symptom-table th:nth-child(3) { width: 100px; }
.phq9-symptom-table th:last-child { width: 40px; text-align: center; }
.phq9-symptom-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.phq9-symptom-table td:first-child { text-align: center; color: var(--text-secondary); font-weight: 600; }
.phq9-symptom-table td:last-child { text-align: center; }
.phq9-symptom-table tr.danger-row { background: rgba(211,47,47,0.06); }
.phq9-symptom-table tr.danger-row td:first-child { color: #d32f2f; }
.phq9-tbl-score { font-size: 0.85rem; }
.phq9-tbl-score.s0 { color: var(--text-secondary); }
.phq9-tbl-score.s1 { color: #d4a030; }
.phq9-tbl-score.s2 { color: #ff9500; }
.phq9-tbl-score.s3 { color: #d32f2f; }

/* Bottom grid: ref table + next steps */
.phq9-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.phq9-ref-card { padding: 0.75rem 1rem; }
.phq9-sev-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.phq9-sev-table th {
    background: var(--bg-secondary);
    padding: 0.3rem 0.5rem;
    text-align: center;
    font-weight: 600;
    border: 1px solid var(--border);
    font-size: 0.72rem;
}
.phq9-sev-table td { padding: 0.35rem 0.5rem; text-align: center; border: 1px solid var(--border); }
.phq9-sev-table tr.active.none td { background: rgba(76,175,80,0.12); }
.phq9-sev-table tr.active.mild td { background: rgba(212,160,48,0.12); }
.phq9-sev-table tr.active.moderate td { background: rgba(255,149,0,0.12); }
.phq9-sev-table tr.active.moderate_severe td { background: rgba(232,84,46,0.12); }
.phq9-sev-table tr.active.severe td { background: rgba(211,47,47,0.12); }
.phq9-sev-table tr.active td { font-weight: 700; }
.phq9-sev-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: 3px;
    vertical-align: middle;
}
.phq9-sev-dot.sev-none { background: #4caf50; }
.phq9-sev-dot.sev-mild { background: #d4a030; }
.phq9-sev-dot.sev-moderate { background: #ff9500; }
.phq9-sev-dot.sev-moderate_severe { background: #e8542e; }
.phq9-sev-dot.sev-severe { background: #d32f2f; }

/* Next steps */
.phq9-next-card { padding: 0.75rem 1rem; }
.phq9-next-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.phq9-next-list li {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    font-size: 0.78rem;
    line-height: 1.4;
}
.phq9-next-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(108,92,231,0.1);
    font-size: 0.85rem;
    flex-shrink: 0;
}
.phq9-next-list li.urgent .phq9-next-icon { background: rgba(211,47,47,0.12); }
.phq9-next-list li.urgent { color: #d32f2f; font-weight: 600; }

/* Extra items */
.phq9-extra-card { padding: 0.75rem 1rem; }
.phq9-extra-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.4rem;
}
.phq9-extra-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.35rem 0.45rem;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    text-align: center;
}
.phq9-extra-label { font-size: 0.65rem; color: var(--text-secondary); }
.phq9-extra-item strong { font-size: 0.85rem; color: var(--text); }
.phq9-extra-item strong.flag { color: #d32f2f; }

/* Emergency box */
.phq9-emergency-box {
    background: rgba(33,150,243,0.06);
    border: 1px solid rgba(33,150,243,0.2);
    border-left: 3px solid #2196f3;
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.9rem;
    margin-top: 0.5rem;
}
.phq9-emergency-title { font-size: 0.85rem; font-weight: 700; color: #d32f2f; margin: 0 0 0.3rem; }
.phq9-emergency-desc { font-size: 0.76rem; color: var(--text); margin: 0 0 0.5rem; }
.phq9-emergency-contacts {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.phq9-emergency-contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.7);
}
.phq9-emergency-phone-icon {
    font-size: 1rem;
    color: #e74c3c;
}
.phq9-emergency-label { font-size: 0.65rem; color: var(--text-secondary); }
.phq9-emergency-contact strong { font-size: 1rem; color: #2196f3; }
.phq9-emergency-hours { font-size: 0.58rem; color: var(--text-secondary); }

@media (max-width: 700px) {
    .phq9-bottom-grid { grid-template-columns: 1fr; }
    .phq9-gauge-score { font-size: 2rem; }
}

.phq9-dysthymia-card {
    border-left: 3px solid #6366f1;
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
}

.phq9-dysthymia-card.active {
    border-left-color: #4f46e5;
    background: linear-gradient(135deg, rgba(79,70,229,0.07), transparent 62%);
}

.phq9-followup-list {
    display: grid;
    gap: 0.55rem;
}

.phq9-followup-item {
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.86rem;
    line-height: 1.6;
}

@media (max-width: 900px) {
    .phq9-flag-grid,
    .phq9-flag-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .phq9-flag-grid,
    .phq9-flag-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* === PHQ-9 Report v2 === */
.phq9-v2 { border-left: none; position: relative; overflow: hidden; }

/* Accent strip */
.phq9-v2-accent-strip {
    height: 4px;
    margin: -0.5rem -0.75rem 0.6rem;
    border-radius: 2px;
}
.phq9-v2-accent-strip.none { background: linear-gradient(90deg, #43a047, #66bb6a); }
.phq9-v2-accent-strip.mild { background: linear-gradient(90deg, #c8a020, #d4a030); }
.phq9-v2-accent-strip.moderate { background: linear-gradient(90deg, #e68300, #ff9500); }
.phq9-v2-accent-strip.moderate_severe { background: linear-gradient(90deg, #d44530, #e8542e); }
.phq9-v2-accent-strip.severe { background: linear-gradient(90deg, #b71c1c, #d32f2f); }

/* Header */
.phq9-v2-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.6rem;
}
.phq9-v2-header-left { flex: 1; min-width: 0; }
.phq9-v2-badge-row { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.35rem; }
.phq9-v2-pill {
    display: inline-block;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}
.phq9-v2-pill.none { background: #43a047; }
.phq9-v2-pill.mild { background: #d4a030; }
.phq9-v2-pill.moderate { background: #ff9500; }
.phq9-v2-pill.moderate_severe { background: #e8542e; }
.phq9-v2-pill.severe { background: #d32f2f; }
.phq9-v2-meta-chip {
    display: inline-block;
    padding: 0.12rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #6c5ce7;
    background: rgba(108,92,231,0.08);
    border: 1px solid rgba(108,92,231,0.15);
}
.phq9-v2-title { font-size: 1.35rem; font-weight: 800; margin: 0 0 0.1rem; line-height: 1.25; color: var(--text); }
.phq9-v2-subtitle { font-size: 0.78rem; color: var(--text-secondary); margin: 0; }
.phq9-v2-header-right { flex-shrink: 0; }
.phq9-v2-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #f0e7ff, #e8eaf6);
    border: 1px solid rgba(108,92,231,0.15);
}
.phq9-v2-brand-icon { font-size: 1.2rem; color: #e91e63; line-height: 1; }
.phq9-v2-brand-text { display: inline-flex; flex-direction: column; line-height: 1.05; }
.phq9-v2-brand-name { font-size: 0.75rem; font-weight: 700; color: #4338ca; letter-spacing: 0.3px; }
.phq9-v2-brand-sub { font-size: 0.58rem; color: var(--text-secondary); letter-spacing: 1px; }

/* Patient info card */
.phq9-v2-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    background: linear-gradient(180deg, #f8fbff 0%, #f1f5fb 100%);
    border: 1px solid rgba(108,92,231,0.12);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.8rem;
    margin: 0.5rem 0 0.7rem;
}
.phq9-v2-info-col { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.phq9-v2-info-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    border-bottom: 1px dashed rgba(0,0,0,0.05);
    padding: 0.15rem 0;
}
.phq9-v2-info-row:last-child { border-bottom: none; }
.phq9-v2-info-label { color: var(--text-secondary); min-width: 4em; flex-shrink: 0; font-size: 0.7rem; }
.phq9-v2-info-val { color: var(--text); font-weight: 600; word-break: break-all; }
.phq9-v2-info-no { font-family: var(--font-mono, "SFMono-Regular", Menlo, Consolas, monospace); font-size: 0.68rem; color: #4338ca; }

/* Section titles */
.phq9-v2-sec-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0.8rem 0 0.45rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid rgba(108,92,231,0.15);
}
.phq9-v2-sec-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c5ce7, #8e7cf0);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}
.phq9-v2-sec-sub { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }

/* Total result block */
.phq9-v2-total-block {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
    margin-bottom: 0.6rem;
}
.phq9-v2-gauge-panel {
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem 0.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.phq9-v2-gauge-wrapper { position: relative; max-width: 260px; width: 100%; margin: 0 auto 0.3rem; }
.phq9-v2-gauge-svg { width: 100%; height: auto; display: block; }
.phq9-v2-gauge-dot { transition: cx 0.6s ease, cy 0.6s ease; }
.phq9-v2-gauge-center {
    position: absolute;
    top: 58%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.phq9-v2-gauge-score {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    display: block;
}
.phq9-v2-gauge-score small { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.phq9-v2-gauge-score.none { color: #43a047; }
.phq9-v2-gauge-score.mild { color: #d4a030; }
.phq9-v2-gauge-score.moderate { color: #ff9500; }
.phq9-v2-gauge-score.moderate_severe { color: #e8542e; }
.phq9-v2-gauge-score.severe { color: #d32f2f; }
.phq9-v2-gauge-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    margin-top: 0.15rem;
}
.phq9-v2-gauge-badge.none { background: #43a047; }
.phq9-v2-gauge-badge.mild { background: #d4a030; }
.phq9-v2-gauge-badge.moderate { background: #ff9500; }
.phq9-v2-gauge-badge.moderate_severe { background: #e8542e; }
.phq9-v2-gauge-badge.severe { background: #d32f2f; }

/* Linear scale */
.phq9-v2-linear-scale { width: 100%; margin-bottom: 0.5rem; }
.phq9-v2-sev-bar {
    position: relative;
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: visible;
    margin-bottom: 1.3rem;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.phq9-v2-sev-zone { height: 100%; }
.phq9-v2-sev-zone.none { background: rgba(67,160,71,0.28); }
.phq9-v2-sev-zone.mild { background: rgba(212,160,48,0.28); }
.phq9-v2-sev-zone.moderate { background: rgba(255,149,0,0.28); }
.phq9-v2-sev-zone.moderate_severe { background: rgba(232,84,46,0.28); }
.phq9-v2-sev-zone.severe { background: rgba(211,47,47,0.28); }
.phq9-v2-sev-zone:first-child { border-radius: 999px 0 0 999px; }
.phq9-v2-sev-zone:last-child { border-radius: 0 999px 999px 0; }
.phq9-v2-sev-marker {
    position: absolute;
    top: -2px;
    width: 3px;
    height: 14px;
    background: var(--text);
    border-radius: 2px;
    transform: translateX(-50%);
}
.phq9-v2-sev-marker-label {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}
.phq9-v2-sev-marker-label::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 5px;
    height: 5px;
    background: var(--text);
}
.phq9-v2-sev-labels {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.2rem;
    margin-top: -0.7rem;
    font-size: 0.65rem;
}
.phq9-v2-sev-labels > span {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
    padding: 0.2rem 0.1rem;
    border-radius: 4px;
    color: var(--text-secondary);
}
.phq9-v2-sev-labels > span.active { background: rgba(108,92,231,0.08); color: #4338ca; font-weight: 700; }
.phq9-v2-sev-range { font-size: 0.6rem; opacity: 0.75; }
.phq9-v2-sev-name { font-size: 0.68rem; }

/* Alert panel */
.phq9-v2-alert-panel {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.phq9-v2-alert {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}
.phq9-v2-alert.none { background: rgba(67,160,71,0.06); border-color: rgba(67,160,71,0.18); }
.phq9-v2-alert.mild { background: rgba(212,160,48,0.06); border-color: rgba(212,160,48,0.18); }
.phq9-v2-alert.moderate { background: rgba(255,149,0,0.06); border-color: rgba(255,149,0,0.18); }
.phq9-v2-alert.moderate_severe { background: rgba(232,84,46,0.07); border-color: rgba(232,84,46,0.22); }
.phq9-v2-alert.severe { background: rgba(211,47,47,0.07); border-color: rgba(211,47,47,0.22); }
.phq9-v2-alert-icon { font-size: 1rem; line-height: 1.4; flex-shrink: 0; }
.phq9-v2-alert.none .phq9-v2-alert-icon { color: #43a047; }
.phq9-v2-alert.mild .phq9-v2-alert-icon { color: #d4a030; }
.phq9-v2-alert.moderate .phq9-v2-alert-icon { color: #ff9500; }
.phq9-v2-alert.moderate_severe .phq9-v2-alert-icon { color: #e8542e; }
.phq9-v2-alert.severe .phq9-v2-alert-icon { color: #d32f2f; }
.phq9-v2-alert-body { flex: 1; }
.phq9-v2-alert-text { font-size: 0.78rem; line-height: 1.45; margin: 0; color: var(--text); }

/* Suggestion */
.phq9-v2-suggestion {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    font-size: 0.76rem;
    line-height: 1.5;
}
.phq9-v2-suggestion.none { background: rgba(67,160,71,0.05); border-left-color: #43a047; }
.phq9-v2-suggestion.mild { background: rgba(212,160,48,0.05); border-left-color: #d4a030; }
.phq9-v2-suggestion.moderate { background: rgba(255,149,0,0.05); border-left-color: #ff9500; }
.phq9-v2-suggestion.moderate_severe { background: rgba(232,84,46,0.05); border-left-color: #e8542e; }
.phq9-v2-suggestion.severe { background: rgba(211,47,47,0.05); border-left-color: #d32f2f; }
.phq9-v2-suggestion-label { font-weight: 700; flex-shrink: 0; color: var(--text); }
.phq9-v2-suggestion p { margin: 0; color: var(--text); }

/* Safety alert */
.phq9-v2-safety-alert {
    padding: 0.55rem 0.75rem;
    background: rgba(211,47,47,0.05);
    border: 1.5px dashed rgba(211,47,47,0.4);
    border-radius: 6px;
    font-size: 0.76rem;
    line-height: 1.55;
    color: var(--text);
}
.phq9-v2-safety-head { display: flex; align-items: center; gap: 0.3rem; color: #d32f2f; margin-bottom: 0.25rem; }
.phq9-v2-safety-icon { font-size: 1rem; color: #d32f2f; }
.phq9-v2-safety-alert p { margin: 0.12rem 0; }

/* Symptom block: bars + table */
.phq9-v2-symptom-block {
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.6rem;
}
.phq9-v2-bars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 1rem;
    margin-bottom: 0.6rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}
.phq9-v2-bar-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
}
.phq9-v2-bar-row.danger .phq9-v2-bar-label { color: #d32f2f; font-weight: 700; }
.phq9-v2-bar-label { width: 80px; flex-shrink: 0; color: var(--text-secondary); text-align: right; }
.phq9-v2-bar-track {
    flex: 1;
    height: 14px;
    background: rgba(0,0,0,0.04);
    border-radius: 999px;
    overflow: hidden;
}
.phq9-v2-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}
.phq9-v2-bar-fill.s0 { background: rgba(0,0,0,0.1); }
.phq9-v2-bar-fill.s1 { background: linear-gradient(90deg, #d4a030, #e6b53c); }
.phq9-v2-bar-fill.s2 { background: linear-gradient(90deg, #e68300, #ff9500); }
.phq9-v2-bar-fill.s3 { background: linear-gradient(90deg, #b71c1c, #d32f2f); }
.phq9-v2-bar-score { font-weight: 700; font-size: 0.7rem; flex-shrink: 0; min-width: 28px; text-align: right; }
.phq9-v2-bar-score.s0 { color: var(--text-secondary); }
.phq9-v2-bar-score.s1 { color: #d4a030; }
.phq9-v2-bar-score.s2 { color: #ff9500; }
.phq9-v2-bar-score.s3 { color: #d32f2f; }

/* Symptom table */
.phq9-v2-symptom-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; table-layout: fixed; }
.phq9-v2-symptom-table th {
    background: rgba(108,92,231,0.06);
    color: #4338ca;
    font-weight: 700;
    padding: 0.35rem 0.5rem;
    text-align: left;
    border-bottom: 1.5px solid rgba(108,92,231,0.18);
    font-size: 0.7rem;
}
.phq9-v2-symptom-table th:first-child { width: 28px; text-align: center; }
.phq9-v2-symptom-table th:nth-child(3) { width: 40px; text-align: center; }
.phq9-v2-symptom-table th:last-child { width: 90px; text-align: center; }
.phq9-v2-symptom-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    line-height: 1.45;
    word-wrap: break-word;
}
.phq9-v2-symptom-table td:first-child { text-align: center; color: var(--text-secondary); font-weight: 600; }
.phq9-v2-symptom-table td:nth-child(3) { text-align: center; }
.phq9-v2-symptom-table td:last-child { text-align: center; font-size: 0.7rem; }
.phq9-v2-symptom-table tr.danger-row { background: rgba(211,47,47,0.05); }
.phq9-v2-symptom-table tr.danger-row td:first-child { color: #d32f2f; }
.phq9-v2-tbl-score { font-size: 0.85rem; }
.phq9-v2-tbl-score.s0 { color: var(--text-secondary); }
.phq9-v2-tbl-score.s1 { color: #d4a030; }
.phq9-v2-tbl-score.s2 { color: #ff9500; }
.phq9-v2-tbl-score.s3 { color: #d32f2f; }
.phq9-v2-freq-legend {
    margin: 0.4rem 0 0;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--border);
    font-size: 0.68rem;
    color: var(--text-secondary);
}

/* Score reference cards */
.phq9-v2-ref-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
    margin-bottom: 0.6rem;
}
.phq9-v2-ref-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.5rem 0.4rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.5);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.phq9-v2-ref-card.active { transform: translateY(-2px); box-shadow: 0 3px 12px rgba(0,0,0,0.08); }
.phq9-v2-ref-card.none.active { border-color: #43a047; background: rgba(67,160,71,0.06); }
.phq9-v2-ref-card.mild.active { border-color: #d4a030; background: rgba(212,160,48,0.06); }
.phq9-v2-ref-card.moderate.active { border-color: #ff9500; background: rgba(255,149,0,0.06); }
.phq9-v2-ref-card.moderate_severe.active { border-color: #e8542e; background: rgba(232,84,46,0.06); }
.phq9-v2-ref-card.severe.active { border-color: #d32f2f; background: rgba(211,47,47,0.06); }
.phq9-v2-ref-range { font-size: 0.65rem; color: var(--text-secondary); font-weight: 600; }
.phq9-v2-ref-level { font-size: 0.82rem; font-weight: 700; }
.phq9-v2-ref-card.none .phq9-v2-ref-level { color: #43a047; }
.phq9-v2-ref-card.mild .phq9-v2-ref-level { color: #d4a030; }
.phq9-v2-ref-card.moderate .phq9-v2-ref-level { color: #ff9500; }
.phq9-v2-ref-card.moderate_severe .phq9-v2-ref-level { color: #e8542e; }
.phq9-v2-ref-card.severe .phq9-v2-ref-level { color: #d32f2f; }
.phq9-v2-ref-desc { font-size: 0.62rem; color: var(--text-secondary); line-height: 1.3; }
.phq9-v2-ref-action { font-size: 0.6rem; color: var(--text); font-weight: 600; margin-top: 0.1rem; }

/* Clinical analysis */
.phq9-v2-clinical {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}
.phq9-v2-clinical-sub, .phq9-v2-clinical-flags {
    background: rgba(255,255,255,0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
}
.phq9-v2-clinical-sub-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.4rem;
}
.phq9-v2-clinical-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.35rem;
}
.phq9-v2-clinical-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--border);
}
.phq9-v2-clinical-item.flag-red { background: rgba(211,47,47,0.05); border-color: rgba(211,47,47,0.2); }
.phq9-v2-clinical-item.flag-amber { background: rgba(245,158,11,0.05); border-color: rgba(245,158,11,0.2); }
.phq9-v2-clinical-label { font-size: 0.65rem; color: var(--text-secondary); font-weight: 600; }
.phq9-v2-clinical-val { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.phq9-v2-clinical-item.flag-red .phq9-v2-clinical-val { color: #d32f2f; }
.phq9-v2-clinical-item.flag-amber .phq9-v2-clinical-val { color: #f59e0b; }
.phq9-v2-clinical-note { font-size: 0.6rem; color: var(--text-secondary); line-height: 1.3; }

/* Flag chips */
.phq9-v2-flag-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.phq9-v2-flag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    background: rgba(0,0,0,0.03);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.phq9-v2-flag-chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #bbb;
    flex-shrink: 0;
}
.phq9-v2-flag-chip.active {
    background: rgba(220,38,38,0.07);
    border-color: rgba(220,38,38,0.3);
    color: #dc2626;
    font-weight: 600;
}
.phq9-v2-flag-chip.active .phq9-v2-flag-chip-dot { background: #dc2626; }
.phq9-v2-flag-chip-status { font-weight: 700; margin-left: auto; }

/* Clinical notes */
.phq9-v2-clinical-notes { margin-top: 0.45rem; display: flex; flex-direction: column; gap: 0.25rem; }
.phq9-v2-clinical-note-item {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text);
}
.phq9-v2-note-bullet {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #6c5ce7;
    flex-shrink: 0;
    margin-top: 0.4rem;
}

/* Next steps grid */
.phq9-v2-next-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.phq9-v2-next-card {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    line-height: 1.4;
}
.phq9-v2-next-card.urgent { border-color: rgba(211,47,47,0.25); background: rgba(211,47,47,0.04); }
.phq9-v2-next-card > div { display: flex; flex-direction: column; min-width: 0; }
.phq9-v2-next-card strong { color: var(--text); margin-bottom: 0.05rem; }
.phq9-v2-next-card span { color: var(--text-secondary); font-size: 0.72rem; }
.phq9-v2-next-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(108,92,231,0.08);
    color: #6c5ce7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}
.phq9-v2-next-card.urgent .phq9-v2-next-icon { background: rgba(211,47,47,0.1); color: #d32f2f; }

/* Emergency */
.phq9-v2-emergency {
    background: rgba(211,47,47,0.04);
    border: 1px solid rgba(211,47,47,0.2);
    border-left: 4px solid #d32f2f;
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.6rem;
}
.phq9-v2-emergency-safe {
    background: rgba(33,150,243,0.04);
    border: 1px solid rgba(33,150,243,0.18);
    border-left: 4px solid #2196f3;
}
.phq9-v2-emergency-desc { font-size: 0.76rem; color: var(--text); margin: 0 0 0.45rem; }
.phq9-v2-emergency-contacts { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.phq9-v2-emergency-contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(0,0,0,0.05);
    min-width: 140px;
}
.phq9-v2-emergency-icon { font-size: 0.95rem; color: #d32f2f; }
.phq9-v2-emergency-safe .phq9-v2-emergency-icon { color: #1565c0; }
.phq9-v2-emergency-label { font-size: 0.66rem; color: var(--text-secondary); }
.phq9-v2-emergency-contact strong { font-size: 0.95rem; color: #d32f2f; font-weight: 800; }
.phq9-v2-emergency-safe .phq9-v2-emergency-contact strong { color: #1565c0; }
.phq9-v2-emergency-hours { font-size: 0.58rem; color: var(--text-secondary); }
.phq9-v2-emergency-note {
    margin-top: 0.45rem;
    padding: 0.4rem 0.6rem;
    background: rgba(255,193,7,0.08);
    border-left: 3px solid #ff9800;
    border-radius: 4px;
    font-size: 0.74rem;
    line-height: 1.5;
    color: var(--text);
}

/* Signature + disclaimer */
.phq9-v2-sign {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 0.8rem;
    padding: 0.4rem 0;
}
.phq9-v2-sign-col { display: flex; flex-direction: column; }
.phq9-v2-sign-label { font-size: 0.68rem; color: var(--text-secondary); margin-bottom: 0.15rem; }
.phq9-v2-sign-line { display: block; border-bottom: 1px solid #999; height: 1.3rem; }
.phq9-v2-disclaimer {
    margin: 0.5rem 0 0;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.6;
}
.phq9-v2-disclaimer strong { color: var(--text); }

/* Responsive */
@media (max-width: 760px) {
    .phq9-v2-header { flex-direction: column; align-items: flex-start; }
    .phq9-v2-info { grid-template-columns: 1fr; }
    .phq9-v2-total-block { grid-template-columns: 1fr; }
    .phq9-v2-bars { grid-template-columns: 1fr; }
    .phq9-v2-ref-grid { grid-template-columns: repeat(2, 1fr); }
    .phq9-v2-clinical { grid-template-columns: 1fr; }
    .phq9-v2-sign { grid-template-columns: 1fr; }
    .phq9-v2-gauge-score { font-size: 1.8rem; }
}
@media (max-width: 480px) {
    .phq9-v2-ref-grid { grid-template-columns: 1fr; }
    .phq9-v2-emergency-contact { min-width: 100%; }
}

/* Print */
@media print {
    .phq9-v2-accent-strip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .phq9-v2-gauge-panel, .phq9-v2-symptom-block, .phq9-v2-clinical-sub, .phq9-v2-clinical-flags,
    .phq9-v2-next-card, .phq9-v2-ref-card { background: #fff !important; border: 1px solid #ddd !important; }
    .phq9-v2-ref-card.active { box-shadow: none; border-width: 2px !important; }
    .phq9-v2-bar-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .phq9-v2-sev-zone { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .phq9-v2-pill, .phq9-v2-gauge-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* --- Y-BOCS Report Module --- */
.ybocs-section {
    border-left: 4px solid #d97706;
}

.yb-score-card {
    position: relative;
    overflow: hidden;
}

.yb-score-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(217,119,6,0.08), transparent 55%);
    pointer-events: none;
}

.yb-level-extreme::before {
    background: linear-gradient(135deg, rgba(224,62,62,0.14), transparent 55%);
}

.yb-level-severe::before {
    background: linear-gradient(135deg, rgba(220,38,38,0.12), transparent 55%);
}

.yb-level-moderate::before {
    background: linear-gradient(135deg, rgba(245,158,11,0.14), transparent 55%);
}

.yb-level-mild::before {
    background: linear-gradient(135deg, rgba(217,119,6,0.10), transparent 55%);
}

.yb-level-sub::before {
    background: linear-gradient(135deg, rgba(15,155,108,0.10), transparent 55%);
}

.yb-level-extreme .aq-score-number { color: #b91c1c; }
.yb-level-severe .aq-score-number { color: #dc2626; }
.yb-level-moderate .aq-score-number { color: #d97706; }
.yb-level-mild .aq-score-number { color: #f59e0b; }
.yb-level-sub .aq-score-number { color: #0f9b6c; }

.yb-subscales-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

.yb-subscale-card {
    text-align: center;
    padding: 1.2rem 1rem;
}

.yb-subscale-score {
    margin-top: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.yb-subscale-number {
    font-size: 2rem;
    font-weight: 800;
    color: #d97706;
    line-height: 1;
}

.yb-subscale-number small {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.yb-subscale-level {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.yb-insight-card {
    border-left: 3px solid #8b5cf6;
}

.yb-insight-card .yb-subscale-number {
    color: #8b5cf6;
}

/* Y-BOCS Primary Symptoms Card */
.yb-primary-card {
    margin-top: 1rem;
    border-left: 4px solid #d97706;
}
.yb-primary-group {
    margin-bottom: 0.8rem;
}
.yb-primary-group:last-child {
    margin-bottom: 0;
}
.yb-primary-group-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}
.yb-primary-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.yb-primary-tag {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    border: 1px solid;
    line-height: 1.4;
}
.yb-primary-tag.obs {
    color: #1e40af;
    background: rgba(30, 64, 175, 0.08);
    border-color: rgba(30, 64, 175, 0.15);
}
.yb-primary-tag.comp {
    color: #92400e;
    background: rgba(217, 119, 6, 0.08);
    border-color: rgba(217, 119, 6, 0.15);
}

.yb-symptom-card {
    margin-top: 1rem;
}

.yb-symptom-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin: 1rem 0;
}

.yb-symptom-stat {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    padding: 0.85rem 0.95rem;
    position: relative;
    overflow: hidden;
}

.yb-symptom-stat::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.10;
    pointer-events: none;
}

.yb-symptom-stat.current::before { background: #d97706; }
.yb-symptom-stat.past::before { background: #2563eb; }
.yb-symptom-stat.both::before { background: #dc2626; }
.yb-symptom-stat.category::before { background: #8b5cf6; }

.yb-stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.yb-symptom-stat strong {
    font-size: 2rem;
    line-height: 1;
    color: var(--primary);
    font-weight: 800;
}

.yb-stat-total {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-left: 0.2rem;
}

.yb-category-notes {
    display: grid;
    gap: 0.55rem;
    margin: 0.9rem 0 1rem;
}

.yb-category-note {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0.75rem;
    align-items: start;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.86rem;
    line-height: 1.65;
}

.yb-note-title {
    color: var(--primary);
    font-weight: 700;
}

.yb-symptom-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
}

.yb-symptom-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.86rem;
}

.yb-symptom-table th {
    background: #fff7ed;
    color: #7c2d12;
    font-weight: 800;
    text-align: center;
    padding: 0.7rem 0.55rem;
    border-bottom: 1px solid #fed7aa;
    white-space: nowrap;
}

.yb-symptom-table th:first-child {
    text-align: left;
    width: 42%;
    padding-left: 0.9rem;
}

.yb-symptom-table th small {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.68rem;
    color: #9a3412;
    font-weight: 600;
}

.yb-symptom-table td {
    padding: 0.7rem 0.55rem;
    border-bottom: 1px solid var(--border-light);
    text-align: center;
    vertical-align: middle;
}

.yb-symptom-table tbody tr:nth-child(even) {
    background: rgba(217,119,6,0.035);
}

.yb-symptom-table tbody tr:hover {
    background: rgba(217,119,6,0.075);
}

.yb-category-name {
    text-align: left !important;
    color: var(--text);
    font-weight: 700;
    padding-left: 0.9rem !important;
    word-break: keep-all;
}

.yb-count-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 1.55rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.yb-count-pill.current {
    color: #92400e;
    background: #fef3c7;
}

.yb-count-pill.past {
    color: #1d4ed8;
    background: #dbeafe;
}

.yb-count-pill.both {
    color: #b91c1c;
    background: #fee2e2;
}

.yb-muted-count,
.yb-total-count {
    color: var(--text-secondary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .yb-subscales-grid {
        grid-template-columns: 1fr;
    }
    .yb-symptom-summary {
        grid-template-columns: 1fr 1fr;
    }
    .yb-category-note {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
    .yb-symptom-table {
        min-width: 760px;
    }
}

/* Reliability Table */
.reliability-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.reliability-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reliability-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.reliability-table tr:last-child td {
    border-bottom: none;
}

.reliability-table .row-elevated {
    background: rgba(217, 115, 13, 0.06);
}

.reliability-table .row-elevated:hover td {
    background: rgba(217, 115, 13, 0.1);
}

.mini-t {
    font-weight: 600;
    color: var(--text);
}

.mini-t.t-elevated {
    color: var(--sev-moderate, #d9730d);
}

.alpha-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono, monospace);
}

.alpha-good {
    background: rgba(15, 155, 108, 0.12);
    color: #0f9b6c;
}

.alpha-ok {
    background: rgba(217, 115, 13, 0.12);
    color: #d9730d;
}

.alpha-low {
    background: rgba(224, 62, 62, 0.12);
    color: #e03e3e;
}

/* Profile Match Card (clinic view) */
.profile-match-card {
    border-left: 3px solid #1D9E75;
}

/* 【简化】紧凑版卡片内边距 */
.profile-match-card .extended-card-title,
.profile-match-card .extended-card-desc,
.profile-match-card .pm-conclusion {
    margin-bottom: 0.4rem;
}

.profile-match-card .pm-rank-list {
    margin-bottom: 0.5rem;
}

/* Candidate rank list (clickable) */
.pm-rank-list {
    list-style: none;
    margin: 0.5rem 0 0.75rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.pm-rank-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border, #e2e2e2);
    border-radius: var(--border-radius-md, 8px);
    background: var(--bg-card, #fff);
    color: var(--text, #222);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
    user-select: none;
}

.pm-rank-item:hover {
    border-color: #1D9E75;
    background: rgba(29, 158, 117, 0.04);
}

.pm-rank-item:focus-visible {
    outline: 2px solid #1D9E75;
    outline-offset: 2px;
}

.pm-rank-item.active {
    border-color: #1D9E75;
    background: rgba(29, 158, 117, 0.1);
    box-shadow: inset 3px 0 0 #1D9E75;
}

.pm-rank-num {
    font-weight: 700;
    font-size: 0.78rem;
    color: #1D9E75;
    font-family: var(--font-mono, monospace);
    min-width: 1.6rem;
}

.pm-rank-name {
    flex: 1;
    font-weight: 500;
}

.pm-direction-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(29, 158, 117, 0.15);
    color: #1D9E75;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 0.3rem;
}

.pm-exclusive-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(217, 115, 13, 0.15);
    color: #D9730D;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    margin-right: 0.3rem;
}

.pm-rank-diff {
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    font-family: var(--font-mono, monospace);
}

.pm-rank-item.active .pm-rank-diff {
    color: #0F6E56;
    font-weight: 500;
}

/* Radar section with navigation */
.pm-radar-section {
    margin: 0.5rem 0 1rem;
}

.pm-radar-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.pm-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border, #e2e2e2);
    border-radius: 50%;
    background: var(--bg-card, #fff);
    color: var(--text-secondary, #666);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
    padding: 0;
}

.pm-nav-btn:hover {
    border-color: #1D9E75;
    color: #1D9E75;
    background: rgba(29, 158, 117, 0.06);
}

.pm-nav-btn:focus-visible {
    outline: 2px solid #1D9E75;
    outline-offset: 2px;
}

.pm-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pm-nav-indicator {
    font-size: 0.82rem;
    color: var(--text-secondary, #666);
    font-family: var(--font-mono, monospace);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.pm-nav-pos {
    font-weight: 600;
    color: #1D9E75;
}

.pm-nav-sep {
    opacity: 0.5;
}

.pm-nav-group {
    font-family: var(--font-body, inherit);
    font-weight: 500;
    color: var(--text, #222);
    margin-left: 0.2rem;
}

.pm-conclusion {
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0.75rem 0 0.5rem;
    padding: 0.6rem 0.9rem;
    background: rgba(29, 158, 117, 0.06);
    border-radius: var(--border-radius-md, 8px);
    color: var(--text);
}

.pm-conclusion-hint {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    font-weight: 400;
}

/* 【新增】剖面匹配置信度指标网格 */
.pm-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: linear-gradient(135deg, rgba(29, 158, 117, 0.03) 0%, rgba(0, 117, 222, 0.03) 100%);
    border-radius: var(--border-radius-md, 8px);
    border: 1px solid rgba(29, 158, 117, 0.1);
}

.pm-metric-item {
    text-align: center;
    padding: 0.5rem;
    background: white;
    border-radius: var(--border-radius-sm, 6px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pm-metric-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.pm-metric-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1D9E75;
    margin-bottom: 0.25rem;
    font-family: var(--font-mono, monospace);
}

.pm-metric-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text, #222);
    margin-bottom: 0.15rem;
}

.pm-metric-desc {
    font-size: 0.7rem;
    color: var(--text-muted, #888);
    line-height: 1.3;
}

/* 效应量颜色 */
.effect-large {
    color: #dc2626;
    font-weight: 700;
}

.effect-medium {
    color: #f59e0b;
    font-weight: 600;
}

.effect-small {
    color: #10b981;
    font-weight: 500;
}

.pm-radar-wrapper {
    position: relative;
    width: 100%;
    height: 320px;
    margin: 0;
}

/* 【简化】紧凑版雷达图 */
.profile-match-card .pm-radar-wrapper {
    height: 260px;
}

.pm-match-points {
    margin-top: 0.75rem;
}

/* 【简化】紧凑版匹配点区域 */
.profile-match-card .pm-match-points {
    margin-top: 0.5rem;
}

.pm-section-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    margin: 0 0 0.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.pm-section-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted, #888);
}

.pm-match-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* 【简化】紧凑版匹配点列表 */
.pm-match-list-compact {
    gap: 0.35rem;
}

.pm-match-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0,0,0,0.02);
    border-radius: var(--border-radius-md, 8px);
    font-size: 0.85rem;
    flex-wrap: wrap;
}

/* 【简化】紧凑版匹配项 */
.pm-match-list-compact .pm-match-item {
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
}

.pm-match-scale {
    font-weight: 500;
    color: var(--text);
}

.pm-match-t {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    font-family: var(--font-mono, monospace);
}

.pm-match-symbol {
    color: #1D9E75;
    font-weight: 600;
    font-size: 1rem;
}

.pm-match-group {
    font-weight: 500;
    color: #993C1D;
}

.pm-match-detail {
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    margin-left: auto;
}

.pm-match-badge {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(29, 158, 117, 0.15);
    color: #1D9E75;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 4px;
}

.pm-direction-hint {
    margin-top: 0.75rem;
    padding: 0.6rem 0.9rem;
    font-size: 0.82rem;
    color: var(--text);
    background: rgba(29, 158, 117, 0.08);
    border-left: 3px solid #1D9E75;
    border-radius: 4px;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pm-direction-hint .hint-icon {
    font-size: 1rem;
}

.pm-match-empty .pm-empty-hint {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
    padding: 0.5rem 0.75rem;
    background: rgba(0,0,0,0.02);
    border-radius: var(--border-radius-md, 8px);
    margin: 0;
    line-height: 1.5;
}

.pm-disclaimer {
    margin-top: 1rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    background: rgba(239, 159, 39, 0.08);
    border-left: 3px solid #EF9F27;
    border-radius: 4px;
    line-height: 1.65;
}

.pm-disclaimer strong {
    color: #C97E15;
    font-weight: 600;
}

.pm-disclaimer u {
    text-decoration: underline;
    text-decoration-color: #EF9F27;
    text-underline-offset: 2px;
}

html[data-theme="dark"] .pm-conclusion {
    background: rgba(93, 202, 165, 0.08);
}

html[data-theme="dark"] .pm-match-item,
html[data-theme="dark"] .pm-match-empty .pm-empty-hint {
    background: rgba(255,255,255,0.04);
}

html[data-theme="dark"] .pm-match-group {
    color: #F0997B;
}

html[data-theme="dark"] .pm-rank-item {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.12);
}

html[data-theme="dark"] .pm-rank-item:hover {
    background: rgba(93, 202, 165, 0.08);
}

html[data-theme="dark"] .pm-rank-item.active {
    background: rgba(93, 202, 165, 0.14);
    border-color: #1D9E75;
    box-shadow: inset 3px 0 0 #1D9E75;
}

html[data-theme="dark"] .pm-rank-item.active .pm-rank-diff {
    color: #5DCAA5;
}

html[data-theme="dark"] .pm-nav-btn {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.7);
}

html[data-theme="dark"] .pm-nav-btn:hover {
    border-color: #1D9E75;
    color: #5DCAA5;
    background: rgba(93, 202, 165, 0.08);
}

html[data-theme="dark"] .pm-nav-group {
    color: rgba(255,255,255,0.9);
}

html[data-theme="dark"] .pm-disclaimer strong {
    color: #F0B95C;
}

html[data-theme="dark"] .pm-disclaimer {
    background: rgba(239, 159, 39, 0.12);
    color: rgba(255,255,255,0.6);
}

/* Print: fix to first candidate, hide navigation, compact layout */
@media print {
    .pm-nav-btn {
        display: none !important;
    }
    .pm-rank-item {
        cursor: default;
        padding: 1.2mm 2mm !important;
        font-size: 7.5pt !important;
    }
    .pm-rank-item.active {
        background: transparent;
        box-shadow: none;
        border-color: var(--border, #ccc);
    }
    .pm-rank-item.active .pm-rank-num,
    .pm-rank-item.active .pm-rank-diff {
        color: var(--text, #000);
        font-weight: 400;
    }
    .pm-rank-item.active .pm-rank-num {
        font-weight: 700;
    }
    /* 雷达图打印高度压缩，确保整张卡片能塞进一页 */
    .pm-radar-wrapper {
        height: 200px !important;
        margin: 1.5mm 0 !important;
    }
    .pm-radar-wrapper .chart-img-fallback {
        max-height: 195px !important;
    }
    /* 压缩剖面匹配卡片其他元素 */
    .pm-conclusion {
        font-size: 8pt !important;
        margin: 1.5mm 0 !important;
        padding: 1.5mm 2.5mm !important;
    }
    .pm-conclusion-hint {
        font-size: 6.5pt !important;
        margin-bottom: 1mm !important;
    }
    .pm-match-points {
        margin-top: 1.5mm !important;
    }
    .pm-section-title {
        font-size: 7.5pt !important;
        margin-bottom: 1mm !important;
    }
    .pm-match-item {
        padding: 1mm 1.5mm !important;
        font-size: 7pt !important;
    }
    .pm-disclaimer {
        font-size: 6.5pt !important;
        line-height: 1.4 !important;
        padding: 1.5mm 2mm !important;
        margin-top: 1.5mm !important;
    }
    /* 筛查风险卡片轻微压缩 */
    .screening-risk-card {
        padding: 2.5mm 3mm !important;
    }
    .risk-main-grid {
        gap: 2.5mm !important;
    }
}

@media (max-width: 640px) {
    .pm-radar-wrapper {
        height: 260px;
    }
    .pm-match-detail {
        margin-left: 0;
        width: 100%;
    }
}

/* Clinical Profile Comparison */
.clinical-comparison-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.clinical-comparison-row:last-of-type {
    border-bottom: none;
}

.cc-scale-label {
    flex-shrink: 0;
    width: 160px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cc-scale-label strong {
    font-size: 0.85rem;
    color: var(--text);
}

.cc-child-t {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.cc-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cc-bar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cc-group-name {
    width: 130px;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}

.cc-bar-track {
    flex: 1;
    height: 20px;
    background: var(--border);
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
}

.cc-bar {
    height: 9px;
    border-radius: 2px;
    transition: width 0.4s ease;
    min-width: 2px;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
    /* Ensure bars are visible in print by using display block */
    display: block;
}

.cc-bar-clinical {
    background: #888 !important;
}

.cc-bar-child {
    background: #0075de !important;
}

.cc-bar-value {
    width: 36px;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    font-family: var(--font-mono, monospace);
}

.cc-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.cc-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.cc-legend-color {
    width: 16px;
    height: 8px;
    border-radius: 2px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.cc-legend-clinical {
    background: #888;
}

.cc-legend-child {
    background: #0075de;
}

/* Base Rates */
.base-rate-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.base-rate-row:last-of-type {
    border-bottom: none;
}

.br-scale-label {
    flex-shrink: 0;
    width: 180px;
    font-size: 0.8rem;
    color: var(--text);
}

.br-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.br-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 500;
    font-family: var(--font-mono, monospace);
}

.br-high {
    background: rgba(224, 62, 62, 0.1);
    color: #e03e3e;
}

.br-medium {
    background: rgba(217, 115, 13, 0.1);
    color: #d9730d;
}

.br-low {
    background: rgba(15, 155, 108, 0.1);
    color: #0f9b6c;
}

/* Table wrapper for horizontal scroll on mobile */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Dark theme overrides for extended section */
[data-theme="dark"] .alpha-good {
    background: rgba(15, 155, 108, 0.2);
}

[data-theme="dark"] .alpha-ok {
    background: rgba(217, 115, 13, 0.2);
}

[data-theme="dark"] .alpha-low {
    background: rgba(224, 62, 62, 0.2);
}

[data-theme="dark"] .br-high {
    background: rgba(224, 62, 62, 0.18);
}

[data-theme="dark"] .br-medium {
    background: rgba(217, 115, 13, 0.18);
}

[data-theme="dark"] .br-low {
    background: rgba(15, 155, 108, 0.18);
}

[data-theme="dark"] .reliability-table .row-elevated {
    background: rgba(217, 115, 13, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .clinical-comparison-row {
        flex-direction: column;
    }

    .cc-scale-label {
        width: 100%;
        flex-direction: row;
        gap: 0.5rem;
    }

    .cc-group-name {
        width: 100px;
    }

    .br-scale-label {
        width: 100%;
    }
}

/* --- Screening Risk Assessment (Layer 1) --- */
.screening-risk-card {
    border-left: 4px solid var(--accent);
}

.screening-risk-card.risk-positive {
    border-left-color: #e03e3e;
    background: linear-gradient(135deg, rgba(224,62,62,0.04) 0%, var(--bg-secondary) 100%);
}

.screening-risk-card.risk-negative {
    border-left-color: #0f9b6c;
    background: linear-gradient(135deg, rgba(15,155,108,0.04) 0%, var(--bg-secondary) 100%);
}

.risk-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.risk-badge-pos {
    background: rgba(224,62,62,0.15);
    color: #e03e3e;
}

.risk-badge-neg {
    background: rgba(15,155,108,0.15);
    color: #0f9b6c;
}

.risk-main-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
    align-items: start;
}

.risk-interpretation-block {
    text-align: center;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.risk-lr-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.lr-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lr-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.screening-risk-card.risk-positive .lr-value {
    color: #e03e3e;
}

.lr-unit {
    font-size: 1rem;
    color: var(--text-secondary);
}

.risk-interp-text {
    font-size: 0.85rem;
    color: var(--text);
    margin: 0.5rem 0;
    font-weight: 500;
    line-height: 1.5;
}

.risk-manual-quote {
    font-size: 0.72rem;
    color: var(--text-tertiary, var(--text-secondary));
    font-style: italic;
    margin-top: 0.5rem;
    line-height: 1.5;
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
}

.risk-metrics-block {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.risk-metric-row {
    display: grid;
    grid-template-columns: 80px 1fr 50px;
    grid-template-rows: auto auto;
    gap: 0.15rem 0.5rem;
    align-items: center;
}

.risk-metric-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    grid-row: 1 / 3;
}

.risk-metric-bar-track {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    grid-column: 2;
}

.risk-metric-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.risk-bar-sens { background: #378ADD; }
.risk-bar-spec { background: #0f9b6c; }
.risk-bar-acc { background: #534AB7; }

.risk-metric-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    text-align: right;
    grid-column: 3;
    grid-row: 1 / 3;
    font-family: var(--font-mono, monospace);
}

.risk-metric-desc {
    font-size: 0.68rem;
    color: var(--text-secondary);
    grid-column: 2;
}




/* --- Collapsed technical reference --- */
.extended-card-collapsed {
    background: var(--bg-secondary);
    opacity: 0.85;
}

/* --- Dark mode for new components --- */
[data-theme="dark"] .risk-interpretation-block {
    background: rgba(255,255,255,0.03);
}

[data-theme="dark"] .risk-manual-quote {
    border-top-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .screening-risk-card.risk-positive {
    background: linear-gradient(135deg, rgba(224,62,62,0.08) 0%, rgba(255,255,255,0.02) 100%);
}

[data-theme="dark"] .screening-risk-card.risk-negative {
    background: linear-gradient(135deg, rgba(15,155,108,0.08) 0%, rgba(255,255,255,0.02) 100%);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .risk-main-grid {
        grid-template-columns: 1fr;
    }
}

/* --- AI Report Content (markdown, rendered inside .report-section) --- */
.ai-content {
    line-height: 1.9;
    color: var(--text);
    font-size: 0.95rem;
    background: var(--accent-bg);
    border: 1px solid rgba(0,117,222,0.1);
    border-radius: var(--radius);
    padding: 2rem 2.2rem;
    box-shadow: var(--shadow);
}

/* ---- Heading hierarchy with left accent bar ---- */
.ai-content h1,
.ai-content h2 {
    font-weight: 700;
    color: var(--primary);
    margin: 2rem 0 1rem;
    padding: 0.5rem 0 0.5rem 1rem;
    border-left: 3px solid var(--accent);
    border-bottom: none;
    background: linear-gradient(90deg, var(--accent-bg) 0%, transparent 100%);
    border-radius: 0 6px 6px 0;
}

.ai-content h1 { font-size: 1.25rem; }
.ai-content h2 { font-size: 1.1rem; }

.ai-content h1:first-child,
.ai-content h2:first-child {
    margin-top: 0;
}

.ai-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
    margin: 1.4rem 0 0.6rem;
    padding-left: 0.3rem;
}

.ai-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 1.2rem 0 0.4rem;
}

/* ---- Paragraph ---- */
.ai-content p {
    margin-bottom: 0.9rem;
    text-align: justify;
}

/* ---- Bold & emphasis ---- */
.ai-content strong {
    color: var(--primary);
    font-weight: 600;
}

.ai-content em {
    color: var(--accent);
    font-style: normal;
}

/* ---- Lists with styled markers ---- */
.ai-content ul, .ai-content ol {
    margin: 0.6rem 0 1.2rem;
    padding-left: 1.5rem;
}

.ai-content ul > li::marker {
    color: var(--accent);
}

.ai-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.2rem;
}

/* ---- Tables ---- */
.ai-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.2rem 0;
    font-size: 0.9rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.ai-content th {
    background: var(--accent);
    color: white;
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.88rem;
    letter-spacing: 0.3px;
}

.ai-content td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--card-bg);
}

.ai-content tr:last-child td {
    border-bottom: none;
}

.ai-content tr:nth-child(even) td {
    background: var(--accent-bg);
}

.ai-content tr:hover td {
    background: var(--accent-bg);
}

/* ---- Blockquote (important notes) ---- */
.ai-content blockquote {
    margin: 1.2rem 0;
    padding: 1rem 1.2rem;
    background: var(--accent-bg);
    border-left: 3px solid var(--accent);
    color: var(--accent-dark);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.93rem;
}

.ai-content blockquote p {
    margin-bottom: 0.4rem;
}

/* ---- Code ---- */
.ai-content code {
    background: var(--accent-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--accent);
}

/* ---- Divider ---- */
.ai-content hr {
    border: none;
    border-top: 1px solid rgba(0,117,222,0.12);
    margin: 1.8rem 0;
}

/* AI Error */
.ai-error-card {
    background: var(--sev-high-bg);
    border: 1px solid var(--sev-high-border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
}

.ai-error-icon {
    font-size: 2rem;
    color: var(--danger);
    margin-bottom: 0.5rem;
}

.ai-error-card h4 {
    color: var(--danger-dark);
    font-size: 1rem;
    margin-bottom: 0.6rem;
}

.ai-error-card p {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.4rem;
}

.ai-error-hint {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--sev-high-border);
}

.ai-error-hint ol {
    margin: 0.5rem 0 0.8rem 1.5rem;
    font-size: 0.88rem;
    line-height: 1.7;
}

.ai-error-hint code {
    background: var(--danger-bg);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.85em;
    color: var(--danger-dark);
}

/* Print: hide AI interaction elements but show content */
@media print {
    .ai-placeholder, .ai-loading, .ai-generate-btn, .ai-retry-btn,
    .ai-error, .ai-badge, .ai-note {
        display: none !important;
    }
    .ai-content {
        border: none;
        box-shadow: none;
        background: none;
        padding: 0;
    }
}

/* ============================================================
   PDF Export Button
   ============================================================ */
.report-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}



.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(196,28,28,0.25);
    font-family: inherit;
}

.btn-export:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(196,28,28,0.35);
    background: #a51c1c;
}

.btn-export .export-icon {
    font-size: 1.1rem;
}

/* ============================================================
   Report Navigation (switch between completed reports)
   ============================================================ */
.report-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 0.25rem;
}

.report-nav::-webkit-scrollbar {
    height: 4px;
}

.report-nav::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 2px;
}

.report-nav-label {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: 0.25rem;
}

.report-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    background: var(--bg-card, #f5f5f5);
    color: var(--text-secondary, #555);
    border: 1.5px solid var(--border-color, #e0e0e0);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: inherit;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-nav-btn:hover {
    border-color: var(--accent, #6c5ce7);
    color: var(--accent, #6c5ce7);
    transform: translateY(-1px);
}

.report-nav-btn.active {
    background: var(--accent, #6c5ce7);
    color: white;
    border-color: var(--accent, #6c5ce7);
    box-shadow: 0 2px 8px rgba(108,92,231,0.3);
}

.report-nav-btn .nav-btn-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.08);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.report-nav-btn.active .nav-btn-index {
    background: rgba(255,255,255,0.25);
}

/* ============================================================
   Print-only Header / Footer
   ============================================================ */
.print-only-header {
    display: none;
}

.print-only-footer {
    display: none;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .info-grid, .form-cards, .validity-grid, .index-grid {
        grid-template-columns: 1fr;
    }

    .scoring-grid { grid-template-columns: 1fr; }

    /* Report meta board — 2 columns on tablet */
    .meta-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .meta-item--wide {
        grid-column: span 2;
    }

    .hero-title {
        font-size: var(--fs-2xl);
    }

    .options-group {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .index-score-display .index-t {
        font-size: 2rem;
    }

    /* Touch targets ≥44px for mobile — WCAG 2.5.5 */
    .btn, .btn-sm { min-height: 44px; }
    .filter-chip { min-height: 36px; padding: var(--space-2) var(--space-4); }
}

/* ============================================================
   Responsive — Small phones (640px and below)
   Table → card transformation for user-facing tables
   ============================================================ */
@media (max-width: 640px) {
    /* Table to card transformation — .scales-table & #assessmentTable */
    .scales-table thead,
    #assessmentTable thead {
        display: none;
    }

    .scales-table tbody tr,
    #assessmentTable tbody tr {
        display: block;
        margin-bottom: var(--space-3);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: var(--space-3);
        background: var(--card-bg);
    }

    .scales-table tbody td,
    #assessmentTable tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--space-2) 0;
        border: none;
        text-align: right;
        font-size: var(--fs-sm);
    }

    .scales-table tbody td::before,
    #assessmentTable tbody td::before {
        content: attr(data-label);
        font-weight: var(--fw-medium);
        color: var(--text-secondary);
        text-align: left;
    }

    /* Admin tables — horizontal scroll fallback (card transform too complex for 8-9 cols) */
    .admin-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Stack report meta board to single column on small phones */
    .meta-row {
        grid-template-columns: 1fr;
    }
    .meta-item--wide {
        grid-column: span 1;
    }

    /* Auth cards reduce padding */
    .auth-card { padding: var(--space-6); }

    /* Modal takes full width on mobile */
    .modal {
        max-width: 100%;
        margin: var(--space-4);
        padding: var(--space-6);
    }
}

/* ============================================================
   Responsive — Small desktop / large tablet (1024px and below)
   ============================================================ */
@media (max-width: 1024px) {
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .index-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   Accessibility — Reduced Motion (WCAG 2.3.3)
   Users who prefer reduced motion get instant, transform-free transitions
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Remove transform-based hover/active effects */
    .btn:hover:not(:disabled),
    .btn:active:not(:disabled),
    .card:hover,
    .stat-card:hover,
    .stat-card:active,
    .child-card:hover,
    .child-card:active,
    .question-card:hover,
    .question-card:active,
    .filter-chip:active,
    .option-item:active,
    .ai-placeholder-card:hover,
    .ai-generate-btn:hover {
        transform: none !important;
    }

    /* Keep spinners functional but slow them down */
    .ai-loading-spinner {
        animation-duration: 2s !important;
    }

    /* Disable entrance animations — show content immediately */
    .auth-card,
    .modal,
    .toast {
        animation: none !important;
    }
}

/* ============================================================
   PRINT STYLES — Clean, Professional, Compact Layout
   ============================================================ */
@media print {
    /* ---- Page setup: A4 ---- */
    @page {
        size: A4;
        margin: 15mm 16mm 18mm 16mm;

        @bottom-center {
            content: "— " counter(page) " / " counter(pages) " —";
            font-family: 'Inter', -apple-system, sans-serif;
            font-size: 7pt;
            color: #b0b0b0;
        }

        @top-right {
            content: "心理测评报告";
            font-family: system-ui, -apple-system, sans-serif;
            font-size: 6.5pt;
            color: #b0b0b0;
            letter-spacing: 1.5px;
        }
    }

    @page :first {
        @top-right { content: none; }
    }

    /* ---- Reset body ---- */
    body {
        background: white !important;
        color: #222 !important;
        font-size: 9.5pt;
        line-height: 1.5;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* ---- Force all backgrounds/borders to print (Chrome often skips them) ---- */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* ---- Hide interactive elements ---- */
    .app-header, .header-nav, .nav-link, .logo, .header-content,
    .app-footer, .btn, .btn-primary, .btn-accent, .btn-export,
    .report-toolbar, .progress-container, .submit-section,
    .ai-placeholder, .ai-loading, .ai-generate-btn, .ai-retry-btn,
    .ai-error, .ai-note, .ai-badge,
    .section-icon { display: none !important; }

    /* ---- Print-only header (thin top bar) ---- */
    .print-only-header {
        display: block;
        text-align: center;
        padding-bottom: 3mm;
        margin-bottom: 5mm;
        border-bottom: 1px solid #ddd;
    }
    .print-only-header .print-logo {
        font-size: 6.5pt;
        color: #bbb;
        letter-spacing: 2px;
        text-transform: uppercase;
    }
    .print-only-header .print-divider { display: none; }

    /* ---- Print-only footer (last page only, in normal flow) ---- */
    .print-only-footer {
        display: block;
        text-align: center;
        margin-top: 5mm;
        padding-top: 3mm;
        border-top: 0.5px solid #ddd;
        font-size: 6.5pt;
        color: #999;
        line-height: 1.5;
        break-before: avoid;
        page-break-before: avoid;
    }

    /* ---- Layout ---- */
    .app-container { min-height: auto; }
    .main-content { max-width: 100%; width: 100%; margin: 0; padding: 0; }
    .report-content { max-width: 100%; }

    /* ============================================
       REPORT HEADER — Compact cover block
       ============================================ */
    .report-header {
        background: #31302e !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 4mm 8mm 3mm;
        margin-bottom: 3mm;
        border-radius: 2mm;
        box-shadow: none;
        page-break-after: avoid;
    }
    .report-title {
        font-size: 13pt;
        font-weight: 700;
        margin-bottom: 2mm;
        letter-spacing: 1.5px;
        text-align: center;
    }
    .report-meta {
        display: block;
    }
    .meta-group {
        background: rgba(255,255,255,0.06) !important;
        border: 1px solid rgba(255,255,255,0.18);
        border-radius: 1mm;
        padding: 1.5mm;
    }
    .meta-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 1mm 3mm;
    }
    .meta-divider {
        margin: 1mm 0;
    }
    .meta-item {
        padding: 0;
        background: transparent !important;
        border: none;
        text-align: left;
    }
    .meta-item--wide {
        grid-column: span 2;
    }
    .meta-label {
        display: block;
        font-size: 5pt;
        color: rgba(255,255,255,0.5) !important;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 0.3mm;
    }
    .meta-value {
        display: block;
        font-size: 7pt;
        font-weight: 600;
        color: white !important;
    }

    /* ============================================
       PAGE-ONE BLOCK — keeps validity + charts together
       ============================================ */
    .page-one-block {
        page-break-inside: avoid;
    }

    /* ============================================
       REPORT SECTIONS
       ============================================ */
    .report-section {
        background: white;
        padding: 3mm 0 2mm;
        margin-bottom: 3mm;
        border-radius: 0;
        box-shadow: none;
        border: none;
        break-inside: auto;
        page-break-inside: auto;
    }
    .report-section .section-title {
        font-size: 10pt;
        font-weight: 700;
        color: #31302e;
        border-bottom: 1.5px solid #31302e;
        padding-bottom: 1.5mm;
        margin-bottom: 2.5mm;
        letter-spacing: 0.5px;
        text-align: left !important;
    }
    .section-desc {
        font-size: 7pt;
        color: #777;
        margin-bottom: 2mm;
        text-align: left !important;
    }

    /* ---- Validity ---- */
    .validity-grid { grid-template-columns: repeat(3, 1fr); gap: 2.5mm; }
    .validity-card {
        padding: 2.5mm 3mm;
        border-width: 1px;
        border-radius: 1.5mm;
    }
    .validity-ok { background: var(--sev-normal-bg) !important; border-color: var(--sev-normal-border) !important; }
    .validity-warn { background: var(--sev-moderate-bg) !important; border-color: var(--sev-moderate-border) !important; }
    .validity-bad { background: var(--sev-high-bg) !important; border-color: var(--sev-high-border) !important; }
    .validity-card h4 { font-size: 6.5pt; margin-bottom: 1mm; }
    .validity-score { font-size: 14pt; }
    .validity-score small { font-size: 5.5pt; }
    .validity-class { font-size: 7pt; font-weight: 600; }
    .validity-desc { font-size: 6pt; margin-top: 1mm; }
    .missing-notice { font-size: 6.5pt; padding: 1.5mm 2.5mm; margin-top: 2mm; }

    /* ---- Chart section ---- */
    .chart-section { 
        page-break-inside: avoid;
        text-align: left !important;
    }
    .chart-container {
        height: auto;
        max-height: 200px;
        margin: 2mm 0 4mm;
    }
    .chart-container canvas { display: none !important; }
    .pm-radar-wrapper canvas { display: none !important; }
    .chart-container .chart-img-fallback,
    .pm-radar-wrapper .chart-img-fallback {
        display: block !important;
        max-width: 100%;
        max-height: 220px;
        height: auto;
        margin: 0 auto;
    }
    img.chart-img-fallback {
        display: block !important;
        max-width: 100%;
        max-height: 200px;
        height: auto;
        margin: 0 auto;
    }
    .chart-legend-info { font-size: 6.5pt; gap: 2.5mm; margin-top: 3mm; }
    .legend-dot { width: 7px; height: 7px; }
    .chart-sub-title {
        font-size: 7pt;
        font-weight: 600;
        color: #555;
        margin-top: 4mm;
        margin-bottom: 1.5mm;
        text-align: left !important;
    }

    /* ---- Scales Table ---- */
    .scales-table-wrapper { overflow-x: visible; }
    .scales-table { font-size: 7.5pt; }
    .scales-table th {
        background: #31302e !important;
        color: white !important;
        padding: 1.8mm 3mm;
        font-size: 6.5pt;
        font-weight: 600;
    }
    .scales-table td {
        padding: 1.2mm 3mm;
        border-bottom: 0.5px solid #eee;
    }
    .scale-row:hover { background: inherit; }
    .row-high { background: var(--sev-high-bg) !important; }
    .row-moderate { background: var(--sev-moderate-bg) !important; }
    .row-mild { background: var(--sev-mild-bg) !important; }
    .scale-row-desc { font-size: 6pt; }
    .t-score-cell { font-size: 8pt; }

    .badge { font-size: 6pt; padding: 0.5mm 1.8mm; }
    .badge-normal { background: var(--sev-normal-bg) !important; color: var(--sev-normal) !important; }
    .badge-mild { background: var(--sev-mild-bg) !important; color: var(--sev-mild) !important; }
    .badge-moderate { background: var(--sev-moderate-bg) !important; color: var(--sev-moderate) !important; }
    .badge-high { background: var(--sev-high-bg) !important; color: var(--sev-high) !important; }

    /* ---- Index Cards ---- */
    .index-grid { grid-template-columns: repeat(2, 1fr); gap: 2.5mm; }
    .index-card { padding: 3mm; page-break-inside: avoid; }
    .index-high { background: var(--sev-high-bg) !important; }
    .index-header h4 { font-size: 7.5pt; }
    .index-t { font-size: 18pt; }
    .index-meta { font-size: 6.5pt; gap: 2.5mm; }
    .index-interpretation {
        font-size: 7pt;
        line-height: 1.5;
        margin-top: 2mm;
        padding-top: 1.5mm;
    }

    /* ---- Extended Research Section (Layer 2-6, 专业版打印压缩) ---- */
    .extended-card {
        padding: 2.5mm 3mm;
        margin-bottom: 2.5mm;
    }
    .extended-card-title {
        font-size: 9.5pt;
        margin-bottom: 1mm;
        page-break-after: avoid;
        break-after: avoid;
        display: inline-block;
        width: 100%;
    }
    .extended-card-desc {
        font-size: 7.5pt;
        line-height: 1.5;
        margin-bottom: 2mm;
        page-break-after: avoid;
        break-after: avoid;
        display: inline-block;
        width: 100%;
    }

    /* ---- 新增筛查量表可视化模块打印优化 ---- */
    .screening-visual-section {
        border-left: 2mm solid #2a9d99 !important;
        padding-left: 3mm;
        break-inside: auto;
        page-break-inside: auto;
    }

    .screening-visual-grid {
        grid-template-columns: 1fr;
        gap: 3mm;
        margin-bottom: 3mm;
    }

    .screening-visual-section .extended-card {
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        background: white !important;
        padding: 2.5mm 3mm;
        break-inside: auto;
        page-break-inside: auto;
    }

    .screening-score-row {
        margin: 1.5mm 0 2mm;
    }

    .screening-score-number {
        font-size: 22pt;
    }

    .screening-score-number span,
    .screening-score-meta {
        font-size: 7pt;
    }

    .screening-score-meta strong {
        font-size: 9pt;
    }

    .screening-gauge {
        height: 2.4mm;
        border: 0.4px solid #ddd;
    }

    .screening-gauge-marker {
        height: 5mm;
        top: -1.2mm;
        background: #31302e !important;
        box-shadow: none;
    }

    .screening-gauge-labels {
        font-size: 6pt;
        margin-top: 1mm;
    }

    .screening-note-stack {
        gap: 1.5mm;
    }

    .screening-note-item {
        grid-template-columns: 18mm 1fr;
        padding: 1.5mm 2mm;
        gap: 2mm;
        font-size: 6.8pt;
        background: #fafafa !important;
        border: 0.4px solid #e5e5e5;
    }

    .screening-bars {
        gap: 1.5mm;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .screening-bar-row {
        grid-template-columns: 35mm 1fr 22mm;
        gap: 2.5mm;
        padding: 1.6mm 2mm;
        background: #fafafa !important;
        border: 0.4px solid #e5e5e5;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .screening-bar-label strong,
    .screening-bar-value strong {
        font-size: 7pt;
    }

    .screening-bar-label span,
    .screening-bar-value span {
        font-size: 5.8pt;
        line-height: 1.3;
    }

    .screening-bar-track {
        height: 2.2mm;
        border: 0.4px solid #ddd;
    }

    .screening-single-interpretation,
    .screening-recommend-text {
        font-size: 7pt;
        line-height: 1.55;
        padding: 1.8mm 2mm;
        background: #fafafa !important;
        border: 0.4px solid #e5e5e5;
    }

    /* ---- PHQ-9 青少年版专属模块打印优化 ---- */
    .phq9-visual-section {
        border-left: 2mm solid #7c3aed !important;
        padding-left: 3mm;
    }
    .phq9-gauge-wrapper { max-width: 55mm; margin: 0 auto 2mm; }
    .phq9-gauge-score { font-size: 18pt; }
    .phq9-gauge-badge { font-size: 6pt; padding: 0.5mm 1.5mm; }
    .phq9-sev-bar { height: 3mm; margin-bottom: 3mm; }
    .phq9-sev-marker { height: 3.5mm; top: -0.3mm; }
    .phq9-sev-marker-label { font-size: 5pt; top: -5mm; padding: 0.5px 1mm; }
    .phq9-sev-labels { font-size: 5pt; margin-top: -1mm; }
    .phq9-alert { padding: 1.5mm 2mm; margin-bottom: 2mm; }
    .phq9-alert-title { font-size: 6pt; }
    .phq9-alert-text { font-size: 5.5pt; line-height: 1.3; }
    .phq9-symptom-table { font-size: 5.5pt; }
    .phq9-symptom-table th, .phq9-symptom-table td { padding: 0.5mm 0.8mm; }
    .phq9-tbl-score { font-size: 5.5pt; }
    .phq9-bottom-grid { grid-template-columns: 1fr 1.2fr; gap: 2mm; margin-bottom: 2mm; }
    .phq9-ref-card, .phq9-next-card { padding: 1.5mm; }
    .phq9-sev-table { font-size: 5pt; }
    .phq9-sev-table th, .phq9-sev-table td { padding: 0.5mm 0.8mm; }
    .phq9-next-list li { font-size: 5.5pt; gap: 1mm; }
    .phq9-next-icon { width: 4mm; height: 4mm; font-size: 3pt; }
    .phq9-extra-card { padding: 1.5mm; }
    .phq9-extra-label { font-size: 4.5pt; }
    .phq9-extra-item strong { font-size: 5.5pt; }
    .phq9-extra-item { padding: 0.8mm; }
    .phq9-emergency-box { padding: 1.5mm 2mm; }
    .phq9-emergency-title { font-size: 6pt; }
    .phq9-emergency-desc { font-size: 5pt; }
    .phq9-emergency-contact strong { font-size: 7pt; }
    .phq9-emergency-label { font-size: 4.5pt; }
    .phq9-emergency-contact { padding: 1mm 2mm; }
    .phq9-extra-label { font-size: 5pt; }
    .phq9-extra-item strong { font-size: 6.5pt; }

    /* ---- PHQ-9 NEW LAYOUT print styles ---- */
    .phq9-head {
        margin-bottom: 2mm;
        page-break-after: avoid;
    }
    .phq9-section-title { font-size: 13pt; }
    .phq9-head-sub { font-size: 6pt; }
    .phq9-brand { padding: 1mm 2mm; }
    .phq9-brand-logo { font-size: 8pt; }
    .phq9-brand-name { font-size: 6pt; }
    .phq9-brand-sub { font-size: 4.5pt; }
    .phq9-info-card {
        grid-template-columns: repeat(3, 1fr);
        gap: 1mm 3mm;
        padding: 1.5mm 3mm;
        margin: 2mm 0;
        page-break-after: avoid;
    }
    .phq9-info-row { font-size: 6pt; padding: 0.3mm 0; gap: 1mm; }
    .phq9-info-label { font-size: 5pt; min-width: 3em; }
    .phq9-info-val { font-size: 6.5pt; }
    .phq9-info-no { font-size: 5.5pt; }
    .phq9-total-block {
        grid-template-columns: 1.1fr 1fr;
        gap: 2mm;
        margin-bottom: 2mm;
        page-break-after: avoid;
    }
    .phq9-total-left, .phq9-total-right { padding: 1.5mm 2mm; }
    .phq9-block-title { font-size: 7pt; margin-bottom: 1mm; }
    .phq9-alert-suggestion { font-size: 5.5pt; padding: 1mm 1.5mm; }
    .phq9-safety-alert { padding: 1mm 1.5mm; font-size: 5.5pt; }
    .phq9-safety-alert-head { font-size: 5.5pt; }
    .phq9-mid-grid {
        grid-template-columns: 1.5fr 1fr;
        gap: 2mm;
        margin-bottom: 2mm;
        page-break-inside: avoid;
    }
    .phq9-mid-grid .extended-card { padding: 1.5mm 2mm; }
    .phq9-freq-legend { font-size: 5pt; margin-top: 1mm; padding-top: 1mm; }
    .phq9-ref-card, .phq9-next-card { padding: 1.5mm 2mm; }
    .phq9-next-list { gap: 1mm; }
    .phq9-next-list li { padding: 1mm 1.5mm; font-size: 5.5pt; gap: 1.5mm; }
    .phq9-next-list li strong { font-size: 6pt; }
    .phq9-next-list li span { font-size: 5pt; }
    .phq9-next-icon { width: 5mm; height: 5mm; font-size: 5pt; }
    .phq9-safety-resp { padding: 1.5mm 2mm; margin-top: 1mm; }
    .phq9-safety-resp h3 { font-size: 7pt; }
    .phq9-sign { grid-template-columns: 1fr 1fr; gap: 6mm; margin-top: 3mm; padding: 1.5mm 0; }
    .phq9-sign-label { font-size: 5.5pt; }
    .phq9-sign-line { height: 5mm; }
    .phq9-disclaimer { font-size: 5pt; margin-top: 1.5mm; padding-top: 1mm; line-height: 1.4; }
    .phq9-info-card, .phq9-total-block, .phq9-mid-grid,
    .phq9-next-card, .phq9-emergency-box, .phq9-safety-resp, .phq9-sign {
        page-break-inside: avoid;
    }
    .phq9-extra-item { padding: 1mm; }

    .phq9-section {
        border-left: 2mm solid #7c3aed !important;
        padding-left: 3mm;
    }

    .phq9-flag-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2mm;
        margin-bottom: 2.5mm;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .phq9-flag-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .phq9-flag-card {
        min-height: auto;
        padding: 2mm !important;
        border-top: 0.8mm solid rgba(124,58,237,0.35) !important;
        background: white !important;
    }

    .phq9-flag-card.active {
        border-top-color: #dc2626 !important;
        background: #fff7f7 !important;
    }

    .phq9-flag-label,
    .phq9-flag-desc {
        font-size: 6pt;
        line-height: 1.35;
    }

    .phq9-flag-card strong {
        font-size: 11pt;
    }

    .phq9-followup-card {
        break-inside: avoid;
        page-break-inside: avoid;
        background: white !important;
        border-left: 1mm solid #7c3aed !important;
    }

    .phq9-followup-card.urgent {
        border-left-color: #dc2626 !important;
        background: #fff7f7 !important;
    }

    .phq9-followup-list {
        gap: 1.2mm;
    }

    .phq9-followup-item {
        font-size: 6.8pt;
        line-height: 1.45;
        padding: 1.5mm 2mm;
        background: #fafafa !important;
        border: 0.4px solid #e5e5e5;
    }

    /* 临床组对比卡片内容量大，强制从新页开始，避免标题被前面内容挤到页底而内容推到下一页 */
    .extended-card.cc-page-break-before {
        page-break-before: always;
        break-before: page;
    }

    /* Layer 3: 临床组剖面对比 */
    .clinical-comparison-row {
        padding: 1.2mm 0;
        gap: 2mm;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .cc-scale-label { width: 100px; gap: 1px; }
    .cc-scale-label strong { font-size: 7pt; }
    .cc-child-t { font-size: 6pt; }
    .cc-bars { gap: 1.5px; }
    .cc-bar-group { 
        gap: 1.5mm; 
        width: 100% !important;
    }
    .cc-group-name { width: 80px; font-size: 6pt; flex-shrink: 0 !important; }
    .cc-bar-track { 
        height: 14px; 
        border-radius: 2px;
        background: #ccc !important;
        border: 1px solid #999 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
        overflow: hidden !important;
        display: block !important;
        flex: none !important;
        width: calc(100% - 120px) !important;
        min-width: 150px !important;
    }
    .cc-bar { 
        height: 6px; 
        border-radius: 1px;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
        display: block !important;
        /* Keep inline width from HTML */
        min-width: 2px !important;
        /* Ensure background is rendered in print */
        -webkit-appearance: none;
        appearance: none;
        box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
    }
    .cc-bar-clinical { background: #666 !important; }
    .cc-bar-child { background: #005bb5 !important; }
    .cc-bar-value { font-size: 6pt; width: 30px; }
    .cc-bar-value small { font-size: 5.5pt; }
    .cc-legend { font-size: 6pt; gap: 2mm; margin-top: 1.5mm; }
    .cc-legend-color { width: 10px; height: 5px; }
    .cc-legend-clinical { background: #888 !important; }
    .cc-legend-child { background: #0075de !important; }

    /* Layer 5: 基础率 */
    .base-rate-row {
        padding: 1mm 0;
        gap: 2mm;
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .br-scale-label { width: 115px; font-size: 7pt; }
    .br-tags { gap: 2px; }
    .br-tag { font-size: 6pt; padding: 1px 5px; }

    /* Layer 6: 信度与 RCI */
    .reliability-table { font-size: 7.5pt; }
    .reliability-table th {
        font-size: 6.5pt;
        padding: 1.2mm 2.5mm;
    }
    .reliability-table td {
        padding: 1mm 2.5mm;
    }
    .reliability-table tr {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    /* ---- AI Content ---- */
    .ai-content {
        border: 0.5px solid #ddd;
        border-radius: 1.5mm;
        padding: 3mm;
        box-shadow: none;
        background: white;
        font-size: 8pt;
        line-height: 1.6;
    }
    .ai-content h1, .ai-content h2 {
        font-size: 9.5pt;
        border-left: 2.5px solid var(--accent);
        padding: 0.5mm 0 0.5mm 2.5mm;
        margin: 2.5mm 0 1.5mm;
        background: none;
        page-break-after: avoid;
    }
    .ai-content h3 { font-size: 8.5pt; margin: 2.5mm 0 1.5mm; page-break-after: avoid; }
    .ai-content p { font-size: 8pt; margin-bottom: 1.5mm; text-align: justify; }
    .ai-content table { font-size: 7pt; }
    .ai-content th { padding: 1.2mm 2.5mm; }
    .ai-content td { padding: 0.8mm 2.5mm; }

    /* ============================================
       Y-BOCS PDF layout
       ============================================ */
    .ybocs-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
        border-left: none !important;
    }

    /* ============================================
       DES-II PDF layout
       ============================================ */
    .des-ii-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .des-ii-section .des-np-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .des-ii-section .des-np-card-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding-bottom: 1.5mm;
    }

    .des-ii-section .des-np-text {
        font-size: 7.5pt;
        line-height: 1.55;
    }

    .des-ii-section .des-np-list {
        font-size: 7pt;
        line-height: 1.5;
    }

    .des-ii-section .des-results-table,
    .des-ii-section .des-data-table,
    .des-ii-section .des-severity-table {
        font-size: 7pt;
    }

    .des-ii-section .des-results-table th,
    .des-ii-section .des-data-table th,
    .des-ii-section .des-severity-table th {
        background: #31302e !important;
        color: white !important;
        font-size: 6.5pt;
        padding: 1.5mm 2.5mm;
    }

    .des-ii-section .des-results-table td,
    .des-ii-section .des-data-table td,
    .des-ii-section .des-severity-table td {
        padding: 1.2mm 2.5mm;
    }

    .des-ii-section .des-band-chart {
        height: 260px;
        margin: 2mm 20mm 2mm 32mm;
        border-left-width: 2px !important;
        border-bottom-width: 2px !important;
    }

    .des-ii-section .des-y-tick {
        font-size: 6pt;
        left: -26px;
    }

    .des-ii-section .des-band-label {
        font-size: 5.5pt;
        right: 4px;
    }

    .des-ii-section .des-bars {
        gap: 18px;
        padding: 0 14px;
        left: 2%;
        right: 2%;
    }

    .des-ii-section .des-sample-bar,
    .des-ii-section .des-single-bar {
        width: 52px;
        border-width: 1.2px;
    }

    .des-ii-section .des-x-labels {
        gap: 18px;
        margin: 1mm 20mm 0 32mm;
        padding: 0 14px;
        font-size: 6.5pt;
    }

    .des-ii-section .des-chart-title {
        font-size: 8pt;
        margin: 2mm 0 1.5mm;
    }

    .des-ii-section .des-compare-title {
        font-size: 8pt;
        margin: 3mm 0 1.5mm;
    }

    .des-ii-section .des-svg-chart {
        max-height: 180px;
    }

    .des-ii-section .des-response-simple {
        font-size: 6.8pt;
    }

    .des-ii-section .des-response-simple th {
        background: #31302e !important;
        color: white !important;
        font-size: 6pt;
        padding: 1mm 2mm;
    }

    .des-ii-section .des-response-simple td {
        padding: 1mm 2mm;
    }

    .des-ii-section .des-response-simple .rs-score-badge {
        font-size: 6.5pt;
        padding: 0.5mm 2mm;
    }

    .des-ii-section .des-response-simple .rs-score-bar {
        width: 50px;
        height: 5px;
    }

    .des-ii-section .des-legend {
        grid-template-columns: 1fr 1fr !important;
        font-size: 6pt;
        padding: 1.5mm 3mm;
        gap: 2mm 10mm;
        border-width: 1px !important;
        border-radius: 3px;
    }

    .des-ii-section .des-legend-swatch {
        width: 18px;
        height: 10px;
    }

    .des-ii-section .des-np-interp-box {
        padding: 2mm 3mm;
    }

    .des-ii-section .des-np-subtitle {
        font-size: 8pt;
    }

    /* ============================================
       CDC PDF layout
       ============================================ */
    .cdc-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .cdc-section .cdc-np-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .cdc-section .cdc-np-card-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding-bottom: 1.5mm;
    }

    .cdc-section .cdc-np-text {
        font-size: 7.5pt;
        line-height: 1.55;
    }

    .cdc-section .cdc-np-list {
        font-size: 7pt;
        line-height: 1.5;
    }

    .cdc-section .cdc-results-table,
    .cdc-section .cdc-data-table,
    .cdc-section .cdc-severity-table {
        font-size: 7pt;
    }

    .cdc-section .cdc-results-table th,
    .cdc-section .cdc-data-table th,
    .cdc-section .cdc-severity-table th {
        background: #31302e !important;
        color: white !important;
        font-size: 6.5pt;
        padding: 1.5mm 2.5mm;
    }

    .cdc-section .cdc-results-table td,
    .cdc-section .cdc-data-table td,
    .cdc-section .cdc-severity-table td {
        padding: 1.2mm 2.5mm;
    }

    .cdc-section .cdc-band-chart {
        height: 260px;
        margin: 2mm 20mm 2mm 32mm;
        border-left-width: 2px !important;
        border-bottom-width: 2px !important;
    }

    .cdc-section .cdc-y-tick {
        font-size: 6pt;
        left: -26px;
    }

    .cdc-section .cdc-band-label {
        font-size: 5.5pt;
        right: 4px;
    }

    .cdc-section .cdc-total-bar {
        width: 52px;
        border-width: 1.2px;
    }

    .cdc-section .cdc-total-label {
        font-size: 6.5pt;
        top: -18px;
    }

    .cdc-section .cdc-chart-title {
        font-size: 8pt;
        margin: 2mm 0 1.5mm;
    }

    .cdc-section .cdc-compare-title {
        font-size: 8pt;
        margin: 3mm 0 1.5mm;
    }

    .cdc-section .cdc-svg-chart {
        max-height: 180px;
    }

    .cdc-section .cdc-response-table {
        font-size: 6.8pt;
    }

    .cdc-section .cdc-response-table th {
        background: #31302e !important;
        color: white !important;
        font-size: 6pt;
        padding: 1mm 2mm;
    }

    .cdc-section .cdc-response-table td {
        padding: 1mm 2mm;
    }

    .cdc-section .cdc-response-table .rs-choice {
        font-size: 6.5pt;
        width: 5mm;
        height: 5mm;
    }

    .cdc-section .cdc-np-interp-box {
        padding: 2mm 3mm;
    }

    .cdc-section .cdc-np-subtitle {
        font-size: 8pt;
    }

    /* ============================================
       A-DES PDF layout
       ============================================ */
    .a-des-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .a-des-section .ades-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .a-des-section .ades-card-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding-bottom: 1.5mm;
    }

    .a-des-section .ades-text {
        font-size: 7.5pt;
        line-height: 1.55;
    }

    .a-des-section .ades-list {
        font-size: 7pt;
        line-height: 1.5;
    }

    .a-des-section .ades-results-table,
    .a-des-section .ades-data-table,
    .a-des-section .ades-severity-table {
        font-size: 7pt;
    }

    .a-des-section .ades-results-table th,
    .a-des-section .ades-data-table th,
    .a-des-section .ades-severity-table th {
        background: #31302e !important;
        color: white !important;
        font-size: 6.5pt;
        padding: 1.5mm 2.5mm;
    }

    .a-des-section .ades-results-table td,
    .a-des-section .ades-data-table td,
    .a-des-section .ades-severity-table td {
        padding: 1.2mm 2.5mm;
    }

    .a-des-section .ades-band-chart {
        height: 245px;
        margin: 2mm 18mm 2mm 28mm;
        border-left-width: 2px !important;
        border-bottom-width: 2px !important;
    }

    .a-des-section .ades-y-tick {
        font-size: 6pt;
        left: -24px;
    }

    .a-des-section .ades-band-label {
        font-size: 5.5pt;
        right: 4px;
    }

    .a-des-section .ades-bars {
        gap: 14px;
        padding: 0 10px;
    }

    .a-des-section .ades-bar {
        width: 38px;
        border-width: 1.2px;
    }

    .a-des-section .ades-x-labels {
        gap: 14px;
        margin: 1mm 18mm 0 28mm;
        padding: 0 10px;
        font-size: 6pt;
    }

    .a-des-section .ades-chart-title,
    .a-des-section .ades-compare-title {
        font-size: 8pt;
        margin: 2mm 0 1.5mm;
    }

    .a-des-section .ades-svg-chart {
        max-height: 190px;
    }

    .a-des-section .ades-response-table {
        font-size: 5.5pt;
    }

    .a-des-section .ades-response-table th {
        background: #31302e !important;
        color: white !important;
        font-size: 5.2pt;
        padding: 0.8mm 1mm;
    }

    .a-des-section .ades-response-table td {
        padding: 0.7mm 0.7mm;
    }

    .a-des-section .ades-choice {
        width: 4mm;
        height: 4mm;
        font-size: 5pt;
    }

    .a-des-section .ades-interp-box {
        padding: 2mm 3mm;
    }

    .a-des-section .ades-subtitle {
        font-size: 8pt;
    }

    /* SNAP-IV print styles */
    .snap-iv-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .snap-iv-section .snap-np-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .snap-iv-section .snap-np-card-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding-bottom: 1mm;
    }

    .snap-iv-section .snap-np-text {
        font-size: 7.5pt;
        line-height: 1.5;
    }

    .snap-iv-section .snap-np-list {
        font-size: 7pt;
        margin: 1mm 0 2mm;
    }

    .snap-iv-section .snap-np-subtitle {
        font-size: 8pt;
        margin: 2mm 0 1mm;
    }

    .snap-iv-section .snap-np-interp-box {
        padding: 2mm 3mm;
    }

    .snap-iv-section .snap-results-table,
    .snap-iv-section .snap-severity-table {
        font-size: 7pt;
    }

    .snap-iv-section .snap-results-table th,
    .snap-iv-section .snap-results-table td,
    .snap-iv-section .snap-severity-table th,
    .snap-iv-section .snap-severity-table td {
        padding: 1mm 2mm;
    }

    .snap-iv-section .snap-band-chart {
        height: 70mm;
        margin: 2mm 10mm 2mm 22mm;
    }

    .snap-iv-section .snap-y-tick {
        font-size: 6pt;
    }

    .snap-iv-section .snap-band-label {
        font-size: 5pt;
    }

    .snap-iv-section .snap-bars,
    .snap-iv-section .snap-x-labels {
        gap: 20px;
        padding: 0 16px;
    }

    .snap-iv-section .snap-single-bar {
        width: 52px;
    }

    .snap-iv-section .snap-bar-score {
        font-size: 7pt;
    }

    .snap-iv-section .snap-x-labels {
        font-size: 7pt;
        margin: 1mm 10mm 0 22mm;
    }

    .snap-iv-section .snap-chart-title {
        font-size: 8pt;
        margin: 2mm 0 1mm;
    }

    .snap-iv-section .snap-response-grid {
        font-size: 6pt;
    }

    .snap-iv-section .snap-response-grid th,
    .snap-iv-section .snap-response-grid td {
        padding: 0.8mm 1mm;
    }

    .snap-iv-section .snap-response-grid .rg-text {
        font-size: 5.5pt;
    }

    /* Vanderbilt print styles */
    .vanderbilt-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .vanderbilt-section .van-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .vanderbilt-section .van-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding-bottom: 1mm;
    }

    .vanderbilt-section .van-text {
        font-size: 7.2pt;
        line-height: 1.45;
    }

    .vanderbilt-section .van-table,
    .vanderbilt-section .van-response-grid {
        font-size: 6.2pt;
    }

    .vanderbilt-section .van-table th,
    .vanderbilt-section .van-table td,
    .vanderbilt-section .van-response-grid th,
    .vanderbilt-section .van-response-grid td {
        padding: 0.8mm 1mm;
    }

    .vanderbilt-section .van-percent-chart {
        height: 65mm;
        margin: 2mm 10mm 3mm 20mm;
    }

    .vanderbilt-section .van-chart-title {
        font-size: 8pt;
        margin: 2mm 0 1mm;
    }

    .vanderbilt-section .van-chart-svg {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto 3mm !important;
    }

    .vanderbilt-section .van-chart-text {
        font-family: Arial, Helvetica, sans-serif !important;
    }

    .vanderbilt-section .van-chart-note {
        font-size: 6pt;
        line-height: 1.35;
        margin: -1mm 8mm 2mm;
    }

    .vanderbilt-section .van-response-grid .rg-text {
        font-size: 5.5pt;
    }

    /* ChOCI-R print styles */
    .choci-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .choci-section .choci-card {
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .choci-section .choci-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding-bottom: 1mm;
    }

    .choci-section .choci-desc,
    .choci-section .choci-note {
        font-size: 6.5pt;
        line-height: 1.4;
    }

    .choci-section .choci-table,
    .choci-section .choci-response-grid {
        font-size: 6pt;
    }

    .choci-section .choci-table th,
    .choci-section .choci-table td,
    .choci-section .choci-response-grid th,
    .choci-section .choci-response-grid td {
        padding: 0.8mm 1mm;
    }

    .choci-section .choci-row {
        grid-template-columns: 22mm 1fr;
        gap: 2mm;
        margin: 2mm 0;
    }

    .choci-section .choci-row-label {
        font-size: 6pt;
    }

    .choci-section .choci-track {
        height: 10mm;
    }

    .choci-section .choci-type-grid {
        gap: 2mm;
    }

    .choci-section .choci-type-item {
        padding: 2mm;
    }

    /* PAS print styles */
    .pas-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .pas-section .pas-card {
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .pas-section .pas-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding: 1.2mm 2mm;
    }

    .pas-section .pas-desc {
        font-size: 6.5pt;
        line-height: 1.35;
    }

    .pas-section .pas-table,
    .pas-section .pas-response-table {
        font-size: 5.8pt;
    }

    .pas-section .pas-table th,
    .pas-section .pas-table td,
    .pas-section .pas-response-table th,
    .pas-section .pas-response-table td {
        padding: 0.7mm 0.9mm;
    }

    .pas-section .pas-pct-chart {
        width: 105mm;
        height: 48mm;
        margin: 2mm auto 12mm;
    }

    .pas-section .pas-bar {
        width: 8mm;
    }

    .pas-section .pas-ylabels,
    .pas-section .pas-xlabel,
    .pas-section .pas-clinical-label {
        font-size: 5.5pt;
    }

    /* GBI print styles */
    .gbi-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .gbi-section .gbi-card {
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .gbi-section .gbi-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding-bottom: 1mm;
    }

    .gbi-section .gbi-desc,
    .gbi-section .gbi-note {
        font-size: 6.5pt;
        line-height: 1.4;
    }

    .gbi-section .gbi-table,
    .gbi-section .gbi-response-grid {
        font-size: 5.8pt;
    }

    .gbi-section .gbi-table th,
    .gbi-section .gbi-table td,
    .gbi-section .gbi-response-grid th,
    .gbi-section .gbi-response-grid td {
        padding: 0.7mm 0.9mm;
    }

    .gbi-section .gbi-two-col {
        gap: 2mm;
    }

    .gbi-section .gbi-mini-card {
        padding: 2mm;
    }

    .gbi-section .gbi-vchart {
        width: 95mm;
        height: 42mm;
        margin: 2mm auto 6mm;
    }

    .gbi-section .gbi-vbar {
        width: 12mm;
    }

    .gbi-section .gbi-vlabel,
    .gbi-section .gbi-ylabels,
    .gbi-section .gbi-zone-label {
        font-size: 5.5pt;
    }

    .gbi-section .gbi-dist-chart {
        height: 24mm;
        margin: 3mm auto 8mm;
    }

    .gbi-section .gbi-dist-title {
        font-size: 7pt;
        margin: 4mm 0 1.5mm;
    }

    .gbi-section .gbi-dist-axis,
    .gbi-section .gbi-dist-xlabel,
    .gbi-section .gbi-dist-tag {
        font-size: 5pt;
    }

    .gbi-section .gbi-hbar {
        height: 6mm;
        top: 9mm;
    }

    /* ChEAT print styles */
    .cheat-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .cheat-section .cheat-card {
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .cheat-section .cheat-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding: 1.2mm 2mm;
    }

    .cheat-section .cheat-desc {
        font-size: 6.5pt;
        line-height: 1.35;
    }

    .cheat-section .cheat-table,
    .cheat-section .cheat-response-table {
        font-size: 5.8pt;
    }

    .cheat-section .cheat-table th,
    .cheat-section .cheat-table td,
    .cheat-section .cheat-response-table th,
    .cheat-section .cheat-response-table td {
        padding: 0.7mm 0.9mm;
    }

    .cheat-section .cheat-avg-chart {
        height: 42mm;
        margin: 2mm auto 12mm;
    }

    /* BES print styles */
    .bes-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .bes-section .bes-card {
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .bes-section .bes-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding: 1.2mm 2mm;
    }

    .bes-section .bes-desc {
        font-size: 6.5pt;
        line-height: 1.35;
    }

    .bes-section .bes-table {
        font-size: 5.8pt;
    }

    .bes-section .bes-table th,
    .bes-section .bes-table td {
        padding: 0.7mm 0.9mm;
    }

    .bes-section .bes-vchart {
        height: 42mm;
        margin: 2mm auto 7mm;
    }

    .bes-section .bes-dist {
        height: 30mm;
        margin-bottom: 8mm;
    }

    .bes-section .bes-response-block {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .bes-section .bes-option {
        font-size: 5.8pt;
        padding: 0.6mm 1mm;
    }

    /* MDQ print styles */
    .mdq-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .mdq-section .mdq-card {
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .mdq-section .mdq-title {
        font-size: 9pt;
        margin-bottom: 2mm;
        padding-bottom: 1mm;
    }

    .mdq-section .mdq-desc {
        font-size: 6.5pt;
        line-height: 1.35;
    }

    .mdq-section .mdq-table,
    .mdq-section .mdq-response-grid {
        font-size: 5.8pt;
    }

    .mdq-section .mdq-table th,
    .mdq-section .mdq-table td,
    .mdq-section .mdq-response-grid th,
    .mdq-section .mdq-response-grid td {
        padding: 0.7mm 0.9mm;
    }

    .mdq-section .mdq-vchart {
        height: 38mm;
        margin: 2mm auto 7mm;
    }

    .mdq-section .mdq-vbar {
        width: 10mm;
    }

    .mdq-section .mdq-vlabel,
    .mdq-section .mdq-ylabels {
        font-size: 5.5pt;
    }

    .mdq-section .mdq-interp-box {
        border-left-width: 14mm;
        padding: 2mm 3mm;
    }

    /* SDS print styles */
    .sds-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .sds-section .sds-card {
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .sds-section .sds-title {
        font-size: 9pt;
        margin: 0 0 2mm;
        padding: 1mm 2mm;
        border-top: 0.5px solid #555;
        border-bottom: 0.5px solid #555;
        background: #eef7fb !important;
    }

    .sds-section .sds-subtitle {
        font-size: 8.5pt;
        margin: 3mm 0 2mm;
    }

    .sds-section .sds-desc {
        font-size: 7pt;
        line-height: 1.5;
        margin: 0 0 2mm;
    }

    .sds-section .sds-table {
        margin: 2mm 0 3mm;
        font-size: 7pt;
    }

    .sds-section .sds-table th,
    .sds-section .sds-table td {
        padding: 1.2mm 1.5mm;
    }

    .sds-section .sds-badge {
        font-size: 6pt;
        padding: 0.5mm 2mm;
    }

    .sds-section .sds-vchart {
        width: 100%;
        height: 55mm;
        margin: 2mm auto 5mm;
        border-left-width: 0.5mm;
        border-bottom-width: 0.5mm;
    }

    .sds-section .sds-ylabels {
        font-size: 5pt;
        left: -6mm;
    }

    .sds-section .sds-vbar {
        border-width: 0.4mm;
        width: 8mm;
    }

    .sds-section .sds-vlabel {
        font-size: 5.5pt;
        bottom: -5mm;
    }

    .sds-section .sds-band-label {
        font-size: 5pt;
    }

    .sds-section .sds-dist-title {
        font-size: 8pt;
        margin: 3mm 0 2mm;
    }

    .sds-section .sds-dist {
        width: 100%;
        height: 30mm;
        margin: 0 auto 4mm;
        border-left-width: 0.5mm;
        border-bottom-width: 0.4mm;
    }

    .sds-section .sds-dist .tag {
        font-size: 4.5pt;
        padding: 0.5mm 1mm;
    }

    .sds-section .sds-axis {
        font-size: 5pt;
        bottom: -4mm;
    }

    .sds-section .sds-xlabel {
        font-size: 6.5pt;
        margin-top: 4mm;
    }

    .sds-section .sds-legend {
        font-size: 6pt;
        margin-top: 1.5mm;
    }

    .sds-section .sds-key {
        width: 3mm;
        height: 1.5mm;
    }

    .sds-section .sds-interp-box {
        border-left-width: 14mm;
        padding: 2mm 3mm;
        margin: 2mm 0 3mm;
    }

    .sds-section .sds-interp-sub {
        font-size: 7pt;
        line-height: 1.5;
        margin: 2mm 0 1mm;
    }

    .sds-section .sds-high-items {
        font-size: 6.5pt;
        line-height: 1.45;
    }

    .sds-section .sds-response-grid {
        margin: 2mm 0;
        font-size: 6.5pt;
    }

    .sds-section .sds-response-grid th,
    .sds-section .sds-response-grid td {
        padding: 1mm 1.2mm;
    }

    .sds-section .sds-response-grid .rg-text {
        line-height: 1.2;
    }

    /* ASQ print styles */
    .asq-section {
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .asq-section .asq-card {
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm 4mm;
        margin: 2mm 0 3mm;
        background: white !important;
    }

    .asq-section .asq-title {
        font-size: 9pt;
        margin: 0 0 2mm;
        padding: 1mm 2mm;
        border-top: 0.5px solid #555;
        border-bottom: 0.5px solid #555;
        background: #eef7fb !important;
    }

    .asq-section .asq-desc {
        font-size: 7pt;
        line-height: 1.5;
        margin: 0 0 2mm;
    }

    .asq-section .asq-result-strip {
        gap: 2mm;
        margin: 2mm 0 3mm;
    }

    .asq-section .asq-result-box {
        min-height: 24mm;
        padding: 3mm 2mm;
        border-width: 0.4mm;
    }

    .asq-section .asq-result-name {
        font-size: 8pt;
        margin-bottom: 1mm;
    }

    .asq-section .asq-result-cn,
    .asq-section .asq-result-note {
        font-size: 6pt;
    }

    .asq-section .asq-current-result {
        border-left-width: 14mm;
        padding: 2mm 3mm;
        margin: 2mm 0 3mm;
    }

    .asq-section .asq-current-label {
        font-size: 9pt;
        margin-bottom: 1mm;
    }

    .asq-section .asq-table {
        margin: 2mm 0 3mm;
        font-size: 6.8pt;
    }

    .asq-section .asq-table th,
    .asq-section .asq-table td {
        padding: 1mm 1.2mm;
    }

    .asq-section .asq-pill {
        font-size: 6pt;
        padding: 0.5mm 1.8mm;
    }

    .asq-section .asq-note-box {
        padding: 2mm 3mm;
        margin: 2mm 0 3mm;
    }

    .asq-section .asq-note-title {
        font-size: 8pt;
        margin-bottom: 1mm;
    }

    .asq-section .asq-small {
        font-size: 6.8pt;
        line-height: 1.45;
    }

    /* Hide "解读与建议" section in PDF when no AI report exists */
    .interpretation-section.no-ai-report {
        display: none !important;
    }

    .ybocs-section .aq-overview-grid {
        grid-template-columns: 1fr 1fr;
        gap: 3mm;
        margin-bottom: 3mm;
    }

    .ybocs-section .extended-card {
        box-shadow: none !important;
        border: 0.5px solid #ddd !important;
        border-radius: 2mm;
        padding: 3mm;
        background: white !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .ybocs-section .extended-card-title {
        font-size: 8.5pt;
        margin-bottom: 1mm;
    }

    .ybocs-section .extended-card-desc {
        font-size: 6.8pt;
        line-height: 1.45;
        margin-bottom: 1.5mm;
    }

    .ybocs-section .aq-score-main {
        margin: 2mm 0;
    }

    .ybocs-section .aq-score-number {
        font-size: 22pt;
    }

    .ybocs-section .aq-score-number span {
        font-size: 8pt;
    }

    .ybocs-section .aq-score-meta {
        font-size: 6.5pt;
    }

    .ybocs-section .aq-score-meta strong {
        font-size: 9pt;
    }

    .ybocs-section .aq-intensity-track {
        height: 2mm;
        border: 0.4px solid #ddd;
    }

    .ybocs-section .risk-interp-text {
        font-size: 7pt;
        line-height: 1.5;
        margin-top: 1.5mm;
    }

    .ybocs-section .aq-note-list p {
        font-size: 7pt;
        line-height: 1.5;
        padding: 1.5mm 2mm;
        background: #fafafa !important;
    }

    .yb-subscales-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5mm;
        margin: 2mm 0 3mm;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .yb-subscale-card,
    .yb-insight-card {
        padding: 2.5mm !important;
    }

    .yb-subscale-number {
        font-size: 16pt;
    }

    .yb-subscale-number small,
    .yb-subscale-level {
        font-size: 6.5pt;
    }

    .yb-symptom-card {
        break-inside: auto !important;
        page-break-inside: auto !important;
        margin-top: 2mm;
    }

    .yb-primary-card {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-top: 2mm;
        padding: 2.5mm !important;
    }

    .yb-primary-tag {
        font-size: 6.5pt;
        padding: 0.5mm 1.5mm;
    }

    .yb-primary-group-title {
        font-size: 7.5pt;
        margin-bottom: 1mm;
    }

    .yb-symptom-summary {
        grid-template-columns: repeat(4, 1fr);
        gap: 2mm;
        margin: 2.5mm 0;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .yb-symptom-stat {
        padding: 2mm 2.2mm;
        border-radius: 1.5mm;
        background: #fffaf4 !important;
        border-color: #f3d4ad !important;
    }

    .yb-stat-label {
        font-size: 6.4pt;
        margin-bottom: 0.8mm;
    }

    .yb-symptom-stat strong {
        font-size: 16pt;
    }

    .yb-stat-total {
        font-size: 6.4pt;
    }

    .yb-category-notes {
        gap: 1.2mm;
        margin: 2mm 0 2.5mm;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .yb-category-note {
        grid-template-columns: 22mm 1fr;
        gap: 2mm;
        padding: 1.5mm 2mm;
        font-size: 6.8pt;
        line-height: 1.45;
        background: #fafafa !important;
        border-color: #e5e5e5 !important;
    }

    .yb-symptom-table-wrap {
        overflow: visible !important;
        border: 0.5px solid #ddd;
        border-radius: 1.5mm;
        break-inside: auto;
        page-break-inside: auto;
    }

    .yb-symptom-table {
        width: 100%;
        table-layout: fixed;
        font-size: 6.7pt;
        border-collapse: collapse;
    }

    .yb-symptom-table th {
        background: #fff3e5 !important;
        color: #7c2d12 !important;
        padding: 1.5mm 1mm;
        border-bottom: 0.5px solid #f0c28c;
        font-size: 6.5pt;
        line-height: 1.25;
    }

    .yb-symptom-table th:first-child {
        width: 39%;
        padding-left: 2mm;
    }

    .yb-symptom-table th small {
        font-size: 5.2pt;
        margin-top: 0.3mm;
    }

    .yb-symptom-table td {
        padding: 1.35mm 1mm;
        border-bottom: 0.4px solid #ececec;
        line-height: 1.3;
    }

    .yb-symptom-table tbody tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .yb-symptom-table tbody tr:nth-child(even) {
        background: #fffaf4 !important;
    }

    .yb-category-name {
        padding-left: 2mm !important;
        font-size: 6.8pt;
        line-height: 1.35;
        word-break: keep-all;
    }

    .yb-count-pill {
        min-width: 7mm;
        height: 4.5mm;
        padding: 0 1.5mm;
        font-size: 6.4pt;
        border-radius: 9mm;
    }

    .yb-count-pill.current { background: #fef3c7 !important; color: #92400e !important; }
    .yb-count-pill.past { background: #dbeafe !important; color: #1d4ed8 !important; }
    .yb-count-pill.both { background: #fee2e2 !important; color: #b91c1c !important; }
    .yb-muted-count,
    .yb-total-count {
        font-size: 6.7pt;
    }

    /* ---- Footnote ---- */
    .disclaimer { display: none !important; }

    /* ---- Page break helpers ---- */
    h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
    .scales-table tr, .index-card, .validity-card { page-break-inside: avoid; }
    /* 两张大卡片各自尽量不跨页，保持内容完整 */
    .screening-risk-card,
    .profile-match-card {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    .page-break-before { page-break-before: always; }
    .page-break-after { page-break-after: always; }
}

/* ============================================================
   Component Library — Toast Notifications
   Unified animation: toastIn / toastOut (replaces toastSlideIn/toastIn2)
   Variants: success / error / warning / info
   ============================================================ */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: var(--space-3) var(--space-5);
    font-size: var(--fs-sm);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 260px;
    max-width: 400px;
    animation: toastIn 0.3s ease;
    border-left: 4px solid var(--accent);
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info    { border-left-color: var(--accent); }

.toast.fade-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(30px); }
}

/* ============================================================
   Component Library — Modal Dialog
   Overlay + centered card · z-index token · focus-trap ready
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: var(--space-8);
    width: 100%;
    max-width: 440px;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h3 {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    color: var(--primary);
    margin-bottom: var(--space-5);
}

.modal-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    margin-top: var(--space-5);
}

/* ============================================
   Comprehensive Report Source Summary
   ============================================ */
.source-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.source-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.source-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.source-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 20px;
}

.source-date {
    font-size: 0.8rem;
    color: #6c757d;
}

.source-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.source-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.source-label {
    color: #6c757d;
    font-weight: 500;
}

.source-value {
    font-weight: 600;
    color: #212529;
}

.gec-score {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 700;
}

.gec-normal {
    background: #d4edda;
    color: #155724;
}

.gec-moderate {
    background: #fff3cd;
    color: #856404;
}

.gec-high {
    background: #f8d7da;
    color: #721c24;
}

.source-summary-footer {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #667eea;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #495057;
}

.source-summary-footer p {
    margin: 0;
}

/* ============================================
   Cross-form Comparison Modal
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #212529;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #6c757d;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e9ecef;
    color: #212529;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1rem 2rem;
    border-top: 2px solid #e9ecef;
    background: #f8f9fa;
}

/* Comparison Header */
.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
}

.comparison-badge {
    display: flex;
    gap: 1rem;
}

.badge-parent,
.badge-teacher {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.badge-parent {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-teacher {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.comparison-date {
    text-align: right;
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.6;
}

/* GEC Comparison Grid */
.comparison-summary {
    margin-bottom: 2rem;
}

.comparison-summary h4,
.comparison-details h4,
.comparison-interpretation h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gec-comparison-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: center;
}

.gec-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
}

.gec-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.parent-card {
    border-left: 4px solid #667eea;
}

.teacher-card {
    border-right: 4px solid #f5576c;
}

.gec-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.gec-value {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0.5rem 0;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-block;
}

.gec-normal { background: #d4edda; color: #155724; }
.gec-at-risk { background: #fff3cd; color: #856404; }
.gec-moderate { background: #ffeaa7; color: #856404; }
.gec-clinical { background: #f8d7da; color: #721c24; }

.gec-classification {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
    color: #495057;
}

.gec-diff-indicator {
    text-align: center;
    padding: 1rem;
}

.diff-arrow {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.diff-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.5rem;
}

.diff-significance {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    display: inline-block;
}

.diff-significance.significant {
    background: #fff3cd;
    color: #856404;
}

.diff-significance.not-significant {
    background: #d4edda;
    color: #155724;
}

/* Comparison Table */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.comparison-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.comparison-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.comparison-table td {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.95rem;
}

.comparison-table tbody tr:hover {
    background: #f8f9fa;
}

.parent-t {
    color: #667eea;
    font-weight: 700;
}

.teacher-t {
    color: #f5576c;
    font-weight: 700;
}

.diff-cell {
    font-weight: 700;
    font-size: 1rem;
}

.diff-cell.teacher-higher {
    color: #f5576c;
}

.diff-cell.parent-higher {
    color: #667eea;
}

.diff-cell.equal {
    color: #6c757d;
}

.consistency-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.consistency-badge.consistent {
    background: #d4edda;
    color: #155724;
}

.consistency-badge.inconsistent {
    background: #fff3cd;
    color: #856404;
}

/* Interpretation Section */
.comparison-interpretation {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #667eea;
    border-radius: 8px;
}

.interpretation-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.interpretation-content li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.8;
    color: #495057;
}

.interpretation-content li:before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.interpretation-content strong {
    color: #212529;
    font-weight: 700;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 1rem;
    }
    
    .modal-container {
        max-height: 95vh;
    }
    
    .comparison-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .comparison-date {
        text-align: center;
    }
    
    .gec-comparison-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .gec-diff-indicator {
        order: -1;
    }
    
    .comparison-table {
        font-size: 0.85rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* ============================================================
   Mobile Viewport Scaling - 移动端视口缩放（保持桌面布局）
   ============================================================ */
/* 注意：移动端缩放已通过 HTML meta viewport 标签实现
   initial-scale=0.75 使页面默认缩小到75%，用户可手动放大查看
   无需额外的 CSS transform 缩放 */

/* ============================================================
   PHQ-9 Report v3 — GUANXIN-style 视觉重设计
   对齐参考图：观心实验室风格，白底卡片、圆角、柔和阴影
   ============================================================ */
.phq9-v3 {
    --phq9-v3-radius: 14px;
    --phq9-v3-radius-sm: 8px;
    --phq9-v3-blue: #1e3a8a;
    --phq9-v3-red: #d32f2f;
    --phq9-v3-border: #e6e8ee;
    --phq9-v3-text: #1f2530;
    --phq9-v3-muted: #6b7280;
    --phq9-v3-bg: #f5f7fb;

    background: #ffffff;
    border: 1px solid var(--phq9-v3-border);
    border-radius: 18px;
    padding: 0;
    margin: 0 auto 1.6rem;
    overflow: hidden;
    max-width: 880px;
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--phq9-v3-text);
    line-height: 1.55;
}

/* ---------- Top brand bar ---------- */
.phq9-v3-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 1.9rem 1.4rem;
    background: linear-gradient(90deg, #1e3a8a 0%, #3b82f6 70%, #60a5fa 100%);
    color: #fff;
}
.phq9-v3-topbar.severe { background: linear-gradient(90deg, #7f1d1d 0%, #b91c1c 50%, #ef4444 100%); }
.phq9-v3-topbar.moderate_severe { background: linear-gradient(90deg, #9a3412 0%, #ea580c 50%, #fb923c 100%); }
.phq9-v3-topbar.moderate { background: linear-gradient(90deg, #b45309 0%, #f59e0b 50%, #fbbf24 100%); }
.phq9-v3-topbar.mild { background: linear-gradient(90deg, #a16207 0%, #ca8a04 50%, #facc15 100%); }
.phq9-v3-topbar.none { background: linear-gradient(90deg, #14532d 0%, #16a34a 50%, #4ade80 100%); }

.phq9-v3-topbar-title h1 {
    margin: 0 0 .25rem;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}
.phq9-v3-topbar-title p {
    margin: 0;
    font-size: 0.82rem;
    opacity: .9;
}
.phq9-v3-topbar-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .35rem .8rem .35rem .55rem;
    background: rgba(255,255,255,0.18);
    border-radius: 999px;
    backdrop-filter: blur(4px);
}
.phq9-v3-brand-heart {
    font-size: 1.6rem;
    color: #fff;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.2));
}
.phq9-v3-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}
.phq9-v3-brand-text strong {
    font-size: .9rem;
    font-weight: 800;
    letter-spacing: .3px;
}
.phq9-v3-brand-text span {
    font-size: .62rem;
    opacity: .85;
    letter-spacing: 1.2px;
}

/* ---------- Patient info card ---------- */
.phq9-v3-info {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    padding: 1rem 1.9rem 1.1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--phq9-v3-border);
}
.phq9-v3-info-col {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: 0 .8rem;
    border-right: 1px dashed #d6dbe5;
}
.phq9-v3-info-col:first-child { padding-left: 0; }
.phq9-v3-info-col:last-child { border-right: none; padding-right: 0; }
.phq9-v3-info-row {
    display: flex;
    align-items: baseline;
    gap: .55rem;
    font-size: .8rem;
    line-height: 1.55;
}
.phq9-v3-info-row label {
    color: var(--phq9-v3-muted);
    font-size: .72rem;
    min-width: 4em;
    flex-shrink: 0;
}
.phq9-v3-info-row span {
    color: var(--phq9-v3-text);
    font-weight: 600;
}
.phq9-v3-info-no {
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    color: #1e3a8a !important;
    font-size: .72rem !important;
    font-weight: 600 !important;
}

/* ---------- Generic card ---------- */
.phq9-v3-card {
    margin: 1rem 1.9rem;
    padding: 1.05rem 1.1rem 1.1rem;
    border: 1px solid var(--phq9-v3-border);
    border-radius: var(--phq9-v3-radius);
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(15,23,42,.03);
}
.phq9-v3-card-head {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin-bottom: .85rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid #eef0f5;
}
.phq9-v3-card-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: #fff;
    font-weight: 700;
    font-size: .78rem;
    flex-shrink: 0;
}
.phq9-v3-card-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--phq9-v3-text);
}
.phq9-v3-card-sub {
    font-size: .82rem;
    color: var(--phq9-v3-muted);
    font-weight: 500;
}

/* ---------- Gauge panel ---------- */
.phq9-v3-total-row {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 1.1rem;
}
.phq9-v3-gauge-panel {
    background: linear-gradient(180deg, #fafbff 0%, #f3f6fd 100%);
    border: 1px solid #e3e9f5;
    border-radius: 12px;
    padding: 1rem 1rem .85rem;
}
.phq9-v3-gauge-wrap {
    position: relative;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
}
.phq9-v3-gauge-svg { width: 100%; height: auto; display: block; }
.phq9-v3-tick-label {
    font-size: 9px;
    font-weight: 600;
    fill: #4b5563;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.phq9-v3-gauge-center {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
}
.phq9-v3-gauge-score {
    display: flex;
    align-items: baseline;
    gap: 2px;
    line-height: 1;
}
.phq9-v3-gauge-score strong {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
}
.phq9-v3-gauge-score small {
    font-size: 1rem;
    color: var(--phq9-v3-muted);
    font-weight: 600;
}
.phq9-v3-gauge-score.none strong, .phq9-v3-gauge-score.none small { color: #16a34a; }
.phq9-v3-gauge-score.mild strong, .phq9-v3-gauge-score.mild small { color: #ca8a04; }
.phq9-v3-gauge-score.moderate strong, .phq9-v3-gauge-score.moderate small { color: #f59e0b; }
.phq9-v3-gauge-score.moderate_severe strong, .phq9-v3-gauge-score.moderate_severe small { color: #ea580c; }
.phq9-v3-gauge-score.severe strong, .phq9-v3-gauge-score.severe small { color: #dc2626; }

.phq9-v3-gauge-pill {
    padding: .25rem .9rem;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    background: #4b5563;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.phq9-v3-gauge-pill.none { background: #16a34a; }
.phq9-v3-gauge-pill.mild { background: #ca8a04; }
.phq9-v3-gauge-pill.moderate { background: #f59e0b; }
.phq9-v3-gauge-pill.moderate_severe { background: #ea580c; }
.phq9-v3-gauge-pill.severe { background: #dc2626; }

/* Linear scale */
.phq9-v3-scale {
    margin-top: .4rem;
}
.phq9-v3-scale-bar {
    position: relative;
    display: flex;
    width: 100%;
    height: 12px;
    border-radius: 999px;
    overflow: visible;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}
.phq9-v3-scale-seg { height: 100%; }
.phq9-v3-scale-seg.none { background: rgba(34,197,94,.6); }
.phq9-v3-scale-seg.mild { background: rgba(202,138,4,.65); }
.phq9-v3-scale-seg.moderate { background: rgba(245,158,11,.65); }
.phq9-v3-scale-seg.moderate_severe { background: rgba(234,88,12,.65); }
.phq9-v3-scale-seg.severe { background: rgba(220,38,38,.65); }
.phq9-v3-scale-seg:first-child { border-radius: 999px 0 0 999px; }
.phq9-v3-scale-seg:last-child { border-radius: 0 999px 999px 0; }

.phq9-v3-scale-pin {
    position: absolute;
    top: -6px;
    width: 4px;
    height: 24px;
    background: #1f2937;
    border-radius: 2px;
    transform: translateX(-50%);
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.phq9-v3-scale-pin::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 3px solid #1f2937;
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 2px 5px rgba(0,0,0,.2);
}
.phq9-v3-scale-pin-label {
    position: absolute;
    top: -34px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}
.phq9-v3-scale-pin.none { background: #16a34a; }
.phq9-v3-scale-pin.mild { background: #ca8a04; }
.phq9-v3-scale-pin.moderate { background: #f59e0b; }
.phq9-v3-scale-pin.moderate_severe { background: #ea580c; }
.phq9-v3-scale-pin.severe { background: #dc2626; }
.phq9-v3-scale-pin.none::before, .phq9-v3-scale-pin.mild::before, .phq9-v3-scale-pin.moderate::before, .phq9-v3-scale-pin.moderate_severe::before, .phq9-v3-scale-pin.severe::before {
    border-color: inherit;
    background: #fff;
}

.phq9-v3-scale-labels {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin-top: .5rem;
    font-size: .7rem;
    text-align: center;
    color: var(--phq9-v3-muted);
}
.phq9-v3-scale-label {
    padding: .25rem .1rem;
    border-radius: 4px;
    line-height: 1.25;
}
.phq9-v3-scale-label strong {
    display: block;
    font-size: .65rem;
    font-weight: 600;
}
.phq9-v3-scale-label span {
    font-size: .72rem;
}
.phq9-v3-scale-label.active {
    background: rgba(30,58,138,.08);
    color: #1e3a8a;
    font-weight: 700;
}
.phq9-v3-scale-label.active strong,
.phq9-v3-scale-label.active span { color: #1e3a8a; }

/* ---------- Alert panel (right column) ---------- */
.phq9-v3-alert-panel {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.phq9-v3-alert-result {
    border-radius: 10px;
    padding: .9rem 1rem;
    border-left: 4px solid #f59e0b;
    background: linear-gradient(180deg, #fff7ed 0%, #fef3c7 100%);
}
.phq9-v3-alert-result.none { border-left-color: #16a34a; background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%); }
.phq9-v3-alert-result.mild { border-left-color: #ca8a04; background: linear-gradient(180deg, #fefce8 0%, #fef9c3 100%); }
.phq9-v3-alert-result.moderate { border-left-color: #f59e0b; background: linear-gradient(180deg, #fff7ed 0%, #fed7aa 100%); }
.phq9-v3-alert-result.moderate_severe { border-left-color: #ea580c; background: linear-gradient(180deg, #fff7ed 0%, #fed7aa 100%); }
.phq9-v3-alert-result.severe { border-left-color: #dc2626; background: linear-gradient(180deg, #fef2f2 0%, #fecaca 100%); }

.phq9-v3-alert-result-head {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .35rem;
}
.phq9-v3-alert-result-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: #f59e0b;
    color: #fff;
    font-weight: 800;
    font-size: .8rem;
}
.phq9-v3-alert-result.none .phq9-v3-alert-result-icon { background: #16a34a; }
.phq9-v3-alert-result.mild .phq9-v3-alert-result-icon { background: #ca8a04; }
.phq9-v3-alert-result.moderate .phq9-v3-alert-result-icon { background: #f59e0b; }
.phq9-v3-alert-result.moderate_severe .phq9-v3-alert-result-icon { background: #ea580c; }
.phq9-v3-alert-result.severe .phq9-v3-alert-result-icon { background: #dc2626; }
.phq9-v3-alert-result-head strong {
    font-size: .95rem;
    color: var(--phq9-v3-text);
}
.phq9-v3-alert-result p {
    margin: .35rem 0 0;
    font-size: .83rem;
    line-height: 1.6;
    color: var(--phq9-v3-text);
}
.phq9-v3-alert-result p strong { color: inherit; }
.phq9-v3-alert-result-suggest {
    margin-top: .65rem !important;
    padding-top: .55rem;
    border-top: 1px dashed rgba(0,0,0,.12);
}
.phq9-v3-alert-result-suggest strong { color: #1e3a8a; }

.phq9-v3-alert-safety {
    border: 1.5px dashed #dc2626;
    border-radius: 10px;
    padding: .85rem 1rem;
    background: #fef2f2;
}
.phq9-v3-alert-safety-head {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: #b91c1c;
    margin-bottom: .4rem;
}
.phq9-v3-alert-safety-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    background: #dc2626;
    color: #fff;
    border-radius: 50%;
    font-weight: 800;
    font-size: .9rem;
}
.phq9-v3-alert-safety-head strong {
    font-size: .95rem;
}
.phq9-v3-alert-safety p {
    margin: .25rem 0;
    font-size: .83rem;
    color: #7f1d1d;
    line-height: 1.55;
}
.phq9-v3-alert-safety-strong {
    margin-top: .55rem !important;
    color: #b91c1c !important;
    font-weight: 600;
}

/* ---------- Section 2: Symptom table ---------- */
.phq9-v3-table-wrap { overflow: hidden; }
.phq9-v3-symptom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .85rem;
    table-layout: fixed;
}
.phq9-v3-symptom-table thead th {
    background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #475569;
    font-weight: 700;
    font-size: .78rem;
    padding: .7rem .85rem;
    border-bottom: 1px solid #cbd5e1;
    text-align: left;
}
.phq9-v3-th-num { width: 60px; text-align: center !important; }
.phq9-v3-th-score { width: 70px; text-align: center !important; }
.phq9-v3-th-freq { width: 160px; text-align: center !important; }
.phq9-v3-symptom-table tbody td {
    padding: .75rem .85rem;
    border-bottom: 1px solid #eef0f5;
    color: var(--phq9-v3-text);
    vertical-align: middle;
}
.phq9-v3-td-num {
    text-align: center;
    font-weight: 700;
    color: #475569;
    position: relative;
}
.phq9-v3-danger-star {
    color: #dc2626;
    margin-right: 2px;
    font-size: 1rem;
}
.phq9-v3-td-score { text-align: center; }
.phq9-v3-tbl-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    font-weight: 800;
    font-size: .9rem;
    background: #e2e8f0;
    color: #64748b;
}
.phq9-v3-tbl-score.s0 { background: #e2e8f0; color: #64748b; }
.phq9-v3-tbl-score.s1 { background: #fde68a; color: #92400e; }
.phq9-v3-tbl-score.s2 { background: #fdba74; color: #9a3412; }
.phq9-v3-tbl-score.s3 { background: #fca5a5; color: #b91c1c; }
.phq9-v3-row-danger {
    background: linear-gradient(90deg, rgba(220,38,38,.06) 0%, rgba(220,38,38,.02) 100%) !important;
}
.phq9-v3-row-danger td:first-child {
    border-left: 3px solid #dc2626;
    color: #b91c1c !important;
}
.phq9-v3-table-note {
    margin: .8rem 0 0;
    padding-top: .6rem;
    border-top: 1px dashed #e2e8f0;
    font-size: .76rem;
    color: var(--phq9-v3-muted);
}
.phq9-v3-table-note span {
    color: var(--phq9-v3-text);
    font-weight: 500;
}

/* ---------- Section 3: Score interpretation ---------- */
.phq9-v3-ref-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .55rem;
}
.phq9-v3-ref-card {
    border: 1px solid var(--phq9-v3-border);
    border-radius: 10px;
    padding: .7rem .55rem .75rem;
    text-align: center;
    background: #fff;
    transition: all .2s;
}
.phq9-v3-ref-card.none { border-top: 3px solid #16a34a; }
.phq9-v3-ref-card.mild { border-top: 3px solid #ca8a04; }
.phq9-v3-ref-card.moderate { border-top: 3px solid #f59e0b; }
.phq9-v3-ref-card.moderate_severe { border-top: 3px solid #ea580c; }
.phq9-v3-ref-card.severe { border-top: 3px solid #dc2626; }
.phq9-v3-ref-card.active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15,23,42,.08);
}
.phq9-v3-ref-card.none.active { background: linear-gradient(180deg, #f0fdf4 0%, #fff 60%); }
.phq9-v3-ref-card.mild.active { background: linear-gradient(180deg, #fefce8 0%, #fff 60%); }
.phq9-v3-ref-card.moderate.active { background: linear-gradient(180deg, #fff7ed 0%, #fff 60%); }
.phq9-v3-ref-card.moderate_severe.active { background: linear-gradient(180deg, #fff7ed 0%, #fff 60%); }
.phq9-v3-ref-card.severe.active { background: linear-gradient(180deg, #fef2f2 0%, #fff 60%); }

.phq9-v3-ref-range {
    font-size: .85rem;
    font-weight: 700;
    color: #1e3a8a;
    background: #f1f5f9;
    border-radius: 6px;
    padding: .2rem .3rem;
    margin-bottom: .5rem;
}
.phq9-v3-ref-level {
    font-size: .85rem;
    font-weight: 700;
    margin-bottom: .25rem;
}
.phq9-v3-ref-card.none .phq9-v3-ref-level { color: #16a34a; }
.phq9-v3-ref-card.mild .phq9-v3-ref-level { color: #ca8a04; }
.phq9-v3-ref-card.moderate .phq9-v3-ref-level { color: #f59e0b; }
.phq9-v3-ref-card.moderate_severe .phq9-v3-ref-level { color: #ea580c; }
.phq9-v3-ref-card.severe .phq9-v3-ref-level { color: #dc2626; }
.phq9-v3-ref-desc {
    font-size: .72rem;
    color: var(--phq9-v3-muted);
    line-height: 1.45;
}

/* ---------- Section 4: Next steps list ---------- */
.phq9-v3-next-list {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.phq9-v3-next-item {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .7rem .85rem;
    border: 1px solid var(--phq9-v3-border);
    border-radius: 10px;
    background: #fafbff;
    transition: all .2s;
}
.phq9-v3-next-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.phq9-v3-next-item.urgent {
    background: linear-gradient(90deg, #fef2f2 0%, #fff 50%);
    border-color: rgba(220,38,38,.35);
}
.phq9-v3-next-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #dbeafe, #93c5fd);
    color: #1e3a8a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .95rem;
    box-shadow: 0 1px 3px rgba(30,58,138,.18);
}
.phq9-v3-next-item.urgent .phq9-v3-next-icon {
    background: linear-gradient(135deg, #fecaca, #f87171);
    color: #7f1d1d;
    box-shadow: 0 1px 3px rgba(220,38,38,.25);
}
.phq9-v3-next-icon[data-icon="doc"]::before  { content: "📋"; }
.phq9-v3-next-icon[data-icon="check"]::before { content: "✓"; }
.phq9-v3-next-icon[data-icon="people"]::before{ content: "👥"; }
.phq9-v3-next-icon[data-icon="shield"]::before{ content: "🛡"; }
.phq9-v3-next-icon[data-icon="chart"]::before { content: "📈"; }
.phq9-v3-next-body { flex: 1; min-width: 0; }
.phq9-v3-next-body strong {
    display: block;
    font-size: .9rem;
    color: var(--phq9-v3-text);
    margin-bottom: .15rem;
}
.phq9-v3-next-body p {
    margin: 0;
    font-size: .8rem;
    color: var(--phq9-v3-muted);
    line-height: 1.55;
}

/* ---------- Section 5: Emergency resources ---------- */
.phq9-v3-emergency {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .65rem;
}
.phq9-v3-emergency-desc {
    grid-column: 1 / -1;
    margin: 0 0 .25rem;
    font-size: .83rem;
    color: var(--phq9-v3-text);
}
.phq9-v3-emergency-list {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .65rem;
}
.phq9-v3-emergency-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .8rem .85rem;
    background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid #fdba74;
    border-radius: 10px;
}
.phq9-v3-emergency-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 5px rgba(220,38,38,.3);
}
.phq9-v3-emergency-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}
.phq9-v3-emergency-label {
    font-size: .7rem;
    color: #7c2d12;
    font-weight: 600;
}
.phq9-v3-emergency-num {
    font-size: 1rem;
    font-weight: 800;
    color: #b91c1c;
    letter-spacing: .5px;
}
.phq9-v3-emergency-hours {
    font-size: .62rem;
    color: #7c2d12;
    opacity: .8;
}
.phq9-v3-emergency-tip {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .8rem .95rem;
    background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    margin-top: .25rem;
}
.phq9-v3-emergency-tip-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    color: #f59e0b;
}
.phq9-v3-emergency-tip strong {
    font-size: .85rem;
    color: #92400e;
    display: block;
    margin-bottom: .15rem;
}
.phq9-v3-emergency-tip p {
    margin: 0;
    font-size: .78rem;
    color: #78350f;
    line-height: 1.55;
}

/* ---------- Footer ---------- */
.phq9-v3-footer {
    padding: .85rem 1.9rem 1.1rem;
    border-top: 1px dashed #e2e8f0;
    margin-top: .25rem;
}
.phq9-v3-sign-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: .5rem 0 .85rem;
}
.phq9-v3-sign-col {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.phq9-v3-sign-label {
    font-size: .72rem;
    color: var(--phq9-v3-muted);
}
.phq9-v3-sign-line {
    display: block;
    border-bottom: 1px solid #94a3b8;
    height: 1.6rem;
}
.phq9-v3-disclaimer {
    margin: 0;
    font-size: .72rem;
    color: var(--phq9-v3-muted);
    line-height: 1.6;
    padding-top: .55rem;
    border-top: 1px dashed #e2e8f0;
}
.phq9-v3-disclaimer strong { color: var(--phq9-v3-text); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .phq9-v3-info { grid-template-columns: 1fr; padding: .85rem 1.1rem; gap: .35rem; }
    .phq9-v3-info-col {
        padding: .25rem 0;
        border-right: none;
        border-bottom: 1px dashed #d6dbe5;
    }
    .phq9-v3-info-col:last-child { border-bottom: none; }
    .phq9-v3-topbar { flex-direction: column; align-items: flex-start; gap: .65rem; padding: 1.1rem 1.2rem; }
    .phq9-v3-topbar-title h1 { font-size: 1.25rem; }
    .phq9-v3-card { margin: .8rem 1rem; padding: .85rem .8rem .9rem; }
    .phq9-v3-total-row { grid-template-columns: 1fr; }
    .phq9-v3-ref-grid { grid-template-columns: repeat(2, 1fr); }
    .phq9-v3-emergency { grid-template-columns: 1fr; }
    .phq9-v3-emergency-list { grid-template-columns: 1fr; }
    .phq9-v3-sign-row { grid-template-columns: 1fr; gap: .65rem; }
}

@media (max-width: 480px) {
    .phq9-v3-scale-labels { font-size: .62rem; }
    .phq9-v3-symptom-table th, .phq9-v3-symptom-table td { padding: .55rem .45rem; font-size: .78rem; }
    .phq9-v3-th-freq { width: 110px; }
    .phq9-v3-gauge-score strong { font-size: 2.4rem; }
}

/* ---------- Print ---------- */
@media print {
    .phq9-v3 { box-shadow: none; }
    .phq9-v3-topbar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .phq9-v3-gauge-svg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .phq9-v3-scale-seg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .phq9-v3-alert-result,
    .phq9-v3-alert-safety,
    .phq9-v3-emergency-item,
    .phq9-v3-emergency-tip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .phq9-v3-next-icon { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================
/* ============================================================
   PHQ-9 GUANXIN style inside A4 page (v5)
   ============================================================ */

/* v3 component strip: fill the A4 page, no outer chrome */
.phq9-a4-page .phq9-v3-a4 {
    max-width: none;
    width: 100%;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    font-size: 13px;
}

/* A4 page reset for GUANXIN mode */
.phq9-a4-page.phq9-gx {
    padding: 0;
    overflow: hidden;
}
.phq9-a4-page.phq9-gx .phq9-v3-a4 {
    padding: 0;
}

/* Compact spacing for A4 density */
.phq9-a4-page .phq9-v3-card {
    margin-bottom: 12px;
}
.phq9-a4-page .phq9-v3-info {
    padding: 10px 18px;
}
.phq9-a4-page .phq9-v3-card-head {
    margin-bottom: 10px;
}

/* Screen: on narrow viewports, let page shrink instead of overflow */
@media screen and (max-width: 900px) {
    .phq9-a4-page.phq9-gx {
        width: 100%;
        min-height: 0;
        margin: 8px auto;
        box-shadow: 0 2px 12px rgba(0,0,0,0.10);
    }
}

/* Print */
@media print {
    .phq9-a4-page.phq9-gx {
        width: 210mm;
        min-height: 297mm;
        margin: 0;
        padding: 0;
        box-shadow: none;
        box-sizing: border-box;
        page-break-after: always;
    }
    .phq9-a4-page.phq9-gx:last-child {
        page-break-after: auto;
    }
    .phq9-a4-page .phq9-v3-a4,
    .phq9-a4-page .phq9-v3-topbar,
    .phq9-a4-page .phq9-v3-gauge-svg,
    .phq9-a4-page .phq9-v3-scale-seg,
    .phq9-a4-page .phq9-v3-alert-result,
    .phq9-a4-page .phq9-v3-alert-safety,
    .phq9-a4-page .phq9-v3-ref-card,
    .phq9-a4-page .phq9-v3-next-icon,
    .phq9-a4-page .phq9-v3-emergency-item,
    .phq9-a4-page .phq9-v3-emergency-tip {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .phq9-a4-page .phq9-v3-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ============================================================
   PHQ-9 A4 Clinical Report (v4)
   A4-first, clinical/medical report style
   ============================================================ */

.phq9-a4-wrap {
    margin: 0;
    padding: 0;
}

/* A4 Page — screen view */
.phq9-a4-page {
    width: 210mm;
    min-height: 297mm;
    box-sizing: border-box;
    padding: 14mm 15mm 12mm;
    margin: 24px auto;
    background: #ffffff;
    color: #1a1f2e;
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 11pt;
    line-height: 1.55;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    position: relative;
}

/* Header */
.phq9-a4-header {
    text-align: center;
    border-bottom: 2px solid #1e3a5f;
    padding-bottom: 8px;
    margin-bottom: 14px;
}
.phq9-a4-title {
    font-size: 18pt;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0 0 4px 0;
    letter-spacing: 1px;
}
.phq9-a4-subtitle {
    font-size: 9.5pt;
    color: #5a6478;
    margin: 0;
    letter-spacing: 0.3px;
}

/* Patient info table */
.phq9-a4-info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 10pt;
}
.phq9-a4-info-table th {
    background: #f0f4f9;
    color: #1e3a5f;
    font-weight: 600;
    text-align: right;
    padding: 6px 10px;
    border: 1px solid #c8d1de;
    width: 65px;
    white-space: nowrap;
}
.phq9-a4-info-table td {
    padding: 6px 10px;
    border: 1px solid #c8d1de;
    color: #1a1f2e;
}
.phq9-a4-mono {
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    font-size: 9.5pt;
    color: #1e3a5f;
    letter-spacing: 0.3px;
}

/* Sections */
.phq9-a4-section {
    margin-bottom: 14px;
}
.phq9-a4-sec-title {
    font-size: 12.5pt;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0 0 8px 0;
    padding-bottom: 5px;
    border-bottom: 1.5px solid #1e3a5f;
}
.phq9-a4-sec-num {
    color: #1e3a5f;
    font-weight: 700;
}
.phq9-a4-sec-sub {
    font-size: 9.5pt;
    color: #5a6478;
    font-weight: 400;
}
.phq9-a4-sub-title {
    font-size: 10.5pt;
    font-weight: 600;
    color: #2d3e55;
    margin: 10px 0 6px 0;
}

/* Section 1: Total result */
.phq9-a4-total-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.phq9-a4-gauge-col {
    flex: 0 0 45%;
    max-width: 45%;
}
.phq9-a4-result-col {
    flex: 1;
    min-width: 0;
}

/* Gauge */
.phq9-a4-gauge {
    position: relative;
    width: 100%;
    max-width: 260px;
    margin: 0 auto 4px;
}
.phq9-a4-gauge-svg {
    width: 100%;
    height: auto;
    display: block;
}
.phq9-a4-tick-text {
    font-size: 9px;
    fill: #5a6478;
    font-family: "Noto Sans SC", "PingFang SC", sans-serif;
}
.phq9-a4-gauge-center {
    position: absolute;
    top: 62%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.phq9-a4-gauge-score {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    line-height: 1;
}
.phq9-a4-score-num {
    font-size: 30pt;
    font-weight: 700;
}
.phq9-a4-score-max {
    font-size: 12pt;
    color: #8a93a6;
    font-weight: 500;
}
.phq9-a4-score-num.none { color: #2e7d32; }
.phq9-a4-score-num.mild { color: #f9a825; }
.phq9-a4-score-num.moderate { color: #ef6c00; }
.phq9-a4-score-num.moderate_severe { color: #d84315; }
.phq9-a4-score-num.severe { color: #b71c1c; }

.phq9-a4-gauge-label {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 9.5pt;
    font-weight: 600;
    color: #fff;
}
.phq9-a4-gauge-label.none { background: #2e7d32; }
.phq9-a4-gauge-label.mild { background: #f9a825; }
.phq9-a4-gauge-label.moderate { background: #ef6c00; }
.phq9-a4-gauge-label.moderate_severe { background: #d84315; }
.phq9-a4-gauge-label.severe { background: #b71c1c; }

/* Linear scale */
.phq9-a4-linear-scale {
    margin-top: 4px;
}
.phq9-a4-scale-bar {
    position: relative;
    display: flex;
    height: 10px;
    border-radius: 0;
    overflow: visible;
}
.phq9-a4-scale-seg {
    height: 100%;
}
.phq9-a4-scale-seg.none { background: #2e7d32; }
.phq9-a4-scale-seg.mild { background: #f9a825; }
.phq9-a4-scale-seg.moderate { background: #ef6c00; }
.phq9-a4-scale-seg.moderate_severe { background: #d84315; }
.phq9-a4-scale-seg.severe { background: #b71c1c; }

.phq9-a4-scale-marker {
    position: absolute;
    top: -3px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 7px solid #1a1f2e;
    transform: translateX(-50%);
}
.phq9-a4-scale-marker-val {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1f2e;
    color: #fff;
    font-size: 8pt;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 2px;
    white-space: nowrap;
}

.phq9-a4-scale-labels {
    display: flex;
    margin-top: 18px;
    font-size: 8pt;
}
.phq9-a4-scale-label {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    color: #5a6478;
}
.phq9-a4-scale-label b {
    font-weight: 700;
    font-size: 8.5pt;
    color: #2d3e55;
}
.phq9-a4-scale-label i {
    font-style: normal;
    font-size: 7.5pt;
    margin-top: 1px;
}
.phq9-a4-scale-label.on {
    color: #1e3a5f;
    font-weight: 600;
}
.phq9-a4-scale-label.on b { color: #1e3a5f; }
.phq9-a4-scale-label.on i { color: #1e3a5f; font-weight: 600; }

/* Result column */
.phq9-a4-result-title {
    font-size: 11pt;
    font-weight: 600;
    color: #1e3a5f;
    margin: 0 0 6px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid #d0d8e4;
}
.phq9-a4-result-text {
    font-size: 10pt;
    line-height: 1.6;
    color: #2d3e55;
    margin: 0 0 8px 0;
    text-align: justify;
}
.phq9-a4-result-key {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px dashed #e0e5ed;
    font-size: 10pt;
}
.phq9-a4-key-label {
    color: #5a6478;
    min-width: 60px;
}
.phq9-a4-key-val {
    color: #1a1f2e;
    font-weight: 500;
}
.phq9-a4-sev-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 2px;
    color: #fff;
    font-weight: 600;
    font-size: 9pt;
}
.phq9-a4-sev-tag.none { background: #2e7d32; }
.phq9-a4-sev-tag.mild { background: #f9a825; }
.phq9-a4-sev-tag.moderate { background: #ef6c00; }
.phq9-a4-sev-tag.moderate_severe { background: #d84315; }
.phq9-a4-sev-tag.severe { background: #b71c1c; }

/* Safety box */
.phq9-a4-safety-box {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1.5px solid #dc2626;
    background: #fef2f2;
    border-radius: 2px;
    font-size: 9.5pt;
    line-height: 1.55;
}
.phq9-a4-safety-title {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #dc2626;
    margin-bottom: 4px;
}
.phq9-a4-safety-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #dc2626;
    color: #fff;
    border-radius: 50%;
    font-size: 10pt;
    font-weight: 700;
    line-height: 1;
}
.phq9-a4-safety-box p {
    margin: 3px 0;
    color: #1a1f2e;
}
.phq9-a4-safety-strong {
    font-weight: 600;
    color: #dc2626;
}

/* Symptom table */
.phq9-a4-symptom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
}
.phq9-a4-symptom-table th {
    background: #f0f4f9;
    color: #1e3a5f;
    font-weight: 600;
    padding: 7px 8px;
    border: 1px solid #c8d1de;
    text-align: left;
}
.phq9-a4-symptom-table td {
    padding: 6px 8px;
    border: 1px solid #c8d1de;
    color: #1a1f2e;
    vertical-align: middle;
}
.phq9-a4-symptom-table tbody tr:nth-child(even) {
    background: #fafbfd;
}
.phq9-a4-symptom-table tr.row-alert {
    background: #fef2f2 !important;
}
.phq9-a4-symptom-table tr.row-alert td {
    color: #991b1b;
}
.phq9-a4-alert-mark {
    color: #dc2626;
    font-size: 9pt;
    margin-right: 2px;
}
.phq9-a4-score {
    font-size: 11pt;
    font-weight: 700;
}
.phq9-a4-score.s0 { color: #6b7280; }
.phq9-a4-score.s1 { color: #ca8a04; }
.phq9-a4-score.s2 { color: #ea580c; }
.phq9-a4-score.s3 { color: #dc2626; }

.phq9-a4-table-note {
    margin: 6px 0 0 0;
    font-size: 8.5pt;
    color: #5a6478;
    text-align: right;
}

.text-center { text-align: center !important; }

/* Reference table */
.phq9-a4-ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
}
.phq9-a4-ref-table th {
    background: #f0f4f9;
    color: #1e3a5f;
    font-weight: 600;
    padding: 7px 8px;
    border: 1px solid #c8d1de;
    text-align: center;
}
.phq9-a4-ref-table td {
    padding: 6px 8px;
    border: 1px solid #c8d1de;
    color: #1a1f2e;
}
.phq9-a4-ref-table tbody tr:nth-child(even) {
    background: #fafbfd;
}
.phq9-a4-ref-table tr.row-active {
    background: #eff6ff !important;
    border: 2px solid #1e3a5f;
}
.phq9-a4-ref-table tr.row-active td {
    font-weight: 600;
}
.phq9-a4-ref-level {
    font-weight: 600;
}
.phq9-a4-ref-table tr.none .phq9-a4-ref-level { color: #2e7d32; }
.phq9-a4-ref-table tr.mild .phq9-a4-ref-level { color: #ca8a04; }
.phq9-a4-ref-table tr.moderate .phq9-a4-ref-level { color: #ea580c; }
.phq9-a4-ref-table tr.moderate_severe .phq9-a4-ref-level { color: #d84315; }
.phq9-a4-ref-table tr.severe .phq9-a4-ref-level { color: #b71c1c; }

/* Extra question table */
.phq9-a4-extra-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9.5pt;
}
.phq9-a4-extra-table th {
    background: #f0f4f9;
    color: #1e3a5f;
    font-weight: 600;
    padding: 6px 8px;
    border: 1px solid #c8d1de;
    text-align: center;
}
.phq9-a4-extra-table td {
    padding: 5px 8px;
    border: 1px solid #c8d1de;
    color: #1a1f2e;
}
.phq9-a4-extra-table tbody tr:nth-child(even) {
    background: #fafbfd;
}
.phq9-a4-extra-table tr.row-alert {
    background: #fef2f2 !important;
}
.phq9-a4-extra-table tr.row-warn {
    background: #fffbeb !important;
}

/* Clinical indicators */
.phq9-a4-indicators {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 4px;
}
.phq9-a4-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid #d0d8e4;
    border-radius: 2px;
    background: #fafbfd;
    font-size: 9pt;
}
.phq9-a4-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    flex-shrink: 0;
}
.phq9-a4-indicator-text {
    flex: 1;
    color: #5a6478;
    min-width: 0;
}
.phq9-a4-indicator-val {
    font-weight: 600;
    color: #5a6478;
    flex-shrink: 0;
}
.phq9-a4-indicator.on {
    border-color: #dc2626;
    background: #fef2f2;
}
.phq9-a4-indicator.on .phq9-a4-indicator-dot {
    background: #dc2626;
}
.phq9-a4-indicator.on .phq9-a4-indicator-text {
    color: #991b1b;
    font-weight: 600;
}
.phq9-a4-indicator.on .phq9-a4-indicator-val {
    color: #dc2626;
}

/* Clinical notes */
.phq9-a4-clinical-notes {
    margin-top: 8px;
    padding: 6px 10px;
    background: #f8fafc;
    border-left: 3px solid #1e3a5f;
    font-size: 9.5pt;
}
.phq9-a4-clinical-notes-title {
    margin: 0 0 4px 0;
    font-weight: 600;
    color: #1e3a5f;
}
.phq9-a4-clinical-notes ul {
    margin: 0;
    padding-left: 18px;
    color: #2d3e55;
}
.phq9-a4-clinical-notes li {
    margin: 2px 0;
    line-height: 1.5;
}

/* Recommendation list */
.phq9-a4-rec-list {
    margin: 0;
    padding-left: 22px;
    font-size: 10pt;
    line-height: 1.6;
    color: #2d3e55;
}
.phq9-a4-rec-list li {
    margin-bottom: 4px;
}
.phq9-a4-rec-list strong {
    color: #1e3a5f;
}

/* Emergency section */
.phq9-a4-emergency-lead {
    font-size: 10pt;
    color: #2d3e55;
    margin: 0 0 8px 0;
}
.phq9-a4-emergency-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
}
.phq9-a4-emergency-table td {
    padding: 8px 10px;
    border: 1px solid #c8d1de;
    vertical-align: middle;
}
.phq9-a4-emergency-icon-col {
    width: 32px;
    text-align: center;
    font-size: 13pt;
    color: #dc2626;
}
.phq9-a4-emergency-num {
    width: 130px;
    text-align: center;
}
.phq9-a4-emergency-num b {
    font-size: 12pt;
    color: #dc2626;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.phq9-a4-emergency-hours {
    width: 70px;
    text-align: center;
    color: #5a6478;
    font-size: 9pt;
}

/* Footer */
.phq9-a4-footer {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #c8d1de;
}
.phq9-a4-sign-row {
    display: flex;
    gap: 30px;
    margin-bottom: 12px;
}
.phq9-a4-sign-col {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 6px;
}
.phq9-a4-sign-label {
    font-size: 9.5pt;
    color: #2d3e55;
    white-space: nowrap;
    flex-shrink: 0;
}
.phq9-a4-sign-line {
    flex: 1;
    border-bottom: 1px solid #2d3e55;
    height: 18px;
}
.phq9-a4-disclaimer {
    font-size: 8.5pt;
    color: #5a6478;
    line-height: 1.55;
    margin-bottom: 6px;
}
.phq9-a4-disclaimer p {
    margin: 3px 0;
}
.phq9-a4-disclaimer strong {
    color: #2d3e55;
}
.phq9-a4-score-note {
    font-size: 8pt;
    color: #6b7280;
}
.phq9-a4-brand-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 8pt;
    color: #8a93a6;
    border-top: 1px solid #e0e5ed;
    padding-top: 6px;
    margin-top: 4px;
}

/* ========== Print styles ========== */
@media print {
    .phq9-a4-wrap { margin: 0; padding: 0; }

    .phq9-a4-page {
        width: 210mm;
        min-height: 297mm;
        margin: 0;
        padding: 14mm 15mm 12mm;
        box-shadow: none;
        box-sizing: border-box;
        page-break-after: always;
    }
    .phq9-a4-page:last-child {
        page-break-after: auto;
    }

    /* Ensure all colored elements print correctly */
    .phq9-a4-gauge-label,
    .phq9-a4-sev-tag,
    .phq9-a4-scale-seg,
    .phq9-a4-scale-marker,
    .phq9-a4-scale-marker-val,
    .phq9-a4-safety-box,
    .phq9-a4-safety-icon,
    .phq9-a4-indicator.on,
    .phq9-a4-indicator-dot,
    .phq9-a4-emergency-num b,
    .phq9-a4-info-table th,
    .phq9-a4-symptom-table th,
    .phq9-a4-ref-table th,
    .phq9-a4-extra-table th,
    .phq9-a4-score {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .phq9-a4-gauge-svg {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* No toolbar / UI elements on print */
    .no-print-toolbar,
    .no-print {
        display: block !important;
    }
}

@page {
    size: A4 portrait;
    margin: 0;
}



/* ============================================================
   PHQ-9 Element-Sliced Report (v6) — replicates reference design
   Palette: page #F8FAFC / card #FFF / border #E2E8F0 / title blue
   #1E40AF / severity #22C55E #84CC16 #EAB308 #F97316 #DC2626
   ============================================================ */

.phq9-el-wrap { width: 100%; max-width: none; }

.phq9-el-a4 {
    width: 210mm;
    min-height: 297mm;
    box-sizing: border-box;
    padding: 11mm 12mm 10mm;
    margin: 24px auto;
    background: #F8FAFC;
    color: #374151;
    font-size: 12.5px;
    line-height: 1.6;
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
}

/* ---------- Slice 1: Header ---------- */
.el-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid #E2E8F0;
    margin-bottom: 14px;
}
.el-header-title h1 {
    margin: 0 0 3px;
    font-size: 20px;
    font-weight: 700;
    color: #1A365D;
    letter-spacing: 0.5px;
}
.el-header-title p {
    margin: 0;
    font-size: 11px;
    color: #6B7280;
}
.el-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding-top: 2px;
}
.el-brand-heart { width: 30px; height: 30px; }
.el-brand-text strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #2563EB;
    line-height: 1.2;
}
.el-brand-text span {
    display: block;
    font-size: 10px;
    color: #6B7280;
}

/* ---------- Slice 2: Patient info card ---------- */
.el-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 26px;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 14px;
}
.el-info-item { display: flex; align-items: baseline; }
.el-info-item label {
    color: #6B7280;
    font-size: 11.5px;
    flex-shrink: 0;
}
.el-info-item span {
    color: #1F2937;
    font-size: 12.5px;
    font-weight: 500;
    min-width: 0;
}
.el-info-no {
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
    font-size: 10.5px;
}

/* ---------- Card shell ---------- */
.el-card {
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 13px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.el-card-head {
    margin: 0 0 11px;
    font-size: 14.5px;
    font-weight: 700;
    color: #1E40AF;
}
.el-card-sub {
    font-size: 11px;
    font-weight: 400;
    color: #6B7280;
}

/* ---------- Slice 3: Overall result ---------- */
.el-total-row { display: flex; gap: 20px; align-items: flex-start; }
.el-gauge-panel { flex: 0 0 52%; max-width: 52%; }
.el-result-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.el-gauge { position: relative; width: 100%; max-width: 300px; margin: 0 auto; }
.el-gauge-svg { width: 100%; height: auto; display: block; }
.el-tick { font-size: 10px; fill: #6B7280; font-family: "Noto Sans SC", "PingFang SC", sans-serif; }

.el-gauge-center {
    position: absolute;
    left: 50%;
    top: 60%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.el-score { display: flex; align-items: baseline; justify-content: center; gap: 2px; line-height: 1; }
.el-score-num { font-size: 34px; font-weight: 800; }
.el-score small { font-size: 13px; color: #9CA3AF; font-weight: 400; }
.el-score-num.none { color: #16A34A; }
.el-score-num.mild { color: #65A30D; }
.el-score-num.moderate { color: #CA8A04; }
.el-score-num.moderate_severe { color: #EA580C; }
.el-score-num.severe { color: #DC2626; }

.el-pill {
    display: inline-block;
    margin-top: 5px;
    padding: 3px 14px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    color: #fff;
}
.el-pill.none { background: #16A34A; }
.el-pill.mild { background: #65A30D; }
.el-pill.moderate { background: #CA8A04; }
.el-pill.moderate_severe { background: #EA580C; }
.el-pill.severe { background: #DC2626; }

/* Linear scale under gauge */
.el-lscale { margin-top: 4px; padding: 0 2px; }
.el-lscale-bar { position: relative; display: flex; height: 9px; border-radius: 4px; overflow: visible; }
.el-seg { height: 100%; }
.el-seg:first-child { border-radius: 4px 0 0 4px; }
.el-seg:last-child { border-radius: 0 4px 4px 0; }
.el-seg.none { background: #22C55E; }
.el-seg.mild { background: #84CC16; }
.el-seg.moderate { background: #EAB308; }
.el-seg.moderate_severe { background: #F97316; }
.el-seg.severe { background: #DC2626; }

.el-lscale-pin {
    position: absolute;
    top: -4px;
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid #1F2937;
    transform: translateX(-50%);
}
.el-lscale-pin span {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 0 5px;
    border-radius: 3px;
    white-space: nowrap;
}
.el-lscale-labels { display: flex; margin-top: 20px; }
.el-lscale-label {
    flex: 1;
    text-align: center;
    line-height: 1.25;
    color: #6B7280;
}
.el-lscale-label b { display: block; font-size: 10px; font-weight: 700; color: #374151; }
.el-lscale-label i { display: block; font-style: normal; font-size: 9.5px; }
.el-lscale-label.active b, .el-lscale-label.active i { font-weight: 700; }
.el-lscale-label.active.none b, .el-lscale-label.active.none i { color: #16A34A; }
.el-lscale-label.active.mild b, .el-lscale-label.active.mild i { color: #65A30D; }
.el-lscale-label.active.moderate b, .el-lscale-label.active.moderate i { color: #CA8A04; }
.el-lscale-label.active.moderate_severe b, .el-lscale-label.active.moderate_severe i { color: #EA580C; }
.el-lscale-label.active.severe b, .el-lscale-label.active.severe i { color: #DC2626; }

/* Result tip */
.el-tip {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 12px 14px;
}
.el-tip-icon {
    flex-shrink: 0;
    width: 28px; height: 28px;
    border-radius: 999px;
    background: #FEE2E2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.el-tip-icon svg { width: 15px; height: 15px; }
.el-tip-body strong { display: block; font-size: 13px; font-weight: 700; color: #DC2626; margin-bottom: 3px; }
.el-tip-body p { margin: 0 0 4px; font-size: 12px; color: #374151; line-height: 1.65; }
.el-tip-body p.el-tip-suggest { margin: 0; }
.el-red { color: #DC2626; }

/* Safety box */
.el-safety {
    background: #FEF2F2;
    border: 1.5px dashed #FCA5A5;
    border-radius: 10px;
    padding: 12px 14px;
}
.el-safety-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.el-safety-head svg { width: 18px; height: 18px; flex-shrink: 0; }
.el-safety-head strong { font-size: 13px; font-weight: 700; color: #B91C1C; }
.el-safety p { margin: 0 0 3px; font-size: 12px; color: #374151; line-height: 1.65; }
.el-safety-link { font-weight: 600; color: #DC2626; margin: 0; }

/* ---------- Tables ---------- */
.el-tbl-wrap { border: 1px solid #E5E7EB; border-radius: 10px; overflow: hidden; }
.el-tbl { width: 100%; border-collapse: collapse; }
.el-tbl th {
    background: #F1F5F9;
    color: #4B5563;
    font-size: 11.5px;
    font-weight: 600;
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid #E5E7EB;
}
.el-tbl td {
    padding: 7px 12px;
    font-size: 12px;
    color: #374151;
    border-bottom: 1px solid #F3F4F6;
}
.el-tbl tr:last-child td { border-bottom: none; }
.el-tbl .c { text-align: center; }
.el-tbl .num { width: 44px; }
.el-star { color: #DC2626; font-size: 10px; margin-right: 1px; }

.el-symptom tr:nth-child(even) td { background: #F9FAFB; }
.el-symptom tr.danger td { background: #FEF2F2; }
.el-sc { font-size: 13.5px; font-weight: 700; }
.el-sc.s0 { color: #9CA3AF; }
.el-sc.s1 { color: #1F2937; }
.el-sc.s2 { color: #1F2937; }
.el-sc.s3 { color: #DC2626; }

.el-tbl-note { margin: 7px 0 0; font-size: 10.5px; color: #6B7280; }

/* Reference table tinted rows */
.el-ref-row td { border-bottom: none; padding: 7px 12px; }
.el-ref-row + .el-ref-row td { border-top: 1px solid #fff; }
.el-ref-row.none td { background: #F0FDF4; }
.el-ref-row.mild td { background: #F7FEE7; }
.el-ref-row.moderate td { background: #FEFCE8; }
.el-ref-row.moderate_severe td { background: #FFF7ED; }
.el-ref-row.severe td { background: #FEF2F2; }
.el-ref-level { font-weight: 700; }
.el-ref-row.none .el-ref-level { color: #16A34A; }
.el-ref-row.mild .el-ref-level { color: #65A30D; }
.el-ref-row.moderate .el-ref-level { color: #CA8A04; }
.el-ref-row.moderate_severe .el-ref-level { color: #EA580C; }
.el-ref-row.severe .el-ref-level { color: #DC2626; }
.el-ref-row.active td { font-weight: 600; }
.el-ref-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 700;
    color: #fff;
    vertical-align: 1px;
}
.el-ref-badge.none { background: #16A34A; }
.el-ref-badge.mild { background: #65A30D; }
.el-ref-badge.moderate { background: #CA8A04; }
.el-ref-badge.moderate_severe { background: #EA580C; }
.el-ref-badge.severe { background: #DC2626; }

/* ---------- Next steps ---------- */
.el-rec { display: flex; flex-direction: column; gap: 11px; }
.el-rec-item { display: flex; gap: 12px; align-items: flex-start; }
.el-rec-icon {
    flex-shrink: 0;
    width: 34px; height: 34px;
    border-radius: 8px;
    background: #EFF6FF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.el-rec-icon svg { width: 20px; height: 20px; }
.el-rec-item strong { font-size: 12.5px; font-weight: 700; color: #1F2937; }
.el-rec-item p { margin: 2px 0 0; font-size: 11.5px; color: #6B7280; line-height: 1.55; }

/* ---------- Emergency ---------- */
.el-emg-lead { margin: 0 0 10px; font-size: 12px; color: #374151; }
.el-emg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.el-emg-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 12px 10px;
}
.el-emg-phone { width: 22px; height: 22px; }
.el-emg-label { font-size: 11.5px; font-weight: 600; color: #1F2937; }
.el-emg-label em { font-style: normal; font-weight: 400; color: #6B7280; font-size: 10.5px; }
.el-emg-num { font-size: 17px; font-weight: 800; color: #1F2937; letter-spacing: 0.5px; }
.el-emg-tip {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 12px;
    background: #FEF9C3;
    border: 1px solid #FDE68A;
    border-radius: 10px;
    padding: 10px 14px;
}
.el-emg-bulb { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.el-emg-tip strong { display: block; font-size: 12px; font-weight: 700; color: #92400E; margin-bottom: 1px; }
.el-emg-tip p { margin: 0; font-size: 11.5px; color: #374151; line-height: 1.55; }

/* ---------- Footer ---------- */
.el-footer { padding-top: 4px; }
.el-footer-note { margin: 0 0 14px; font-size: 10.5px; color: #6B7280; }
.el-footer-note strong { color: #4B5563; }
.el-sign-row { display: flex; gap: 48px; }
.el-sign { flex: 1; display: flex; align-items: flex-end; gap: 4px; }
.el-sign span { font-size: 11.5px; color: #4B5563; white-space: nowrap; flex-shrink: 0; }
.el-sign i { flex: 1; height: 16px; border-bottom: 1px solid #94A3B8; }

/* ---------- Responsive (screen only) ---------- */
@media screen and (max-width: 900px) {
    .phq9-el-a4 { width: 100%; min-height: 0; padding: 16px 14px; }
    .el-total-row { flex-direction: column; }
    .el-gauge-panel { flex: none; max-width: none; width: 100%; }
    .el-emg-grid { grid-template-columns: 1fr; }
    .el-info { grid-template-columns: 1fr 1fr; }
}

/* ---------- Print ---------- */
@media print {
    .phq9-el-a4 {
        width: 210mm;
        min-height: 297mm;
        margin: 0;
        padding: 11mm 12mm 10mm;
        box-shadow: none;
        background: #fff;
    }
    .el-card, .el-info, .el-tip, .el-safety, .el-emg-item, .el-emg-tip,
    .el-tbl-wrap, .el-gauge-svg, .el-lscale-bar, .el-pill, .el-ref-row td,
    .el-symptom tr:nth-child(even) td, .el-symptom tr.danger td,
    .el-tbl th, .el-seg, .el-rec-icon, .el-tip-icon, .el-lscale-pin span {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .el-card, .el-info { break-inside: avoid; page-break-inside: avoid; }
    .el-header { break-after: avoid; }
}



/* ===== 观心实验室 PHQ-9 报告 (gx9 v10 — A4 clinical report) ===== */

.gx9-wrap { margin: 0 !important; max-width: none; }

.gx9-v9 {
    width: 210mm;
    min-height: 297mm;
    max-height: 297mm;
    padding: 4mm 9mm 3mm;
    margin: 0 auto;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #1f2937;
    overflow: hidden;
}

.gx9-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 7px 9px;
    margin-bottom: 6px;
    background: #fff;
}
.gx9-card h3 {
    margin: 0 0 5px;
    font-size: 12px;
    font-weight: 700;
    color: #134e8c;
    display: flex;
    align-items: center;
    gap: 5px;
}
.gx9-card h3::before {
    content: "";
    width: 3px;
    height: 12px;
    background: #4A6CF7;
    border-radius: 2px;
}
.gx9-card h3 em { font-style: normal; font-size: 9.5px; color: #9ca3af; font-weight: 400; }

/* header */
.gx9-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1.5px solid #134e8c;
    margin-bottom: 6px;
}
.gx9-brand { display: flex; align-items: center; gap: 6px; }
.gx9-logo { width: 30px; height: 30px; }
.gx9-brand > div { display: flex; flex-direction: column; }
.gx9-brand strong { font-size: 12px; color: #134e8c; line-height: 1.2; }
.gx9-brand span { font-size: 9px; color: #6b7280; line-height: 1.2; }
.gx9-title { text-align: center; }
.gx9-title h1 { font-size: 16px; font-weight: 800; color: #134e8c; margin: 0; line-height: 1.2; }
.gx9-title p { font-size: 11px; color: #6b7280; margin: 1px 0 0; }
.gx9-hmeta { text-align: right; }
.gx9-hmeta > div { display: flex; justify-content: flex-end; align-items: baseline; gap: 5px; font-size: 9px; color: #6b7280; }
.gx9-hmeta strong { font-size: 9.5px; color: #1f2937; font-weight: 600; }
.gx9-mono { font-family: "SF Mono", "Menlo", monospace; }

/* patient info */
.gx9-info { padding: 6px 8px; }
.gx9-info-row {
    display: grid;
    gap: 4px 10px;
    margin-bottom: 4px;
}
.gx9-info-row:first-child { grid-template-columns: 2fr 1fr 1fr 1fr 1fr; }
.gx9-info-row:last-child { grid-template-columns: 1.4fr 1.1fr 1.1fr 2fr; margin-bottom: 0; }
.gx9-info-row > div {
    display: flex;
    align-items: baseline;
    gap: 3px;
    font-size: 10px;
    min-width: 0;
}
.gx9-info label { color: #134e8c; font-weight: 700; white-space: nowrap; }
.gx9-info span { color: #374151; word-break: keep-all; }

/* overall */
.gx9-overall { display: flex; gap: 12px; align-items: stretch; }
.gx9-result-left {
    flex: 0 0 30%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}
.gx9-score-big { line-height: 1; margin-bottom: 3px; }
.gx9-score-big strong {
    font-size: 38px;
    font-weight: 800;
    color: #6b7280;
}
.gx9-score-big strong.none { color: #4CAF50; }
.gx9-score-big strong.mild { color: #8BC34A; }
.gx9-score-big strong.moderate { color: #F59E0B; }
.gx9-score-big strong.moderate_severe { color: #FB923C; }
.gx9-score-big strong.severe { color: #E53935; }
.gx9-score-big small { font-size: 12px; color: #9ca3af; margin-left: 2px; }
.gx9-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    background: #f3f4f6;
    color: #374151;
}
.gx9-pill.none { background: #e8f5e9; color: #2e7d32; }
.gx9-pill.mild { background: #f1f8e9; color: #558b2f; }
.gx9-pill.moderate { background: #fff8e1; color: #b45309; }
.gx9-pill.moderate_severe { background: #fff3e0; color: #c2410c; }
.gx9-pill.severe { background: #E53935; color: #fff; }
.gx9-warn {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    margin-top: 6px;
    padding: 6px 8px;
    background: #fef2f2;
    border: 1px dashed #fca5a5;
    border-radius: 8px;
}
.gx9-warn svg { flex-shrink: 0; width: 14px; height: 14px; margin-top: 1px; }
.gx9-warn p { font-size: 9px; line-height: 1.4; color: #7f1d1d; margin: 0; }

.gx9-gauge-side {
    flex: 1 1 70%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.gx9-gauge { position: relative; width: 100%; max-width: 240px; margin: 0 auto; }
.gx9-gauge-svg { width: 100%; height: auto; display: block; }
.gx9-gauge-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 16px;
    margin-top: -6px;
    font-size: 9px;
    color: #6b7280;
    font-weight: 600;
}
.gx9-bar { margin-top: 6px; }
.gx9-bar-track { position: relative; height: 9px; border-radius: 4.5px; display: flex; overflow: hidden; background: #e5e7eb; }
.gx9-bar-track i { display: block; height: 100%; }
.gx9-bar-track .b-none { background: #66BB6A; }
.gx9-bar-track .b-mild { background: #FFCA28; }
.gx9-bar-track .b-moderate { background: #FFA726; }
.gx9-bar-track .b-modsev { background: #FB8C00; }
.gx9-bar-track .b-severe { background: #E53935; }
.gx9-bar-track i:first-child { border-radius: 4.5px 0 0 4.5px; }
.gx9-bar-track i:last-of-type { border-radius: 0 4.5px 4.5px 0; }
.gx9-bar-pin { position: absolute; top: -20px; transform: translateX(-50%); text-align: center; line-height: 1; }
.gx9-bar-pin b { display: block; font-size: 10px; font-weight: 800; color: #E53935; margin-bottom: 1px; }
.gx9-bar-pin svg { width: 14px; height: 18px; }
.gx9-bar-labels { display: flex; margin-top: 5px; }
.gx9-bar-labels > div { flex: 1; text-align: center; font-size: 8.5px; color: #9ca3af; }
.gx9-bar-labels > div b { display: block; font-size: 8.5px; font-weight: 700; color: #6b7280; }
.gx9-bar-labels > div.on span { color: #134e8c; font-weight: 800; }
.gx9-bar-labels > div.on b { color: #134e8c; }
.gx9-bar-note { font-size: 8px; color: #9ca3af; text-align: right; margin: 4px 0 0; }

/* middle columns */
.gx9-mid { display: flex; gap: 8px; align-items: stretch; }
.gx9-col-l { flex: 0 0 58%; min-width: 0; }
.gx9-col-r { flex: 1 1 42%; min-width: 0; display: flex; flex-direction: column; }
.gx9-col-r .gx9-card { flex: 1; }

/* tables */
.gx9-tbl { width: 100%; border-collapse: collapse; font-size: 9px; border: 1px solid #e5e7eb; border-radius: 6px; overflow: hidden; }
.gx9-tbl th { background: #f3f4f6; color: #374151; font-weight: 700; padding: 4px 5px; text-align: left; border-bottom: 1px solid #e5e7eb; }
.gx9-tbl td { padding: 2px 4px; border-bottom: 1px solid #eef2f7; color: #374151; vertical-align: middle; line-height: 1.3; }
.gx9-tbl th.c, .gx9-tbl td.c { text-align: center; }
.gx9-tbl th.w1 { width: 26px; } .gx9-tbl th.w2 { width: 34px; } .gx9-tbl th.w3 { width: 52px; } .gx9-tbl th.w5 { width: 76px; }
.gx9-tbl tr:last-child td { border-bottom: none; }
.gx9-tbl tr.danger { background: #fef2f2; }
.gx9-tbl tr.danger td { color: #7f1d1d; }
.gx9-tbl td b.gx9-sc { display: inline-block; min-width: 16px; text-align: center; font-weight: 800; padding: 1px 3px; border-radius: 4px; color: #fff; background: #9ca3af; font-size: 9px; }
.gx9-tbl td b.gx9-sc.v0 { background: #66BB6A; }
.gx9-tbl td b.gx9-sc.v1 { background: #FFCA28; color: #7a4b00; }
.gx9-tbl td b.gx9-sc.v2 { background: #FFA726; }
.gx9-tbl td b.gx9-sc.v3 { background: #E53935; }
.gx9-note { font-size: 7.5px; color: #9ca3af; margin: 4px 0 0; }

.gx9-dim { display: flex; align-items: center; gap: 3px; }
.gx9-dim-ic { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gx9-dim-ic svg { width: 12px; height: 12px; }
.gx9-dim-txt { font-size: 8px; color: #4b5563; }
.gx9-dim-txt b { font-weight: 700; color: #1f2937; }

/* supplementary & follow-up */
.gx9-tbl.gx9-sup td, .gx9-tbl.gx9-follow td { padding: 2px 4px; }
.gx9-tbl.gx9-sup td.q { width: 26px; color: #134e8c; font-weight: 700; text-align: center; }
.gx9-tbl.gx9-sup td.qq { font-size: 8.5px; }
.gx9-tbl.gx9-sup td.a { width: 40px; text-align: center; }
.gx9-ans, .gx9-fv {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 9px;
    font-size: 8px;
    font-weight: 700;
}
.gx9-ans.yes, .gx9-fv.yes { background: #fee2e2; color: #dc2626; }
.gx9-ans.no, .gx9-fv.no { background: #f3f4f6; color: #6b7280; }
.gx9-ans.diff { background: #ffedd5; color: #c2410c; }
.gx9-subh { font-size: 10px; font-weight: 700; color: #134e8c; margin: 6px 0 3px; }
.gx9-tbl.gx9-follow td.v { width: 36px; text-align: center; }

/* safety card */
.gx9-safety-card {
    background: #fef2f2;
    border: 1.5px dashed #fca5a5;
}
.gx9-safety-head { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: #dc2626; margin-bottom: 3px; }
.gx9-safety-head svg { flex-shrink: 0; width: 14px; height: 14px; }
.gx9-safety-card p { font-size: 9px; line-height: 1.4; color: #7f1d1d; margin: 0; }

/* interpretation table */
.gx9-ref-4 td { font-size: 9.5px; }
.gx9-ref-4 td:first-child { white-space: nowrap; }
.gx9-lv { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 9px; font-weight: 700; }
.gx9-lv.lv-none { background: #e8f5e9; color: #2e7d32; }
.gx9-lv.lv-mild { background: #f1f8e9; color: #558b2f; }
.gx9-lv.lv-moderate { background: #fff8e1; color: #b45309; }
.gx9-lv.lv-moderate_severe { background: #fff3e0; color: #c2410c; }
.gx9-lv.lv-severe { background: #ffebee; color: #b71c1c; }
.gx9-ref-4 tr.r-none td { background: #f0fdf4; }
.gx9-ref-4 tr.r-mild td { background: #f7fee7; }
.gx9-ref-4 tr.r-moderate td { background: #fffbeb; }
.gx9-ref-4 tr.r-moderate_severe td { background: #fff7ed; }
.gx9-ref-4 tr.r-severe td { background: #fef2f2; }
.gx9-ref-4 tr.cur td { font-weight: 600; }

/* next steps */
.gx9-next { display: flex; gap: 8px; }
.gx9-next-it {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 5px;
    padding: 8px 5px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}
.gx9-nic { width: 30px; height: 30px; border-radius: 8px; background: #eff6ff; display: inline-flex; align-items: center; justify-content: center; }
.gx9-nic svg { width: 17px; height: 17px; }
.gx9-next-it strong { font-size: 10.5px; color: #134e8c; }
.gx9-next-it p { font-size: 8.5px; color: #6b7280; line-height: 1.35; margin: 0; }

/* emergency */
.gx9-emg-lead { font-size: 10px; color: #374151; margin: 0 0 6px; }
.gx9-emg-row { display: flex; gap: 10px; align-items: stretch; }
.gx9-emg { flex: 1 1 58%; display: flex; gap: 7px; }
.gx9-emg-it {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 3px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 7px 4px;
}
.gx9-emg-ic { width: 24px; height: 24px; border-radius: 50%; background: #fee2e2; display: inline-flex; align-items: center; justify-content: center; }
.gx9-emg-ic svg { width: 12px; height: 12px; }
.gx9-emg-name { font-size: 9px; color: #4b5563; }
.gx9-emg-tel { font-size: 12px; font-weight: 800; color: #dc2626; letter-spacing: .5px; }
.gx9-emg-tag { font-size: 8px; color: #6b7280; background: #f3f4f6; padding: 1px 5px; border-radius: 8px; }
.gx9-emg-tip {
    flex: 1 1 38%;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.gx9-emg-bulb { display: inline-flex; margin-bottom: 3px; }
.gx9-emg-bulb svg { width: 18px; height: 18px; }
.gx9-emg-tip strong { display: block; font-size: 11px; color: #78350f; margin-bottom: 2px; }
.gx9-emg-tip p { font-size: 9.5px; color: #92400e; line-height: 1.45; margin: 0; }

/* footer */
.gx9-footer { margin-top: 2px; }
.gx9-foot-important {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 7px 10px;
    margin-bottom: 6px;
}
.gx9-foot-ic {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #F59E0B;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gx9-foot-important p { font-size: 9.5px; color: #78350f; line-height: 1.45; margin: 0; }
.gx9-signs { display: flex; justify-content: space-between; font-size: 10px; color: #6b7280; margin-bottom: 5px; }
.gx9-signs > div { display: flex; align-items: center; gap: 5px; }
.gx9-signs i { display: inline-block; width: 120px; border-bottom: 1px solid #d1d5db; height: 1px; }
.gx9-foot-note { font-size: 8.5px; color: #9ca3af; line-height: 1.4; margin: 0; }

/* body de-shell */
.gx9-body { background: #f3f4f6; }
.gx9-body .main-content { max-width: none; padding: 0; }
.gx9-body .app-header,
.gx9-body .report-toolbar,
.gx9-body .print-only-header,
.gx9-body .report-header,
.gx9-body .admin-layout .admin-sidebar,
.gx9-body nav,
.gx9-body footer.site-footer,
.gx9-body .phq9-section,
.gx9-body .interpretation-section,
.gx9-body .screening-visual-section,
.gx9-body .print-only-footer,
.gx9-body .disclaimer { display: none !important; }
html:has(.gx9-body) { margin: 0 !important; padding: 0 !important; }
.gx9-body { margin: 0 !important; padding: 0 !important; }
.gx9-body .app-container { min-height: auto !important; }
.gx9-body .main-content { padding: 0 !important; margin: 0 auto; }
.gx9-body .admin-main { padding: 0 !important; background: #f3f4f6; }

@media print {
    .gx9-v9 {
        width: 210mm;
        min-height: 297mm;
        max-height: 297mm;
        margin: 0;
        box-shadow: none;
        border: none;
        overflow: hidden;
        page-break-after: always;
    }
    .gx9-card, .gx9-safety-card, .gx9-emg-tip, .gx9-emg-it, .gx9-next-it, .gx9-foot-important {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .gx9-card, .gx9-safety-card, .gx9-emg-tip, .gx9-foot-important { break-inside: avoid; page-break-inside: avoid; }
}


/* ============================================================
   PHQ-9 report v9c — compact A4 single-page
   ============================================================ */

.gx9-wrap:has(> .gx9-page.gx9-v9) { margin: 0 !important; max-width: none; }

.gx9-v9 {
    width: 210mm;
    min-height: 297mm;
    max-height: 297mm;
    padding: 3.5mm 8mm 2mm;
    margin: 20px auto;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #1f2937;
    overflow: hidden;
}

/* --- section header with circled number --- */
.gx9-v9 .gx9-sec-h {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0 0 4px;
    font-size: 11.5px;
    font-weight: 700;
    color: #134e8c;
}
.gx9-v9 .gx9-sec-h::before { display: none; }
.gx9-v9 .gx9-sec-h em {
    font-style: normal;
    font-size: 10.5px;
    color: #94a3b8;
    font-weight: 500;
    margin-left: 2px;
}
.gx9-v9 .gx9-sec-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #134e8c;
    color: #fff;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1;
}

/* --- cards --- */
.gx9-v9 .gx9-card {
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    padding: 4px 7px;
    margin-bottom: 3px;
    background: #fff;
}
.gx9-v9 .gx9-card:last-child { margin-bottom: 2px; }

/* --- header --- */
.gx9-v9 .gx9-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-bottom: 4px;
    border-bottom: 2px solid #134e8c;
    margin-bottom: 4px;
}
.gx9-v9 .gx9-title { text-align: center; flex: 1; }
.gx9-v9 .gx9-header h1 { font-size: 17px; font-weight: 800; color: #134e8c; margin: 0 0 1px; line-height: 1.2; }
.gx9-v9 .gx9-header p { font-size: 10px; color: #6b7280; margin: 0; }
.gx9-v9 .gx9-brand { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.gx9-v9 .gx9-brand svg { width: 26px; height: 26px; }
.gx9-v9 .gx9-brand strong { font-size: 11px; color: #134e8c; font-weight: 700; display: block; line-height: 1.1; }
.gx9-v9 .gx9-brand span { font-size: 8px; color: #94a3b8; letter-spacing: .5px; display: block; line-height: 1.1; margin-top: 1px; }
.gx9-v9 .gx9-hmeta { text-align: right; flex: 0 0 auto; font-size: 8.5px; }
.gx9-v9 .gx9-hmeta > div { line-height: 1.4; color: #6b7280; }
.gx9-v9 .gx9-hmeta span { color: #94a3b8; }
.gx9-v9 .gx9-hmeta strong { color: #374151; font-weight: 600; font-size: 9px; }

/* --- patient info --- */
.gx9-v9 .gx9-info { font-size: 9px; padding: 5px 8px; }
.gx9-v9 .gx9-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px 8px;
}
.gx9-v9 .gx9-info-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-align: left;
}
.gx9-v9 .gx9-info-cell.gx9-info-center {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 14px;
}
.gx9-v9 .gx9-info-cell.gx9-info-right {
    align-items: flex-end;
    text-align: right;
}
.gx9-v9 .gx9-info-pair {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gx9-v9 .gx9-info-cell.gx9-info-center .gx9-info-pair {
    align-items: center;
}
.gx9-v9 .gx9-info-cell.gx9-info-right .gx9-info-pair {
    align-items: flex-end;
}
.gx9-v9 .gx9-info label { color: #134e8c; font-weight: 600; font-size: 8.5px; white-space: nowrap; }
.gx9-v9 .gx9-info span { color: #374151; font-weight: 500; font-size: 9px; }

/* --- overall result --- */
.gx9-v9 .gx9-overall { display: flex; gap: 8px; align-items: stretch; }
.gx9-v9 .gx9-result-left {
    flex: 0 0 30%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.gx9-v9 .gx9-score-big {
    display: flex;
    align-items: baseline;
    gap: 3px;
    line-height: 1;
    margin-bottom: 4px;
}
.gx9-v9 .gx9-score-big strong {
    font-size: 38px;
    font-weight: 800;
    color: #DC2626;
    line-height: 1;
}
.gx9-v9 .gx9-score-big small { font-size: 12px; color: #9ca3af; }
.gx9-v9 .gx9-score-big .severe { color: #DC2626; }
.gx9-v9 .gx9-score-big .modsev { color: #FB8C00; }
.gx9-v9 .gx9-score-big .moderate { color: #FFA726; }
.gx9-v9 .gx9-score-big .mild { color: #FFCA28; }
.gx9-v9 .gx9-score-big .none { color: #66BB6A; }

.gx9-v9 .gx9-pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10.5px;
    font-weight: 700;
    margin-bottom: 6px;
    align-self: flex-start;
}
.gx9-v9 .gx9-pill.severe { background: #DC2626; color: #fff; }
.gx9-v9 .gx9-pill.modsev { background: #FB8C00; color: #fff; }
.gx9-v9 .gx9-pill.moderate { background: #FFA726; color: #fff; }
.gx9-v9 .gx9-pill.mild { background: #FFCA28; color: #374151; }
.gx9-v9 .gx9-pill.none { background: #66BB6A; color: #fff; }

.gx9-v9 .gx9-warn {
    display: flex;
    gap: 5px;
    align-items: flex-start;
    padding: 5px 7px;
    background: #fef2f2;
    border: 1px dashed #fca5a5;
    border-radius: 6px;
    margin-top: auto;
}
.gx9-v9 .gx9-warn svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.gx9-v9 .gx9-warn p { margin: 0; font-size: 9px; color: #991b1b; line-height: 1.35; }

/* --- horizontal bar (right side) --- */
.gx9-v9 .gx9-bar-side {
    flex: 1 1 66%;
    display: flex;
    flex-direction: column;
    padding: 2px 2px 0;
}
.gx9-v9 .gx9-bar-top {
    display: flex;
    justify-content: space-around;
    margin-bottom: 3px;
    font-size: 10px;
    font-weight: 600;
}
.gx9-v9 .gx9-bar-top .lb-none { color: #66BB6A; }
.gx9-v9 .gx9-bar-top .lb-mild { color: #FFCA28; }
.gx9-v9 .gx9-bar-top .lb-moderate { color: #FFA726; }
.gx9-v9 .gx9-bar-top .lb-modsev { color: #FB8C00; }
.gx9-v9 .gx9-bar-top .lb-severe { color: #DC2626; }

.gx9-v9 .gx9-bar-track2 {
    position: relative;
    display: flex;
    align-items: center;
    height: 12px;
    border-radius: 6px;
    overflow: visible;
    margin-bottom: 8px;
}
.gx9-v9 .gx9-bar-track2 i { display: block; height: 12px; }
.gx9-v9 .gx9-bar-track2 i:first-child { border-radius: 6px 0 0 6px; }
.gx9-v9 .gx9-bar-track2 i:last-of-type { border-radius: 0 6px 6px 0; }
.gx9-v9 .gx9-bar-track2 .b-none { background: #66BB6A; }
.gx9-v9 .gx9-bar-track2 .b-mild { background: #FFCA28; }
.gx9-v9 .gx9-bar-track2 .b-moderate { background: #FFA726; }
.gx9-v9 .gx9-bar-track2 .b-modsev { background: #FB8C00; }
.gx9-v9 .gx9-bar-track2 .b-severe { background: #DC2626; }

.gx9-v9 .gx9-bar-track2 .ticks {
    position: absolute;
    top: 16px;
    font-size: 8.5px;
    color: #6b7280;
    transform: translateX(-50%);
}
.gx9-v9 .gx9-bar-track2 .ticks::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    width: 1px;
    height: 4px;
    background: #d1d5db;
    transform: translateX(-50%);
}
.gx9-v9 .gx9-bar-track2 .t0 { left: 0%; }
.gx9-v9 .gx9-bar-track2 .t4 { left: 14.8%; }
.gx9-v9 .gx9-bar-track2 .t9 { left: 33.3%; }
.gx9-v9 .gx9-bar-track2 .t14 { left: 51.9%; }
.gx9-v9 .gx9-bar-track2 .t19 { left: 70.4%; }
.gx9-v9 .gx9-bar-track2 .t27 { left: 100%; }

.gx9-v9 .gx9-bar-pin2 {
    position: absolute;
    top: -20px;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.gx9-v9 .gx9-bar-pin2 b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 18px;
    border-radius: 9px;
    background: #374151;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    margin-bottom: -3px;
}
.gx9-v9 .gx9-bar-pin2 svg { width: 14px; height: 17px; }

.gx9-v9 .gx9-bar-badges {
    display: flex;
    justify-content: space-around;
    margin-top: 14px;
    margin-bottom: 2px;
}
.gx9-v9 .gx9-badge {
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 500;
    background: #f3f4f6;
    color: #6b7280;
}
.gx9-v9 .gx9-badge.bd-none { background: #ECFDF5; color: #059669; }
.gx9-v9 .gx9-badge.bd-mild { background: #FFFBEB; color: #CA8A04; }
.gx9-v9 .gx9-badge.bd-moderate { background: #FFF7ED; color: #EA580C; }
.gx9-v9 .gx9-badge.bd-modsev { background: #FEF3C7; color: #D97706; }
.gx9-v9 .gx9-badge.bd-severe { background: #FEF2F2; color: #DC2626; }
.gx9-v9 .gx9-badge.on { font-weight: 700; }

.gx9-v9 .gx9-bar-note { font-size: 8.5px; color: #9ca3af; margin: 0; text-align: right; }

/* --- mid section (symptoms + clinical) --- */
.gx9-v9 .gx9-mid { display: flex; gap: 6px; align-items: stretch; }
.gx9-v9 .gx9-col-l { flex: 0 0 57%; }
.gx9-v9 .gx9-col-r { flex: 1 1 41%; display: flex; flex-direction: column; gap: 0; }
.gx9-v9 .gx9-col-r .gx9-card { margin-bottom: 5px; }
.gx9-v9 .gx9-col-r .gx9-card:last-child { margin-bottom: 0; }

/* --- tables --- */
.gx9-v9 .gx9-tbl { width: 100%; border-collapse: collapse; font-size: 9px; border: 1px solid #e5e7eb; border-radius: 6px; overflow: hidden; }
.gx9-v9 .gx9-tbl th { background: #f3f4f6; color: #374151; font-weight: 700; padding: 1.5px 5px; text-align: left; border-bottom: 1px solid #e5e7eb; font-size: 8.5px; }
.gx9-v9 .gx9-tbl td { padding: 1px 5px; border-bottom: 1px solid #eef2f7; color: #374151; vertical-align: middle; line-height: 1.15; font-size: 8.5px; }
.gx9-v9 .gx9-tbl th.c, .gx9-v9 .gx9-tbl td.c { text-align: center; }
.gx9-v9 .gx9-tbl th.w1 { width: 28px; }
.gx9-v9 .gx9-tbl th.w2 { width: 36px; }
.gx9-v9 .gx9-tbl th.w3 { width: 64px; }
.gx9-v9 .gx9-tbl th.w5 { width: 86px; }
.gx9-v9 .gx9-tbl tr:last-child td { border-bottom: none; }
.gx9-v9 .gx9-tbl tr.danger { background: #fef2f2; }
.gx9-v9 .gx9-tbl tr.danger td { color: #991b1b; }

.gx9-v9 .gx9-tbl td b.gx9-sc {
    display: inline-block;
    min-width: 16px;
    text-align: center;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 50%;
    color: #fff;
    background: #9ca3af;
    font-size: 9px;
    width: 16px;
    height: 16px;
    line-height: 14px;
}
.gx9-v9 .gx9-tbl td b.gx9-sc.v0 { background: #9ca3af; }
.gx9-v9 .gx9-tbl td b.gx9-sc.v1 { background: #66BB6A; }
.gx9-v9 .gx9-tbl td b.gx9-sc.v2 { background: #FFA726; }
.gx9-v9 .gx9-tbl td b.gx9-sc.v3 { background: #DC2626; }

.gx9-v9 .gx9-dim {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 8.5px;
}
.gx9-v9 .gx9-dim-ic {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #EEF2FF;
}
.gx9-v9 .gx9-dim-ic svg { width: 9px; height: 9px; }
.gx9-v9 .gx9-dim-txt { color: #374151; }
.gx9-v9 .gx9-dim-txt b { color: #134e8c; font-weight: 700; }

.gx9-v9 .gx9-note { font-size: 7.5px; color: #9ca3af; margin: 2px 0 0; line-height: 1.3; }

/* --- supplementary / follow-up tables --- */
.gx9-v9 .gx9-sup td.q {
    width: 30px;
    font-weight: 700;
    color: #134e8c;
    text-align: center;
    font-size: 8.5px;
}
.gx9-v9 .gx9-sup td.qq {
    font-size: 8.5px;
    color: #374151;
}
.gx9-v9 .gx9-sup td.qq small {
    display: block;
    font-size: 8px;
    color: #9ca3af;
    margin-top: 1px;
}
.gx9-v9 .gx9-sup td.a {
    width: 58px;
    text-align: right;
}
.gx9-v9 .gx9-ans {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 9px;
    font-size: 8.5px;
    font-weight: 600;
    background: #f3f4f6;
    color: #6b7280;
}
.gx9-v9 .gx9-ans.yes { background: #FEF2F2; color: #DC2626; }
.gx9-v9 .gx9-ans.diff { background: #FEF3C7; color: #D97706; }
.gx9-v9 .gx9-ans.no { background: #f3f4f6; color: #6b7280; }

.gx9-v9 .gx9-subh {
    margin: 4px 0 2px;
    font-size: 9.5px;
    font-weight: 700;
    color: #134e8c;
    background: #EEF2FF;
    padding: 2px 6px;
    border-radius: 4px;
}

.gx9-v9 .gx9-follow td { padding: 1px 6px; font-size: 8px; }
.gx9-v9 .gx9-follow td.v { text-align: right; width: 40px; }
.gx9-v9 .gx9-fv {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 8.5px;
    font-weight: 600;
}
.gx9-v9 .gx9-fv.yes { background: #FEF2F2; color: #DC2626; }
.gx9-v9 .gx9-fv.no { background: #f3f4f6; color: #6b7280; }

/* --- safety card --- */
.gx9-v9 .gx9-safety-card {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 7px;
    padding: 3px 7px;
    margin-bottom: 3px;
}
.gx9-v9 .gx9-safety-card .gx9-safety-head {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 700;
    color: #DC2626;
    margin-bottom: 2px;
}
.gx9-v9 .gx9-safety-card svg { width: 14px; height: 14px; }
.gx9-v9 .gx9-safety-card p {
    margin: 0;
    font-size: 9px;
    color: #991b1b;
    line-height: 1.35;
}

/* --- reference table --- */
.gx9-v9 .gx9-ref th { text-align: center; }
.gx9-v9 .gx9-ref td { text-align: center; }
.gx9-v9 .gx9-ref td:nth-child(3),
.gx9-v9 .gx9-ref td:nth-child(4) { text-align: left; }
.gx9-v9 .gx9-ref th:nth-child(3),
.gx9-v9 .gx9-ref th:nth-child(4) { text-align: left; }

.gx9-v9 .gx9-lv {
    display: inline-block;
    padding: 1px 8px;
    font-size: 9px;
    font-weight: 600;
    border-radius: 4px;
}
.gx9-v9 .gx9-lv.lv-none { color: #059669; background: #ECFDF5; }
.gx9-v9 .gx9-lv.lv-mild { color: #CA8A04; background: #FFFBEB; }
.gx9-v9 .gx9-lv.lv-moderate { color: #EA580C; background: #FFF7ED; }
.gx9-v9 .gx9-lv.lv-modsev { color: #D97706; background: #FEF3C7; }
.gx9-v9 .gx9-lv.lv-severe { color: #DC2626; background: #FEF2F2; }

.gx9-v9 .gx9-ref tr.r-none { background: #F0FDF4; }
.gx9-v9 .gx9-ref tr.r-mild { background: #FEFCE8; }
.gx9-v9 .gx9-ref tr.r-moderate { background: #FFF7ED; }
.gx9-v9 .gx9-ref tr.r-modsev { background: #FFEDD5; }
.gx9-v9 .gx9-ref tr.r-severe { background: #FEF2F2; }
.gx9-v9 .gx9-ref tr.cur { font-weight: 700; }

/* --- next steps --- */
.gx9-v9 .gx9-next {
    display: flex;
    gap: 3px;
    margin-bottom: 0;
}
.gx9-v9 .gx9-next-it {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 5px 2px 4px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    gap: 1px;
}
.gx9-v9 .gx9-nic {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #EEF2FF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1px;
}
.gx9-v9 .gx9-nic svg { width: 15px; height: 15px; }
.gx9-v9 .gx9-next-it strong { font-size: 9px; color: #134e8c; font-weight: 600; }
.gx9-v9 .gx9-next-it p { font-size: 7px; color: #6b7280; line-height: 1.25; margin: 0; }

/* --- emergency resources --- */
.gx9-v9 .gx9-emg-lead { font-size: 8px; margin: 0 0 2px; color: #374151; }
.gx9-v9 .gx9-emg-row { display: flex; gap: 4px; align-items: stretch; }
.gx9-v9 .gx9-emg {
    flex: 1 1 60%;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.gx9-v9 .gx9-emg-it {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}
.gx9-v9 .gx9-emg-ic {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fee2e2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.gx9-v9 .gx9-emg-ic svg { width: 10px; height: 10px; }
.gx9-v9 .gx9-emg-name { font-size: 8.5px; color: #4b5563; flex: 1; }
.gx9-v9 .gx9-emg-tel { font-size: 10.5px; font-weight: 800; color: #dc2626; letter-spacing: .3px; }
.gx9-v9 .gx9-emg-tag {
    font-size: 7.5px;
    padding: 1px 4px;
    border-radius: 7px;
    background: #f3f4f6;
    color: #6b7280;
    margin-left: 3px;
}

.gx9-v9 .gx9-emg-tip {
    flex: 1 1 36%;
    background: #FFFBEB;
    border: 1px solid #FCD34D;
    border-radius: 8px;
    padding: 5px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.gx9-v9 .gx9-emg-bulb { margin-bottom: 2px; }
.gx9-v9 .gx9-emg-bulb svg { width: 16px; height: 16px; }
.gx9-v9 .gx9-emg-tip strong { font-size: 10px; color: #92400E; margin-bottom: 1px; display: block; }
.gx9-v9 .gx9-emg-tip p { font-size: 8.5px; line-height: 1.35; color: #78350F; margin: 0; }

/* --- footer --- */
.gx9-v9 .gx9-footer {
    margin-top: 0px;
    padding-top: 3px;
}
.gx9-v9 .gx9-foot-tip {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    padding: 3px 6px;
    background: #FFFBEB;
    border: 1px solid #FCD34D;
    border-radius: 5px;
    margin-bottom: 2px;
}
.gx9-v9 .gx9-foot-bulb {
    flex-shrink: 0;
    margin-top: 1px;
}
.gx9-v9 .gx9-foot-bulb svg { width: 14px; height: 14px; }
.gx9-v9 .gx9-foot-tip strong {
    font-size: 9px;
    font-weight: 700;
    color: #92400E;
    display: block;
    margin-bottom: 0px;
}
.gx9-v9 .gx9-foot-tip p {
    font-size: 8px;
    color: #78350F;
    line-height: 1.3;
    margin: 0;
}
.gx9-v9 .gx9-foot-copy {
    font-size: 8px;
    color: #9ca3af;
    text-align: right;
    margin: 0;
}

@media print {
    .gx9-v9 {
        width: 210mm;
        min-height: 297mm;
        max-height: 297mm;
        margin: 0;
        box-shadow: none;
        border: none;
        overflow: hidden;
    }
    .gx9-v9 .gx9-card { break-inside: avoid; page-break-inside: avoid; }
}
