        /* ── Variables — Taller de Luz palette (theme-aware) ── */
        :root {
            color-scheme: light;
            /* Light mode (default) — warm studio daylight */
            --bg-base:      #F5F1EB;
            --bg-surface:   #EDE8E0;
            --bg-panel:     #FAF8F5;
            --bg-raised:    #FFFFFF;
            --bg-input:     #F7F4EF;

            --border:       #D4C8B8;
            --border-mid:   #C4B8A8;
            --border-hi:    #B0A290;

            --text-primary: #2A211C;
            --text-sub:     #6B5B50;
            --text-muted:   #9E9086;

            --metal-hi:     #8B7355;
            --metal-mid:    #6B5B50;
            --metal-lo:     #A09080;

            --amber:        #B85C1A;
            --amber-glow:   rgba(184,92,26,0.18);
            --amber-dk:     #8A4510;
            --amber-text:   #D4722A;

            --jade:         #2A7A6A;
            --jade-glow:    rgba(42,122,106,0.18);
            --jade-dk:      #1E5A4E;
            --jade-text:    #3A9A86;

            --success:      #4A7C59;
            --success-glow: rgba(74,124,89,0.18);
            --success-text: #5A9A6E;

            --rose:         #B06A6A;
            --rose-glow:    rgba(176,106,106,0.18);

            --warn:         #A04020;
            --sky:          #6c9ecf;

            --ai-accent:    #4A5568;
            --ai-bg:        #F0EEEA;

            --grad-metal:    linear-gradient(135deg, #8B7355 0%, #B0A090 50%, #8B7355 100%);
            --grad-metal-hi: linear-gradient(135deg, #A09080 0%, #C4B4A4 50%, #A09080 100%);
            --grad-amber:    linear-gradient(135deg, #B85C1A 0%, #D4722A 50%, #B85C1A 100%);
            --grad-amber-hi: linear-gradient(135deg, #D4722A 0%, #E8924A 50%, #D4722A 100%);
            --grad-success:  linear-gradient(135deg, #4A7C59 0%, #5A9A6E 50%, #4A7C59 100%);

            --font-display: 'Literata', Georgia, serif;
            --font-body:    'Source Sans 3', system-ui, sans-serif;
            --font-mono:    'Cousine', 'Courier New', monospace;

            /* Type scale (Visual Polish 2 · M1) — the app's core UI text band.
               Near-duplicate literals (±0.02rem) were consolidated onto these eight
               steps; display sizes (≥1rem) and rare special chips stay literal. */
            --text-micro:    0.70rem;   /* smallest UI text: hints, badges */
            --text-caption:  0.72rem;   /* captions, status lines, microcopy */
            --text-label:    0.75rem;   /* labels, chips, footnotes */
            --text-note:     0.78rem;   /* secondary notes, small buttons */
            --text-ui:       0.82rem;   /* standard control/UI text */
            --text-body:     0.85rem;   /* default reading text */
            --text-emph:     0.90rem;   /* emphasized body, small headings */
            --text-subtitle: 0.95rem;   /* subtitles, prominent labels */

            --radius-sm:    8px;
            --radius-md:    14px;
            --radius-lg:    22px;
            --radius-full:  9999px;

            --shadow-sm:    0 1px 4px rgba(42,33,28,0.08);
            --shadow-md:    0 4px 16px rgba(42,33,28,0.10);
            --shadow-lg:    0 8px 32px rgba(42,33,28,0.12);
            --shadow-modal: 0 8px 32px rgba(0,0,0,0.22);   /* M2: strongest elevation — modal layer only */
            --shadow-glow:  0 0 20px var(--amber-glow);

            /* Focus grammar (VP2 M6) — one ring system, two semantic families:
               amber = act/primary surfaces, jade = coach/system surfaces; rose for
               destructive controls. Colors reference theme accents, so dark theme
               brightens the rings automatically. Exception (kept deliberate): on
               amber-FILLED buttons the ring is amber-dk for contrast. */
            --focus-ring:            2px solid var(--amber);
            --focus-ring-strong:     3px solid var(--amber);
            --focus-ring-alt:        2px solid var(--jade);
            --focus-ring-alt-strong: 3px solid var(--jade);
            --focus-ring-danger:     3px solid var(--rose);

            /* Animation */
            --transition-fast:   0.15s ease;
            --transition-medium: 0.25s ease;
            --transition-slow:   0.4s ease;
        }

        /* Dark mode — rich warm night studio */
        [data-theme="dark"] {
            color-scheme: dark;
            --bg-base:      #12100E;
            --bg-surface:   #1C1814;
            --bg-panel:     #1E1A14;
            --bg-raised:    #2A241C;
            --bg-input:     #16120E;

            --border:       #3C3428;
            --border-mid:   #4A4034;
            --border-hi:    #5A5040;

            --text-primary: #F0EBE3;
            --text-sub:     #B0A898;
            --text-muted:   #6A6050;

            --metal-hi:     #C4B8A8;
            --metal-mid:    #A09080;
            --metal-lo:     #807060;

            --amber:        #D4823A;
            --amber-glow:   rgba(212,130,58,0.22);
            --amber-dk:     #A86220;
            --amber-text:   #E8A060;

            --jade:         #3AAA94;
            --jade-glow:    rgba(58,170,148,0.22);
            --jade-dk:      #2A7A6A;
            --jade-text:    #5ACCB4;

            --success:      #5A9A6E;
            --success-glow: rgba(90,154,110,0.22);
            --success-text: #7ABC8E;

            --rose:         #C48484;
            --rose-glow:    rgba(196,132,132,0.22);

            --warn:         #C86848;
            --sky:          #7aadda;

            --ai-accent:    #6A7A8A;
            --ai-bg:        #252018;

            --shadow-sm:    0 1px 4px rgba(0,0,0,0.30);
            --shadow-md:    0 4px 16px rgba(0,0,0,0.35);
            --shadow-lg:    0 8px 32px rgba(0,0,0,0.40);
            --shadow-modal: 0 8px 32px rgba(0,0,0,0.50);   /* M2: modal layer, dark */
        }

        /* ── Reset ── */
        *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
        html, body { height: 100%; overflow: hidden; }
        body {
            font-family: var(--font-body);
            background: var(--bg-base);
            color: var(--text-primary);
            display: flex;
            flex-direction: column;
            transition: background-color var(--transition-slow), color var(--transition-slow);
        }
        body::before {
            content: '';
            position: fixed; inset: 0;
            background: radial-gradient(ellipse at 15% 10%, rgba(184,92,26,0.04) 0%, transparent 50%),
                        radial-gradient(ellipse at 85% 90%, rgba(42,122,106,0.03) 0%, transparent 50%);
            pointer-events: none;
            z-index: 0;
        }
        .app-header, .journey-wrap, .current-task-bar, .workspace { position: relative; z-index: 1; }
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }

        /* ── Scrollbars ── */
        ::-webkit-scrollbar        { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track  { background: transparent; }
        ::-webkit-scrollbar-thumb  { background: var(--border-mid); border-radius: 3px; }
        ::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }
        * { scrollbar-width: thin; scrollbar-color: var(--border-mid) transparent; }

        /* ── Setup Banner ── */
        .setup-banner {
            background: var(--bg-surface);
            border-bottom: 1px solid var(--border);
            padding: 10px 24px;
            font-size: var(--text-body);
            color: var(--amber-text);
            display: flex; align-items: center; gap: 8px;
            flex-shrink: 0;
        }
        .setup-banner.hidden { display: none; }

        /* ── Header ── */
        .app-header {
            background: var(--bg-surface);
            border-bottom: 1px solid var(--border-mid);
            padding: 14px 24px;
            display: flex; align-items: center; gap: 14px;
            flex-shrink: 0;
            position: relative;
            z-index: 10;
            backdrop-filter: blur(8px);
        }
        /* warm top accent line */
        .app-header::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: linear-gradient(90deg, var(--amber-dk) 0%, var(--amber) 30%, var(--jade) 70%, var(--amber-dk) 100%);
            opacity: 0.8;
        }

        .header-logo {
            width: 44px; height: 44px;
            background: var(--grad-amber);
            border-radius: var(--radius-md);
            display: flex; align-items: center; justify-content: center;
            font-size: 20px; flex-shrink: 0;
            box-shadow: var(--shadow-sm);
        }
        .header-text h1 {
            font-family: var(--font-display);
            font-size: 1.35rem; font-weight: 600;
            color: var(--text-primary);
            letter-spacing: 0.01em; line-height: 1.2;
        }
        .header-text p { font-size: var(--text-label); color: var(--text-sub); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 3px; }

        /* ── Pathway chip (IA Sprint Batch 1): read-only assignment-mode label ── */
        .pathway-chip {
            display: inline-flex; align-items: center;
            width: fit-content; margin-top: 4px; padding: 1px 9px;
            border: 1px solid var(--border-mid); border-radius: var(--radius-full);
            background: var(--bg-panel);
            font-size: var(--text-micro); font-weight: 600;
            letter-spacing: 0.05em; text-transform: uppercase;
            color: var(--text-sub);
            white-space: nowrap;
        }

        .header-stage-inline {
            color: var(--amber-text);
            font-weight: 600;
        }

        .theme-toggle {
            background: var(--bg-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            width: 38px; height: 38px;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; font-size: 1rem;
            color: var(--text-sub);
            transition: all var(--transition-fast);
            flex-shrink: 0;
        }
        .theme-toggle:hover {
            border-color: var(--amber);
            color: var(--amber-text);
            transform: scale(1.08);
        }
        .theme-toggle:focus-visible {
            outline: var(--focus-ring-strong);
            outline-offset: 2px;
        }

        .reset-btn {
            background: var(--bg-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            width: 38px; height: 38px;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; font-size: 1rem;
            color: var(--text-sub);
            transition: all var(--transition-fast);
            flex-shrink: 0;
        }
        .reset-btn:hover {
            border-color: #c0392b;
            color: #c0392b;
            transform: scale(1.08);
        }
        .reset-btn:focus-visible {
            outline: var(--focus-ring-danger);
            outline-offset: 2px;
        }

        .help-btn {
            background: var(--bg-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            width: 38px; height: 38px;
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; font-size: var(--text-subtitle); font-weight: 700;
            color: var(--text-sub);
            transition: all var(--transition-fast);
            flex-shrink: 0;
        }
        .help-btn:hover {
            border-color: var(--jade);
            color: var(--jade-text);
            transform: scale(1.08);
        }
        .help-btn:focus-visible {
            outline: var(--focus-ring-alt-strong);
            outline-offset: 2px;
        }

        .bug-report-btn {
            background: var(--bg-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            padding: 0 12px;
            height: 38px;
            display: inline-flex; align-items: center; justify-content: center;
            gap: 4px;
            cursor: pointer;
            font-size: var(--text-ui); font-weight: 600;
            color: var(--text-sub);
            transition: all var(--transition-fast);
            flex-shrink: 0;
            white-space: nowrap;
        }
        .bug-report-btn:hover {
            border-color: var(--jade);
            color: var(--jade-text);
            transform: scale(1.05);
        }
        .bug-report-btn:focus-visible {
            outline: var(--focus-ring-alt-strong);
            outline-offset: 2px;
        }
        .bug-report-btn.is-unavailable {
            opacity: 0.42;
            cursor: not-allowed;
            color: var(--text-muted);
            border-color: var(--border);
        }
        .bug-report-btn.is-unavailable:hover {
            transform: none;
            border-color: var(--border);
            color: var(--text-muted);
            background: var(--bg-raised);
        }
        @media (max-width: 640px) {
            .bug-report-label { display: none; }
            .bug-report-btn { padding: 0 8px; font-size: 1rem; }
        }

        /* ── Transition Import Card (Patch 26) ── */
        @keyframes ticSlideIn {
            from { opacity: 0; transform: translateY(-6px); }
            to   { opacity: 1; transform: translateY(0); }
        }
        .transition-import-card {
            margin: 0 20px 8px;
            padding: 12px 14px;
            background: rgba(42,122,106,0.07);
            border-left: 3px solid var(--jade);
            border-radius: var(--radius-sm);
            font-size: var(--text-ui);
            color: var(--text-primary);
            animation: ticSlideIn 0.2s ease;
            flex-shrink: 0;
        }
        .tic-title {
            font-weight: 600;
            margin: 0 0 4px;
            color: var(--jade-text);
            line-height: 1.35;
        }
        .tic-body {
            margin: 0 0 10px;
            color: var(--text-sub);
            line-height: 1.45;
        }
        .tic-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }
        .tic-btn {
            background: var(--bg-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            padding: 5px 12px;
            font-size: var(--text-ui);
            font-weight: 600;
            color: var(--text-sub);
            cursor: pointer;
            transition: all var(--transition-fast);
            white-space: nowrap;
        }
        .tic-btn:hover {
            border-color: var(--jade);
            color: var(--jade-text);
            background: var(--jade-glow);
        }
        .tic-btn:focus-visible {
            outline: var(--focus-ring-alt-strong);
            outline-offset: 2px;
        }
        .tic-btn-yes {
            background: var(--jade);
            border-color: var(--jade);
            color: #fff;
        }
        .tic-btn-yes:hover {
            background: var(--jade-dk);
            border-color: var(--jade-dk);
            color: #fff;
        }
        @media (max-width: 640px) {
            .transition-import-card { margin: 0 10px 8px; }
            .tic-btn { font-size: var(--text-note); padding: 5px 10px; }
        }

        .report-btn {
            background: var(--bg-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            padding: 8px 16px;
            font-family: var(--font-body);
            font-size: var(--text-note); font-weight: 600;
            color: var(--text-sub);
            cursor: pointer;
            transition: all var(--transition-fast);
            flex-shrink: 0;
            display: flex; align-items: center; gap: 6px;
            letter-spacing: 0.02em;
        }
        .report-btn:hover {
            border-color: var(--jade);
            color: var(--jade-text);
            transform: translateY(-1px);
        }
        .report-btn:focus-visible {
            outline: var(--focus-ring-alt-strong);
            outline-offset: 2px;
        }

        /* ── Draft Storage Warning ── */
        /* M4: quiet privacy reassurance — present and readable, but it should not
           compete with the draft for attention (neutral surface, hairline accent,
           muted ink; wording unchanged, no behavior change). */
        .draft-warning {
            background: transparent;
            border-left: 2px solid var(--border-hi);
            padding: 6px 14px;
            margin: 0 20px;
            border-radius: var(--radius-sm);
            font-size: var(--text-label);
            color: var(--text-muted);
            line-height: 1.45;
            display: flex;
            align-items: center;
            gap: 10px;
            flex-shrink: 0;
            position: relative;
        }
        .draft-warning-icon {
            font-size: var(--text-emph);
            flex-shrink: 0;
            opacity: 0.7;
        }
        .draft-warning strong {
            color: var(--text-sub);
            font-weight: 600;
        }
        .draft-warning-dismiss {
            background: none; border: none;
            color: var(--text-muted);
            font-size: var(--text-emph); cursor: pointer;
            padding: 2px 6px; margin-left: auto;
            line-height: 1; border-radius: var(--radius-sm);
            transition: all var(--transition-fast);
            flex-shrink: 0;
        }
        .draft-warning-dismiss:hover { color: var(--text-primary); background: var(--bg-panel); }

        /* ── Process Report Modal ── */
        .report-bg {
            position: fixed; inset: 0;
            background: rgba(42,33,28,0.65);
            backdrop-filter: blur(10px) saturate(1.1);
            display: flex; align-items: center; justify-content: center;
            z-index: 500;
            opacity: 0; pointer-events: none;
            transition: opacity var(--transition-medium);
            overflow-y: auto;
            padding: 40px 20px;
        }
        .report-bg.on { opacity: 1; pointer-events: all; }
        .report-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-lg);
            width: min(800px, 95vw);
            max-height: 90vh;
            overflow: hidden;
            display: flex; flex-direction: column;
            box-shadow: var(--shadow-lg);
            position: relative;
            margin: auto;
        }
        .report-card::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: linear-gradient(90deg, var(--amber-dk), var(--amber), var(--jade), var(--amber));
        }
        .report-header {
            padding: 22px 28px 16px;
            border-bottom: 1px solid var(--border-mid);
            display: flex; align-items: center; justify-content: space-between;
            flex-shrink: 0;
        }
        .report-title {
            font-family: var(--font-display);
            font-size: 1.25rem; font-weight: 600;
            color: var(--text-primary);
        }
        .report-sub {
            font-size: var(--text-note); color: var(--text-sub);
            margin-top: 3px; letter-spacing: 0.04em;
        }
        .report-close {
            background: none; border: none;
            font-size: 1.4rem; color: var(--text-muted);
            cursor: pointer; line-height: 1;
            padding: 4px;
            transition: color var(--transition-fast);
        }
        .report-close:hover { color: var(--text-primary); }
        .report-body {
            flex: 1; overflow-y: auto;
            padding: 24px 28px;
            display: flex; flex-direction: column;
            gap: 20px;
        }
        .report-section {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            overflow: hidden;
        }
        .report-section-header {
            padding: 12px 16px;
            background: var(--bg-surface);
            border-bottom: 1px solid var(--border);
            font-size: var(--text-ui); font-weight: 700;
            letter-spacing: 0.06em; text-transform: uppercase;
            color: var(--amber-text);
            display: flex; align-items: center; gap: 8px;
        }
        .report-section-body {
            padding: 14px 16px;
            font-size: var(--text-emph);
            line-height: 1.7;
            color: var(--text-primary);
            max-height: 240px;
            overflow-y: auto;
            white-space: pre-wrap;
            font-family: var(--font-mono);
        }
        .report-section-body.empty {
            color: var(--text-muted);
            font-style: italic;
            font-family: var(--font-body);
        }
        .report-persistence-note {
            border-top: 1px solid var(--border);
            padding: 8px 28px 12px;
            font-size: var(--text-label);
            color: var(--text-muted);
            line-height: 1.5;
        }
        .report-persistence-summary {
            display: flex; align-items: center; gap: 6px;
            cursor: pointer; list-style: none;
            padding: 4px 0;
            user-select: none;
        }
        .report-persistence-summary::-webkit-details-marker { display: none; }
        .report-persistence-summary::after {
            content: '▾';
            margin-left: auto;
            font-size: var(--text-micro);
            opacity: 0.5;
            transition: transform 0.2s;
        }
        .report-persistence-note:not([open]) .report-persistence-summary::after { transform: rotate(-90deg); }
        .report-persistence-body { padding: 4px 0 4px; }

        .report-note-box {
            background: var(--bg-panel);
            border: 2px solid var(--jade);
            border-radius: var(--radius-md);
            padding: 18px 20px;
        }
        .report-note-box h4 {
            font-family: var(--font-display);
            font-size: 1.05rem;
            color: var(--jade-text);
            margin-bottom: 10px;
        }
        .report-note-box p {
            font-size: var(--text-emph);
            color: var(--text-sub);
            line-height: 1.7;
            margin-bottom: 10px;
        }
        .report-note-box em {
            color: var(--text-primary);
            font-style: normal;
            font-weight: 600;
        }
        .report-pn-section { margin-bottom: 18px; }
        .report-pn-section:last-child { margin-bottom: 0; }
        .report-pn-title {
            font-weight: 600;
            font-size: var(--text-ui);
            color: var(--text-hi);
            margin-bottom: 6px;
            line-height: 1.4;
            font-family: var(--font-display);
        }
        .report-pn-static {
            font-size: var(--text-ui);
            line-height: 1.7;
            color: var(--text-hi);
            font-family: var(--font-mono);
            margin-bottom: 8px;
        }
        .report-pn-text {
            width: 100%;
            min-height: 72px;
            padding: 10px 12px;
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            background: var(--bg-base);
            color: var(--text-hi);
            font-family: var(--font-mono);
            font-size: var(--text-ui);
            line-height: 1.7;
            resize: vertical;
            transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
        }
        .report-pn-text:focus {
            outline: none;
            border-color: var(--jade);
            box-shadow: 0 0 0 3px rgba(34,197,94,0.12);
        }
        .report-pn-text::placeholder {
            color: var(--text-muted);
            font-style: italic;
        }
        .report-pn-label {
            font-size: var(--text-label);
            color: var(--text-lo);
            margin-top: 4px;
            display: block;
        }
        .report-pn-saved {
            font-size: var(--text-label);
            color: var(--jade);
            margin-top: 4px;
            display: block;
            opacity: 0;
            transition: opacity var(--transition-fast);
        }
        .report-pn-saved.show { opacity: 1; }
        .report-actions {
            padding: 18px 28px;
            border-top: 1px solid var(--border-mid);
            display: flex; gap: 10px;
            flex-wrap: wrap;
            flex-shrink: 0;
        }
        .report-export-hint {
            width: 100%; margin: 0 0 4px;
            font-size: var(--text-note); color: var(--text-muted); line-height: 1.4;
        }
        /* Final Submission Packet — recommended export path (Batch 5) */
        .packet-recommended {
            width: 100%; box-sizing: border-box;
            display: flex; flex-direction: column; gap: 8px;
            background: var(--jade-glow); border: 1px solid var(--jade);
            border-radius: var(--radius-md); padding: 14px 16px;
        }
        .packet-recommended-label {
            font-size: var(--text-caption); font-weight: 800; letter-spacing: 0.05em;
            text-transform: uppercase; color: var(--jade-text);
        }
        .packet-btn { align-self: stretch; justify-content: center; }
        .packet-note { margin: 2px 0 0; font-size: var(--text-note); color: var(--text-sub); line-height: 1.45; }
        .report-other-options { width: 100%; margin-top: 4px; }
        .report-other-options > summary {
            cursor: pointer; font-size: var(--text-ui); font-weight: 600;
            color: var(--text-sub); padding: 6px 0; list-style: revert;
        }
        .report-other-options[open] > summary { margin-bottom: 6px; }
        .report-other-options .report-action-btn { margin: 4px 6px 0 0; }
        /* Submission diagnostic banner (Batch 5) */
        .packet-diag {
            margin: 0 0 14px; padding: 12px 14px;
            border-radius: var(--radius-md); font-size: var(--text-body); line-height: 1.5;
        }
        .packet-diag--ok   { background: var(--jade-glow);  border: 1px solid var(--jade);  color: var(--jade-text); }
        .packet-diag--warn { background: var(--amber-glow); border: 1px solid var(--amber); color: var(--text-primary); }
        .packet-diag-title { font-weight: 800; margin-bottom: 6px; color: var(--amber-text); }
        .packet-diag-list { margin: 0; padding-left: 20px; }
        .packet-diag-list li { margin: 3px 0; }
        .ai-activity-summary {
            margin: 0 0 14px;
            padding: 11px 14px;
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            background: var(--bg-panel);
            color: var(--text-sub);
            font-size: var(--text-note);
        }
        .ai-activity-summary summary {
            min-height: 32px;
            display: flex;
            align-items: center;
            cursor: pointer;
            color: var(--text-primary);
            font-weight: 700;
        }
        .ai-activity-body {
            padding-top: 7px;
            line-height: 1.5;
        }
        .ai-activity-body p { margin: 0 0 5px; }
        .ai-activity-tokens { margin-top: 4px; color: var(--text-muted); }
        .report-action-btn {
            padding: 10px 20px;
            border-radius: var(--radius-full);
            font-family: var(--font-body);
            font-size: var(--text-body); font-weight: 700;
            cursor: pointer;
            transition: all var(--transition-fast);
            letter-spacing: 0.02em;
            border: none;
            display: flex; align-items: center; gap: 6px;
        }
        .report-action-btn.primary {
            background: var(--grad-amber);
            color: #fff;
            box-shadow: var(--shadow-sm);
        }
        .report-action-btn.primary:hover {
            filter: brightness(1.08);
            transform: translateY(-1px);
        }
        .report-action-btn.secondary {
            background: var(--bg-surface);
            color: var(--text-sub);
            border: 1px solid var(--border-hi);
        }
        .report-action-btn.secondary:hover {
            border-color: var(--jade);
            color: var(--jade-text);
        }
        .report-action-btn:focus-visible {
            outline: var(--focus-ring-strong);
            outline-offset: 2px;
        }

        /* ── Process Note Dedicated Modal ── */
        .pn-modal-bg {
            position: fixed; inset: 0;
            background: rgba(42,33,28,0.65);
            backdrop-filter: blur(10px) saturate(1.1);
            opacity: 0; pointer-events: none;
            transition: opacity 0.3s ease;
            z-index: 200;
            display: flex; align-items: center; justify-content: center;
            overflow-y: auto;
            padding: 40px 20px;
        }
        .pn-modal-bg.on { opacity: 1; pointer-events: all; }
        .pn-modal-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            width: 100%; max-width: 900px; min-height: 60vh; max-height: 88vh;
            display: flex; flex-direction: column;
            overflow: hidden;
            position: relative;
            margin: auto;
            animation: pnModalIn 0.35s ease;
        }
        @keyframes pnModalIn {
            from { opacity: 0; transform: translateY(16px) scale(0.98); }
            to   { opacity: 1; transform: translateY(0) scale(1); }
        }
        .pn-modal-card::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: linear-gradient(90deg, var(--amber-dk), var(--amber), var(--jade), var(--amber));
        }
        .pn-modal-header {
            padding: 24px 32px 16px;
            border-bottom: 1px solid var(--border-mid);
            display: flex; align-items: center; justify-content: space-between;
            flex-shrink: 0;
        }
        .pn-modal-title {
            font-family: var(--font-display);
            font-size: 1.35rem; font-weight: 600;
            color: var(--text-primary);
            line-height: 1.3;
        }
        .pn-modal-sub {
            font-size: var(--text-body); color: var(--text-sub);
            margin-top: 4px; letter-spacing: 0.04em;
        }
        .pn-modal-close {
            background: none; border: none;
            font-size: 1.3rem; color: var(--text-muted);
            cursor: pointer; line-height: 1;
            padding: 6px; border-radius: var(--radius-sm);
            transition: all var(--transition-fast);
        }
        .pn-modal-close:hover { color: var(--text-primary); background: var(--bg-panel); }
        .pn-modal-close:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .pn-modal-body {
            flex: 1; overflow-y: auto;
            padding: 28px 36px;
            display: flex; flex-direction: column;
        }
        .pn-modal-body .report-note-box {
            border: none; padding: 0; background: transparent;
        }
        .pn-modal-body .report-pn-text {
            min-height: 90px;
            padding: 12px 14px;
            font-size: var(--text-emph);
            border-radius: var(--radius-sm);
        }
        .pn-modal-body .report-pn-title {
            font-size: var(--text-emph);
        }
        .pn-modal-body .report-pn-static {
            font-size: var(--text-body);
        }
        .pn-modal-actions {
            padding: 16px 32px;
            border-top: 1px solid var(--border-mid);
            display: flex; gap: 12px; justify-content: flex-end;
            flex-shrink: 0;
            background: var(--bg-panel);
        }
        .pn-modal-btn {
            padding: 10px 24px;
            border-radius: var(--radius-full);
            font-family: var(--font-body);
            font-size: var(--text-emph); font-weight: 700;
            cursor: pointer;
            transition: all var(--transition-fast);
            letter-spacing: 0.02em;
            border: none;
            display: inline-flex; align-items: center; gap: 6px;
        }
        .pn-modal-btn.primary {
            background: var(--grad-amber);
            color: #fff;
            box-shadow: var(--shadow-sm);
        }
        .pn-modal-btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
        .pn-modal-btn.secondary {
            background: var(--bg-surface);
            color: var(--text-sub);
            border: 1px solid var(--border-hi);
        }
        .pn-modal-btn.secondary:hover { border-color: var(--jade); color: var(--jade-text); }
        .pn-modal-btn:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; }

        /* ── Completion Celebration Modal ── */
        .completion-bg {
            position: fixed; inset: 0;
            background: rgba(42,33,28,0.72);
            backdrop-filter: blur(12px) saturate(1.1);
            opacity: 0; pointer-events: none;
            transition: opacity 0.4s ease;
            z-index: 250;
            display: flex; align-items: center; justify-content: center;
            overflow-y: auto;
            padding: 40px 20px;
        }
        .completion-bg.on { opacity: 1; pointer-events: all; }
        .completion-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg), 0 0 40px var(--amber-glow);
            width: 100%; max-width: 560px;
            padding: 44px 40px 36px;
            text-align: center;
            position: relative;
            margin: auto;
            animation: completionIn 0.5s ease;
        }
        @keyframes completionIn {
            from { opacity: 0; transform: translateY(20px) scale(0.96); }
            to   { opacity: 1; transform: translateY(0) scale(1); }
        }
        .completion-card::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 4px;
            background: var(--grad-amber);
        }
        .completion-icon {
            font-size: 44px; margin-bottom: 14px;
            display: inline-flex;
        }
        .completion-badge {
            font-size: var(--text-caption); font-weight: 700;
            letter-spacing: 0.12em; text-transform: uppercase;
            color: var(--amber-text);
            margin-bottom: 8px;
        }
        .completion-title {
            font-family: var(--font-display);
            font-size: 1.4rem; font-weight: 600;
            color: var(--text-primary);
            line-height: 1.35;
            margin-bottom: 12px;
        }
        .completion-body {
            font-size: var(--text-subtitle);
            color: var(--text-sub);
            line-height: 1.75;
            margin-bottom: 24px;
        }
        .completion-body em {
            color: var(--amber-text); font-style: normal; font-weight: 600;
        }
        .completion-cta {
            display: inline-flex; align-items: center; gap: 6px;
            background: var(--grad-amber); color: #fff;
            border: none; padding: 12px 32px;
            border-radius: var(--radius-full);
            font-family: var(--font-body);
            font-size: var(--text-emph); font-weight: 700;
            cursor: pointer;
            letter-spacing: 0.02em;
            box-shadow: var(--shadow-sm);
            transition: all var(--transition-fast);
        }
        .completion-cta:hover { background: var(--grad-amber-hi); transform: translateY(-1px); }
        .completion-cta:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; }
        .completion-close {
            position: absolute; top: 12px; right: 14px;
            background: none; border: none; color: var(--text-muted);
            font-size: 1.2rem; cursor: pointer; padding: 6px;
            line-height: 1; border-radius: var(--radius-sm);
            transition: all var(--transition-fast);
        }
        .completion-close:hover { color: var(--text-primary); background: var(--bg-panel); }
        .completion-close:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

        @media (prefers-reduced-motion: reduce) {
            .pn-modal-card, .completion-card {
                animation: none;
            }
        }
        @media (max-width: 768px) {
            .pn-modal-card { max-height: 92vh; }
            .pn-modal-header { padding: 18px 20px 14px; }
            .pn-modal-body { padding: 20px 22px; }
            .pn-modal-actions { padding: 14px 20px; }
            .completion-card { padding: 32px 24px 28px; }
            .completion-title { font-size: 1.25rem; }
        }

        /* ── Journey Map ── */
        .journey-wrap {
            background: var(--bg-surface);
            border-bottom: 1px solid var(--border-mid);
            padding: 8px 20px 10px;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .mobile-stage-nav { display: none; }
        .journey-scroll {
            flex: 1;
            overflow-x: auto;
            scrollbar-width: thin;
            scrollbar-color: var(--border-mid) transparent;
            /* Soft right-edge fade so overflowing milestone labels dissolve instead of
               clipping hard against the "Ver todo/menos" toggle (Visual Polish Q4). */
            -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
        }
        .journey-track {
            display: flex; align-items: flex-start;
            min-width: max-content;
            /* Right padding lets the last milestone's labels scroll fully clear of the
               faded edge / toggle (Visual Polish Q4). */
            padding: 4px 36px 4px 8px;
            gap: 0;
        }

        /* Phase label strip above journey nodes */
        .phase-group {
            display: flex; flex-direction: column; align-items: flex-start;
            position: relative;
        }
        .phase-label-row {
            display: flex; align-items: flex-end;
            min-height: 20px; padding: 0 8px 4px;
        }
        .phase-label {
            font-size: 0.62rem; font-weight: 700; letter-spacing: 0.10em;
            text-transform: uppercase; color: var(--amber-text);
            opacity: 0.7; white-space: nowrap;
        }
        .phase-nodes { display: flex; align-items: flex-start; gap: 0; }

        /* ── Stage Description Strip ── */
        /* Toggle button */
        .journey-toggle {
            flex-shrink: 0;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 7px 14px;
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            background: var(--bg-raised);
            color: var(--text-sub);
            font-family: var(--font-body);
            font-size: var(--text-caption);
            font-weight: 600;
            cursor: pointer;
            transition: all var(--transition-fast);
            white-space: nowrap;
        }
        .journey-toggle:hover {
            background: var(--bg-base);
            border-color: var(--amber);
            color: var(--amber-text);
            transform: translateY(-1px);
        }
        .journey-toggle:active {
            transform: translateY(0);
        }
        .journey-toggle-icon {
            display: inline-flex;
            align-items: center;
            transition: transform 0.2s ease;
        }
        .journey-toggle.expanded .journey-toggle-icon {
            transform: rotate(180deg);
        }

        /* Compact mode: dim far-future stages — subdued but LEGIBLE (Visual Polish Q3:
           the old 0.12/0.2 ghosting read as a rendering failure, not de-emphasis). */
        .journey-track.compact .stage-node.dimmed,
        .journey-track.compact .phase-group:has(.stage-node.active ~ .stage-node.dimmed) .stage-node.dimmed {
            opacity: 0.38;
            pointer-events: none;
            filter: grayscale(0.5);
        }
        .journey-track.compact .stage-node.dimmed .stage-label {
            opacity: 0;
        }
        .journey-track.compact .stage-node.dimmed .stage-circle {
            transform: scale(0.82);
            opacity: 0.5;
        }
        /* Dim phase label when all stages in that phase are dimmed — students should
           still be able to READ the road ahead at a glance. */
        .journey-track.compact .phase-group:not(:has(.stage-node:not(.dimmed))) .phase-label {
            opacity: 0.5;
        }
        /* dim connectors leading into dimmed nodes */
        .journey-track.compact .stage-node.dimmed:not(:last-child)::after,
        .journey-track.compact .stage-node:has(+ .stage-node.dimmed):not(:last-child)::after {
            opacity: 0.3;
        }

        .stage-node {
            display: flex; flex-direction: column; align-items: center;
            gap: 7px; cursor: pointer; position: relative; padding: 0 22px;
        }
        /* Milestone header emphasis (Batch 1 — milestone simplification).
           Additive; scoped to .milestone-group so base .phase-* rules are untouched. */
        .milestone-group .phase-label { transition: color var(--transition-medium); }
        .milestone-group.ms-active .phase-label { color: var(--jade-text); font-weight: 800; }
        .milestone-group.ms-done   .phase-label { color: var(--amber-text); }
        /* Phase groups */
        .phase-group {
            display: flex; flex-direction: column; align-items: flex-start;
        }
        .phase-group + .phase-group { margin-left: 10px; }
        .phase-nodes { display: flex; align-items: flex-start; gap: 0; }
        .stage-node:hover .stage-circle { transform: scale(1.08); }

        /* connector */
        .stage-node:not(:last-child)::after {
            content: '';
            position: absolute; top: 20px;
            left: calc(50% + 21px);
            width: calc(100% - 42px); height: 2px;
            background: var(--border); z-index: 0;
            border-radius: 1px;
        }
        .stage-node.done:not(:last-child)::after {
            background: linear-gradient(90deg, var(--amber-dk), var(--amber));
            box-shadow: 0 0 8px var(--amber-glow);
        }

        .stage-circle {
            width: 42px; height: 42px;
            border-radius: var(--radius-full);
            border: 2px solid var(--border-mid);
            background: var(--bg-raised);
            display: flex; align-items: center; justify-content: center;
            font-size: var(--text-note); font-weight: 700;
            color: var(--text-sub);
            position: relative; z-index: 1;
            transition: all var(--transition-medium);
            flex-shrink: 0;
        }
        .stage-node.done .stage-circle {
            background: var(--grad-amber);
            border-color: var(--amber);
            color: #fff;
            box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.15);
        }
        .stage-node.active .stage-circle {
            background: var(--jade-dk);
            border-color: var(--jade);
            color: #fff;
            font-weight: 800;
            box-shadow: 0 0 0 4px var(--jade-glow), 0 0 16px var(--jade-glow);
            animation: stagePulse 3s ease-in-out infinite;
        }
        .stage-node.locked .stage-circle {
            background: var(--bg-surface);
            border-color: var(--border);
            color: var(--text-muted);
            opacity: 0.45;
        }
        /* ADHD Nav B2: upcoming steps stay visible for orientation but read as
           doors not yet open — dashed outline, slightly receded. The active node
           and the Stage-6 authorship gate keep their solid emphasis untouched. */
        .stage-node:not(.active):not([data-id="6"]) .stage-circle--upcoming {
            border-style: dashed;
            opacity: 0.8;
        }
        @keyframes stagePulse {
            0%,100% { box-shadow: 0 0 0 3px var(--jade-glow), 0 0 10px var(--jade-glow); }
            50%      { box-shadow: 0 0 0 6px var(--jade-glow), 0 0 20px var(--jade-glow); }
        }

        /* Stage 6 — authorship gate */
        .stage-node[data-id="6"] .stage-circle {
            width: 52px; height: 52px;
            border: 2.5px solid var(--amber-dk);
            background: linear-gradient(135deg, #FFF8F2 0%, #F5EDE0 100%);
            font-size: 1.1rem;
        }
        .stage-node[data-id="6"].active .stage-circle {
            border-color: var(--amber);
            background: linear-gradient(135deg, var(--amber-dk) 0%, var(--amber) 100%);
            box-shadow: 0 0 0 5px var(--amber-glow), 0 0 20px var(--amber-glow);
            animation: gateGlow 3s ease-in-out infinite;
        }
        .stage-node[data-id="6"].done .stage-circle {
            background: var(--grad-amber);
            border-color: var(--amber-dk);
        }
        @keyframes gateGlow {
            0%,100% { box-shadow: 0 0 0 4px var(--amber-glow), 0 0 12px var(--amber-glow); }
            50%      { box-shadow: 0 0 0 8px var(--amber-glow), 0 0 24px var(--amber-glow); }
        }

        /* Wave unlock animation on draft save */
        @keyframes waveUnlock {
            0%   { opacity: 0; transform: scale(0.6); }
            40%  { opacity: 1; transform: scale(1.15); }
            70%  { transform: scale(0.95); }
            100% { opacity: 0; transform: scale(1.4); }
        }
        .wave-unlock {
            position: fixed; inset: 0; pointer-events: none; z-index: 900;
            display: flex; align-items: center; justify-content: center;
        }
        .wave-unlock-ring {
            width: 180px; height: 180px; border-radius: 50%;
            border: 3px solid var(--amber);
            box-shadow: 0 0 40px var(--amber-glow);
            animation: waveUnlock 1.2s ease forwards;
        }

        .stage-label {
            font-size: var(--text-caption); font-weight: 600;
            color: var(--metal-mid); text-align: center;
            max-width: 80px; line-height: 1.35; white-space: normal;
            letter-spacing: 0.02em;
        }
        .stage-label .label-es { display: block; }
        .stage-label .label-en { display: block; color: var(--text-muted); font-size: var(--text-micro); font-weight: 400; margin-top: 3px; }
        .stage-node.done   .stage-label           { color: var(--amber-text); }
        .stage-node.done   .stage-label .label-en { color: var(--amber); }
        .stage-node.active .stage-label           { color: var(--jade-text); font-weight: 700; }
        .stage-node.active .stage-label .label-en { color: var(--jade); }

        /* ── Workspace ── */
        .workspace {
            display: grid;
            grid-template-columns: 50% 50%;
            flex: 1; overflow: hidden;
            transition: grid-template-columns var(--transition-slow);
        }
        .workspace.focus-mode {
            grid-template-columns: 1fr 0fr;
        }
        .workspace.focus-mode .chat-panel {
            opacity: 0; pointer-events: none; overflow: hidden;
        }
        .workspace.focus-mode .focus-hint {
            opacity: 1; pointer-events: all;
        }

        /* ── Draft Panel ── */
        .draft-panel {
            display: flex; flex-direction: column;
            background: var(--bg-panel);
            border-right: 1px solid var(--border);
            overflow: hidden;
            position: relative;
        }
        .draft-panel::before {
            content: '';
            position: absolute; inset: 0;
            background: radial-gradient(ellipse at 20% 0%, rgba(184,92,26,0.03) 0%, transparent 60%);
            pointer-events: none;
        }
        .panel-header {
            padding: 16px 24px 14px;
            border-bottom: 1px solid var(--border-mid);
            display: flex; align-items: flex-start; justify-content: space-between;
            flex-shrink: 0;
            background: var(--bg-surface);
            gap: 16px;
        }
        .panel-title {
            font-family: var(--font-display);
            font-size: 1.05rem; font-weight: 600;
            color: var(--text-primary); letter-spacing: 0.01em;
        }
        .panel-sub  { font-size: var(--text-caption); color: var(--text-sub); margin-top: 4px; letter-spacing: 0.06em; text-transform: uppercase; }
        .draft-stage-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 3px 10px;
            background: var(--jade-glow);
            border: 1px solid var(--jade);
            border-radius: var(--radius-full);
            font-size: var(--text-micro);
            font-weight: 700;
            color: var(--jade-text);
            letter-spacing: 0.04em;
            margin-left: 8px;
            vertical-align: middle;
        }
        /* Word count — textarea corner overlay */
        .draft-textarea-wrap { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
        .word-count {
            position: absolute; bottom: 12px; right: 14px;
            font-size: var(--text-caption); color: var(--text-muted); font-weight: 600;
            font-variant-numeric: tabular-nums;
            white-space: nowrap; pointer-events: none;
            opacity: 0.55; transition: opacity var(--transition-fast);
            z-index: 2;
        }
        .draft-textarea-wrap:focus-within .word-count { opacity: 0.9; }

        /* P1: autosave status — mirrors .word-count, bottom-left corner */
        .autosave-status {
            position: absolute; bottom: 12px; left: 14px;
            font-size: var(--text-caption); color: var(--text-muted); font-weight: 600;
            white-space: nowrap; pointer-events: none;
            opacity: 0.75; transition: opacity var(--transition-fast);
            z-index: 2;
        }
        /* ── Draft "start writing here" cue (IA Sprint Batch 3) ──
           Anchored inside the draft area, centered above the word-count/autosave row.
           Visibility is pure CSS: :placeholder-shown is true exactly while the
           textarea is EMPTY, so the cue tracks typing, stage switches, restored
           drafts, undo/redo, and imports with no JS, no listeners, and no storage.
           Also hidden when the area is disabled. pointer-events: none — informational
           only, never intercepts a tap meant for the textarea. */
        .draft-start-cue {
            position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
            display: inline-flex; align-items: center; gap: 6px;
            padding: 4px 12px;
            /* Opaque warm surface — amber tint layered OVER a solid panel — so the
               placeholder text can never show through the pill (Visual Polish Q1). */
            background: linear-gradient(var(--amber-glow), var(--amber-glow)), var(--bg-panel);
            border: 1px dashed var(--amber-text);
            border-radius: var(--radius-full);
            color: var(--amber-text);
            font-size: var(--text-caption); font-weight: 600;
            white-space: nowrap; pointer-events: none;
            z-index: 2;
        }
        .draft-textarea:not(:placeholder-shown) ~ .draft-start-cue,
        .draft-textarea:disabled ~ .draft-start-cue { display: none; }

        .autosave-status--saved { color: var(--jade, #5f8a65); }
        .autosave-status--error {
            color: var(--rose, #b3503e);
            opacity: 1;
            font-weight: 700;
            white-space: normal;
            max-width: 70%;
        }

        .draft-action-bar {
            display: flex; gap: 8px;
        }
        .draft-action-bar > * {
            flex: 1;
            min-width: 0;
        }
        .footer-btn {
            padding: 8px 10px;
            border-radius: var(--radius-sm);
            font-family: var(--font-body);
            font-size: var(--text-note); font-weight: 700;
            cursor: pointer;
            letter-spacing: 0.02em;
            display: inline-flex; align-items: center; justify-content: center;
            gap: 5px;
            transition: all var(--transition-fast);
            border: 1px solid var(--border);
            background: var(--bg-raised);
            color: var(--text-sub);
            white-space: nowrap;
        }
        .footer-btn:hover {
            background: var(--bg-panel);
            border-color: var(--border-hi);
            color: var(--text-primary);
        }
        .footer-btn svg {
            flex-shrink: 0;
        }
        .full-draft-review-btn {
            border-color: color-mix(in srgb, var(--jade) 52%, var(--border));
            background: linear-gradient(135deg, var(--jade-glow), var(--bg-raised));
            color: var(--jade-text);
        }
        .full-draft-review-btn[hidden] { display: none !important; }
        .full-draft-review-btn:hover:not(:disabled) {
            border-color: var(--jade);
            background: var(--jade-glow);
            color: var(--text-primary);
            transform: translateY(-1px);
        }
        .full-draft-review-btn:disabled {
            cursor: not-allowed;
            opacity: 0.48;
            transform: none;
        }

        .draft-textarea {
            flex: 1; padding: 24px 28px 40px;
            border: none; outline: none; resize: none;
            font-family: var(--font-display);
            font-style: italic;
            font-size: 1rem; line-height: 1.95;
            width: 100%; box-sizing: border-box;
            color: var(--text-primary);
            background: transparent;
            caret-color: var(--amber);
            overflow-y: auto;
            position: relative;
            z-index: 1;
        }
        .draft-textarea::placeholder { color: var(--text-muted); font-style: italic; line-height: 2; }
        .draft-textarea:disabled     { color: var(--text-sub); cursor: default; }
        .draft-textarea:focus { outline: none; }
        .draft-textarea { caret-color: var(--amber); }
        .draft-textarea:focus-visible {
            outline: var(--focus-ring-strong);
            outline-offset: -3px;
            border-radius: 4px;
        }

        /* ── Edit Toolbar ── */
        .edit-toolbar {
            display: flex; align-items: center; gap: 1px;
            padding: 5px 10px 4px;
            border-bottom: 1px solid var(--border);
            background: var(--bg-surface);
            flex-shrink: 0;
            flex-wrap: wrap;
            row-gap: 3px;
        }
        .etb-btn {
            display: inline-flex; align-items: center; gap: 3px;
            padding: 4px 8px;
            border: 1px solid transparent;
            border-radius: var(--radius-sm);
            background: none;
            color: var(--text-sub);
            font-family: var(--font-body);
            font-size: var(--text-caption); font-weight: 600;
            cursor: pointer; letter-spacing: 0.02em;
            transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
            white-space: nowrap; flex-shrink: 0;
        }
        .etb-btn:hover:not(:disabled) {
            background: var(--bg-raised);
            border-color: var(--border);
            color: var(--text-primary);
        }
        .etb-btn:focus-visible {
            outline: var(--focus-ring);
            outline-offset: 1px;
        }
        /* Visual Polish Q8: disabled editor controls look INTENTIONALLY off —
           muted ink, no surface, no border, consistent across the toolbar. */
        .etb-btn:disabled {
            opacity: 0.4; cursor: not-allowed;
            color: var(--text-muted);
            background: none;
            border-color: transparent;
        }
        .etb-btn svg { flex-shrink: 0; }

        /* Visual Polish Q7: the landing Continue button is styled inline (JS-injected);
           its focus ring was the browser-default blue — the one off-palette accent in
           the app's calmest screen. Warm, high-contrast, always-visible ring instead. */
        #landingContinueBtn:focus {
            outline: 3px solid var(--amber-dk);
            outline-offset: 3px;
        }
        .etb-sep {
            width: 1px; height: 16px; background: var(--border);
            margin: 0 3px; flex-shrink: 0; align-self: center;
        }
        .etb-status-area {
            margin-left: auto; display: flex; align-items: center;
            padding-left: 6px;
        }
        .etb-status {
            font-size: var(--text-micro); font-weight: 600;
            color: var(--jade-text); white-space: nowrap;
            min-height: 1em; transition: opacity 0.2s;
        }
        .etb-status:empty { opacity: 0; }
        .etb-status-live {
            position: absolute; width: 1px; height: 1px;
            overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
        }
        @media (max-width: 480px) {
            .etb-sep { display: none; }
            .edit-toolbar { gap: 2px; padding: 4px 8px 5px; }
        }

        /* Save animation */
        @keyframes saveBloom {
            0%   { box-shadow: var(--shadow-md); transform: scale(1); }
            30%  { box-shadow: 0 0 0 8px var(--amber-glow), var(--shadow-lg); transform: scale(1.02); }
            100% { box-shadow: var(--shadow-md); transform: scale(1); }
        }
        .save-btn.saving {
            animation: saveBloom 0.6s ease;
        }
        @keyframes inkFlow {
            0%   { opacity: 0; transform: translateY(10px) scale(0.9); }
            40%  { opacity: 1; transform: translateY(0) scale(1); }
            100% { opacity: 0; transform: translateY(-20px) scale(1.1); }
        }
        .save-ink {
            position: absolute;
            inset: 0;
            display: flex; align-items: center; justify-content: center;
            pointer-events: none;
        }
        .save-ink span {
            display: block;
            width: 120px; height: 120px;
            border-radius: 50%;
            background: radial-gradient(circle, var(--amber-glow) 0%, transparent 70%);
            animation: inkFlow 0.8s ease forwards;
        }

        .draft-footer {
            padding: 6px 12px 8px;
            border-top: 1px solid var(--border-mid);
            background: var(--bg-surface);
            flex-shrink: 0;
            display: flex; flex-direction: column; gap: 3px;
        }
        /* amber save button — the most important action on the screen */
        .save-btn {
            width: 100%; padding: 8px 10px;
            background: var(--grad-amber);
            color: #fff;
            border: none; border-radius: var(--radius-sm);
            font-family: var(--font-body);
            font-size: var(--text-body); font-weight: 700;
            cursor: pointer; letter-spacing: 0.04em;
            display: flex; align-items: center; justify-content: center; gap: 10px;
            transition: all var(--transition-medium);
            box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.15);
            position: relative; overflow: hidden;
        }
        .save-btn::after {
            content: '';
            position: absolute; inset: 0;
            background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 60%);
            pointer-events: none;
        }
        .save-btn:hover:not(:disabled) {
            background: var(--grad-amber-hi);
            transform: translateY(-1px);
            box-shadow: 0 6px 24px var(--amber-glow), inset 0 1px 0 rgba(255,255,255,0.25);
        }
        .save-btn:disabled {
            background: var(--bg-raised);
            color: var(--text-muted);
            cursor: not-allowed; transform: none;
            box-shadow: none;
            border: 1px solid var(--border);
        }
        .save-btn.saved {
            background: var(--grad-success);
            color: var(--bg-base);
            cursor: default;
            box-shadow: 0 2px 16px var(--success-glow), inset 0 1px 0 rgba(255,255,255,0.1);
        }

        /* Visual Polish Q2: the continue action is THE primary action of the draft
           panel — filled amber so exactly one button leads; siblings stay ghost. */
        .continue-btn {
            width: 100%; padding: 9px 10px;
            background: var(--grad-amber);
            color: #fff;
            border: 1px solid var(--amber-dk);
            border-radius: var(--radius-sm);
            font-family: var(--font-body);
            font-size: var(--text-body); font-weight: 700;
            cursor: pointer; letter-spacing: 0.04em;
            display: flex; align-items: center; justify-content: center; gap: 10px;
            transition: all var(--transition-medium);
        }
        .continue-btn:hover:not(:disabled) {
            background: var(--grad-amber-hi);
            border-color: var(--amber-dk);
            transform: translateY(-1px);
        }
        .continue-btn:focus-visible {
            outline: 3px solid var(--amber-dk);
            outline-offset: 2px;
        }
        /* Disabled = quiet ghost ("not yet"), not translucent amber — the gate state
           must read as intentionally inactive. */
        .continue-btn:disabled {
            background: var(--bg-raised);
            color: var(--text-muted);
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
            border-color: var(--border);
        }
        .continue-btn--ready {
            border-color: var(--jade);
            box-shadow: 0 0 0 3px var(--jade-glow);
        }

        .saved-notice {
            display: none; align-items: center; gap: 10px;
            padding: 12px 16px;
            background: rgba(74,124,89,0.08);
            border: 1px solid var(--success);
            border-radius: var(--radius-sm);
            font-size: var(--text-body); color: var(--success); font-weight: 600;
        }
        .saved-notice.on { display: flex; }
        .draft-footer-note { font-size: var(--text-label); color: var(--text-muted); text-align: center; letter-spacing: 0.02em; }
        .draft-footer-note.hidden { display: none; }

        /* ── Chat Progress Panel ── */
        .chat-progress {
            background: var(--bg-surface);
            border-bottom: 1px solid var(--border-mid);
            flex-shrink: 0;
        }
        .chat-progress-toggle {
            display: inline-flex; align-items: center; gap: 6px;
            background: none;
            border: none;
            padding: 6px 18px;
            min-height: 36px;
            font-size: var(--text-caption); font-weight: 600;
            color: var(--text-sub);
            cursor: pointer; letter-spacing: 0.03em;
            transition: all var(--transition-fast);
            width: 100%;
        }
        .chat-progress-toggle:hover {
            color: var(--text-primary);
            background: var(--bg-panel);
        }
        .chat-progress-toggle .tp-icon svg {
            transition: transform var(--transition-fast);
        }
        .chat-progress.collapsed .chat-progress-toggle .tp-icon svg {
            transform: rotate(180deg);
        }
        .chat-progress-body {
            display: grid;
            grid-template-rows: 1fr;
            transition: grid-template-rows 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
            opacity: 1;
        }
        .chat-progress-inner {
            overflow: hidden;
            padding: 0 22px 12px;
            display: flex; flex-direction: column; gap: 8px;
        }
        /* B4: warm framing line above the progress artifacts */
        .cp-warm-line {
            font-size: var(--text-caption); color: var(--text-muted);
            font-style: italic; letter-spacing: 0.02em;
        }
        .chat-progress.collapsed .chat-progress-body {
            grid-template-rows: 0fr;
            opacity: 0;
        }

        /* ── Revision Decision Log ── */
        .decision-log {
            display: none;
            margin-top: 10px;
            padding: 10px 12px;
            background: var(--bg-input);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            font-size: var(--text-note);
            color: var(--text-sub);
            max-height: 120px;
            overflow-y: auto;
        }
        .decision-log.on { display: block; }
        .decision-log.collapsed .decision-log-items { display: none; }
        .decision-log-toggle { font-size: var(--text-micro); color: var(--text-muted); margin-left: 6px; }

        /* Skip link */
        .skip-link {
            position: absolute;
            top: -40px;
            left: 0;
            background: var(--amber);
            color: #fff;
            padding: 8px 16px;
            z-index: 10000;
            font-family: var(--font-body);
            font-size: var(--text-body);
            font-weight: 600;
            text-decoration: none;
            border-radius: 0 0 var(--radius-sm) 0;
            transition: top var(--transition-fast);
        }
        .skip-link:focus {
            top: 0;
            outline: var(--focus-ring-alt-strong);
            outline-offset: 2px;
        }
        .decision-log-header {
            font-weight: 700;
            font-size: var(--text-caption);
            letter-spacing: 0.06em;
            cursor: pointer;
            user-select: none;
            display: flex;
            align-items: center;
            justify-content: space-between;
            text-transform: uppercase;
            color: var(--amber-text);
            margin-bottom: 6px;
            display: flex; align-items: center; gap: 6px;
        }
        .decision-log-item {
            padding: 4px 0;
            border-bottom: 1px solid var(--border);
            display: flex; align-items: center; gap: 6px;
        }
        .decision-log-item:last-child { border-bottom: none; }
        .decision-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
        .decision-dot.good { background: var(--success); }
        .decision-dot.warn { background: var(--amber); }
        .decision-dot.flag { background: var(--warn); }
        .decision-dot.check { background: var(--metal-mid); }  /* revision check (Pause-and-Reflect) — neutral */

        /* ── Chat Panel ── */
        .chat-panel {
            display: flex; flex-direction: column;
            background: var(--bg-base);
            overflow: hidden;
            min-height: 0;
            transition: opacity var(--transition-slow);
            position: relative;
            /* Size container so panel-clipped overlays (stuck triage) can cap
               their height against the panel itself via cqh — viewport units
               alone cannot know where the panel's overflow clip begins. */
            container-type: size;
        }
        .chat-panel::before {
            content: '';
            position: absolute; inset: 0;
            background: radial-gradient(ellipse at 80% 100%, rgba(42,122,106,0.03) 0%, transparent 50%);
            pointer-events: none;
        }
        .focus-hint {
            position: absolute; right: 12px; top: 50%;
            transform: translateY(-50%);
            opacity: 0; pointer-events: none;
            transition: opacity var(--transition-slow);
            z-index: 50;
        }
        .focus-hint button {
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-full);
            padding: 10px 18px;
            font-family: var(--font-body);
            font-size: var(--text-body); font-weight: 600;
            color: var(--text-sub);
            cursor: pointer;
            box-shadow: var(--shadow-md);
            transition: all var(--transition-fast);
        }
        .focus-hint button:hover {
            border-color: var(--jade);
            color: var(--jade-text);
            transform: translateX(-2px);
        }
        .chat-header {
            padding: 10px 18px;
            background: var(--bg-surface);
            border-bottom: 1px solid var(--border-mid);
            display: flex; align-items: center; gap: 10px;
            flex-shrink: 0;
            position: relative;
            z-index: 1;
        }
        .chat-avatar {
            width: 38px; height: 38px;
            background: var(--bg-raised);
            border: 2px solid var(--border-hi);
            border-radius: var(--radius-md);
            display: flex; align-items: center; justify-content: center;
            font-size: 17px; flex-shrink: 0;
            box-shadow: var(--shadow-sm);
        }
        .chat-name   { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; color: var(--text-primary); }
        .chat-status { font-size: var(--text-note); color: var(--jade-text); font-weight: 700; margin-top: 2px; letter-spacing: 0.04em; }
        .chat-status.idle { color: var(--text-muted); }
        @keyframes status-pulse {
            0%, 100% { transform: scale(1);    opacity: 1; }
            50%       { transform: scale(1.22); opacity: 0.65; }
        }
        .status-dot {
            display: inline-block;
            animation: status-pulse 2s ease-in-out infinite;
            will-change: transform, opacity;
        }
        @media (prefers-reduced-motion: reduce) {
            .status-dot { animation: none; }
        }

        .chat-stage-tag {
            margin-left: auto;
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            color: var(--jade-text);
            font-size: var(--text-caption); font-weight: 700;
            padding: 6px 16px;
            border-radius: var(--radius-full);
            text-transform: uppercase; letter-spacing: 0.06em;
            white-space: nowrap;
            box-shadow: var(--shadow-sm);
        }

        .chat-messages {
            flex: 1; overflow-y: auto;
            padding: 14px 18px 8px;
            display: flex; flex-direction: column; gap: 12px;
            scroll-behavior: smooth;
            position: relative;
            z-index: 1;
            min-height: 0;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
            touch-action: pan-y;
        }

        .msg {
            display: flex; gap: 9px;
            max-width: 88%;
            animation: msgIn 0.25s ease;
        }
        .msg.user { align-self: flex-end; flex-direction: row-reverse; }
        .msg.bot  { align-self: flex-start; }
        @keyframes msgIn {
            from { opacity: 0; transform: translateY(8px); }
            to   { opacity: 1; transform: translateY(0); }
        }

        .msg-avatar {
            width: 27px; height: 27px;
            border-radius: var(--radius-sm);
            display: flex; align-items: center; justify-content: center;
            font-size: 12px; flex-shrink: 0; margin-top: 3px;
        }
        .msg.bot  .msg-avatar { background: var(--bg-raised); border: 1px solid var(--border-hi); }
        .msg.user .msg-avatar { background: var(--amber); color: #fff; font-weight: 700; font-size: 9px; }

        .msg-bubble {
            padding: 13px 17px;
            border-radius: var(--radius-md);
            font-size: var(--text-emph); line-height: 1.7;
            white-space: pre-wrap;
        }
        .msg.bot .msg-bubble {
            background: var(--bg-raised);
            color: var(--text-primary);
            border: 1px solid var(--border);
            border-bottom-left-radius: 4px;
            box-shadow: var(--shadow-sm);
        }
        .msg.user .msg-bubble {
            background: var(--amber);
            color: #fff;
            border: 1px solid var(--amber-dk);
            border-bottom-right-radius: 4px;
            box-shadow: var(--shadow-sm);
        }

        .system-note {
            text-align: center; font-size: var(--text-ui);
            color: var(--text-sub); font-style: italic;
            padding: 4px 16px; letter-spacing: 0.02em;
        }

        /* Message type visual hierarchy */
        .msg.msg-type-welcome .msg-bubble,
        .msg.msg-type-system  .msg-bubble {
            font-size: var(--text-ui);
            color: var(--text-sub);
            background: transparent;
            border-color: var(--border);
            box-shadow: none;
            padding: 8px 14px;
        }
        .msg.msg-type-welcome .msg-avatar,
        .msg.msg-type-system  .msg-avatar { opacity: 0.45; }
        .msg.msg-type-welcome .msg-time,
        .msg.msg-type-system  .msg-time   { opacity: 0.4; font-size: var(--text-caption); }

        /* Restored messages from prior sessions are quieter */
        .msg-restored {
            opacity: 0.6;
            transition: opacity 0.3s;
        }
        .msg-restored.msg-current,
        .msg-restored:hover {
            opacity: 1;
        }

        /* Current actionable coach message — the one the student should read now */
        .msg-current .msg-bubble {
            border-color: var(--amber);
            box-shadow: 0 0 0 1px var(--amber-dk), var(--shadow-md);
        }
        .msg-current .msg-avatar {
            background: var(--amber-glow);
            border-color: var(--amber);
        }
        .msg-current .msg-bubble::before {
            content: 'Actual · Current';
            display: block;
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--amber-text);
            margin-bottom: 6px;
            opacity: 0.85;
        }

        /* Live system notes container — keeps latest visible, archives older */
        .live-sys-notes {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .live-sys-notes .system-note {
            margin: 0;
        }
        .live-sys-notes .collapsed-sys {
            margin: 2px 0;
            order: -1;
        }

        /* Collapsed system message group */
        .collapsed-sys {
            margin: 6px auto 4px;
            max-width: 88%;
            font-size: var(--text-note);
            color: var(--text-sub);
        }
        .collapsed-sys > summary {
            display: flex; align-items: center; gap: 8px;
            cursor: pointer;
            list-style: none;
            padding: 5px 12px;
            border-radius: var(--radius-sm);
            border: 1px dashed var(--border);
            user-select: none;
        }
        .collapsed-sys > summary::-webkit-details-marker { display: none; }
        .collapsed-sys > summary:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .collapsed-sys > summary:hover { border-color: var(--border-hi); color: var(--text-primary); }
        .collapsed-sys-label { flex: 1; font-style: italic; }
        .collapsed-sys-hint  { font-size: var(--text-caption); opacity: 0.6; }
        .collapsed-sys[open] .collapsed-sys-hint { display: none; }
        .collapsed-sys-item {
            padding: 4px 12px;
            font-size: var(--text-label);
            color: var(--text-sub);
            border-left: 2px solid var(--border);
            margin: 3px 0 3px 8px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }

        /* Live technical-details panel — system/status messages hidden by default */
        .sys-tech-panel {
            margin: 10px auto 4px;
            max-width: 90%;
            font-size: var(--text-note);
            color: var(--text-sub);
        }
        .sys-tech-panel > summary {
            display: flex; align-items: center; gap: 8px;
            cursor: pointer; list-style: none;
            padding: 4px 10px; border-radius: var(--radius-sm);
            border: 1px dotted var(--border);
            user-select: none; opacity: 0.65;
            transition: opacity 0.15s;
        }
        .sys-tech-panel > summary::-webkit-details-marker { display: none; }
        .sys-tech-panel > summary:focus-visible { outline: var(--focus-ring); outline-offset: 2px; opacity: 1; }
        .sys-tech-panel > summary:hover { opacity: 1; border-color: var(--border-hi); }
        .sys-tech-label { flex: 1; font-style: italic; font-size: var(--text-label); }
        .sys-tech-hint  { font-size: var(--text-micro); opacity: 0.55; }
        .sys-tech-panel[open] .sys-tech-hint { display: none; }
        .sys-tech-body  { padding: 3px 0 2px; }
        .sys-tech-item  {
            display: flex; align-items: baseline; gap: 6px;
            padding: 3px 10px 3px 12px; margin: 2px 0 2px 4px;
            font-size: var(--text-caption); color: var(--text-sub);
            border-left: 1px dotted var(--border);
        }
        .sys-tech-item-label { flex: 1; }
        .sys-tech-count {
            font-size: var(--text-micro); color: var(--text-muted);
            background: var(--bg-surface); border-radius: 3px;
            padding: 0 4px; white-space: nowrap; flex-shrink: 0;
        }
        /* Count badge on inline system notes (dedup) */
        .sys-note-count {
            font-size: var(--text-micro); color: var(--text-muted);
            background: var(--bg-surface); border-radius: 3px;
            padding: 0 4px; margin-left: 6px;
        }
        /* Compact welcome/greeting strip — quieter than a full bot bubble */
        /* De-overwhelm B2: orientation strips read one step quieter than coach
           replies — guidance present but never competing with the conversation.
           Content unchanged; CSS-only. */
        .welcome-strip {
            display: flex; align-items: flex-start; gap: 8px;
            padding: 7px 16px 7px 14px; margin: 2px 0;
            font-size: var(--text-note); color: var(--text-sub);
            border-left: 2px solid var(--border);
            white-space: pre-line; line-height: 1.45;
        }
        .welcome-strip-icon { opacity: 0.38; flex-shrink: 0; margin-top: 2px; }

        /* Typing */
        .typing { display: none; align-items: center; gap: 9px; padding: 0 0 4px; }
        .typing.on { display: flex; }
        .typing-bubble {
            background: var(--bg-raised);
            border: 1px solid var(--border);
            padding: 12px 16px;
            border-radius: var(--radius-md);
            border-bottom-left-radius: 4px;
            box-shadow: var(--shadow-sm);
            display: flex; gap: 6px; align-items: center;
        }
        .dot {
            width: 6px; height: 6px;
            border-radius: var(--radius-full);
            background: var(--border-hi);
            animation: dotBounce 1.3s infinite;
        }
        .dot:nth-child(2) { animation-delay: 0.18s; }
        .dot:nth-child(3) { animation-delay: 0.36s; }
        @keyframes dotBounce {
            0%,60%,100% { transform: translateY(0); }
            30%          { transform: translateY(-6px); }
        }

        /* ── Chat Input ── */
        .chat-input-wrap {
            padding: 10px 16px 12px;
            background: var(--bg-surface);
            border-top: 1px solid var(--border-mid);
            flex-shrink: 0;
        }
        .input-row {
            display: flex; gap: 10px; align-items: flex-end;
            background: var(--bg-input);
            border: 2px solid var(--border-hi);
            border-radius: var(--radius-md);
            padding: 10px 14px;
            transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
        }
        .input-row:focus-within {
            border-color: var(--jade);
            box-shadow: 0 0 0 3px var(--jade-glow);
        }
        .chat-input {
            flex: 1; border: none; background: transparent; outline: none;
            font-family: var(--font-body);
            font-size: var(--text-emph); color: var(--text-primary);
            resize: none; min-height: 24px; max-height: 120px; line-height: 1.55;
            caret-color: var(--jade);
        }
        .chat-input::placeholder { color: var(--text-muted); }

        .send-btn {
            width: 38px; height: 38px;
            background: var(--jade-dk);
            border: 1px solid var(--jade);
            border-radius: var(--radius-sm);
            color: #fff; cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            flex-shrink: 0; transition: all var(--transition-fast);
            box-shadow: var(--shadow-sm);
        }
        .send-btn:hover:not(:disabled) {
            background: var(--jade);
            box-shadow: var(--shadow-md);
            transform: scale(1.06);
        }
        .send-btn:focus-visible {
            outline: var(--focus-ring-alt-strong);
            outline-offset: 2px;
        }
        .send-btn:disabled {
            background: var(--bg-raised);
            border-color: var(--border);
            cursor: not-allowed; transform: none;
            box-shadow: none; opacity: 0.4;
        }
        /* B2: keyboard hint is reference info, not a task — quietest text step. */
        .input-hint { font-size: var(--text-micro); color: var(--text-muted); text-align: center; margin-top: 8px; letter-spacing: 0.03em; opacity: 0.85; }

        /* ── Stage Tooltip ── */
        .tooltip {
            position: fixed;
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            color: var(--text-primary);
            padding: 11px 15px;
            border-radius: var(--radius-sm);
            font-size: var(--text-caption); line-height: 1.6;
            max-width: 230px; z-index: 200;
            pointer-events: none;
            opacity: 0; transition: opacity 0.18s;
            box-shadow: var(--shadow-md), 0 0 20px rgba(42,33,28,0.15);
        }
        .tooltip strong { color: var(--accent-text); display: block; margin-bottom: 4px; font-size: var(--text-label); }
        .tooltip.on { opacity: 1; }

        /* ── Celebration Modal ── */
        .modal-bg {
            position: fixed; inset: 0;
            background: rgba(42,33,28,0.65);
            backdrop-filter: blur(10px) saturate(1.1);
            display: flex; align-items: center; justify-content: center;
            z-index: 300;
            opacity: 0; pointer-events: none;
            transition: opacity var(--transition-medium);
        }
        .modal-bg.on { opacity: 1; pointer-events: all; }
        .modal-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            padding: 44px 40px;
            border-radius: var(--radius-lg);
            text-align: center; max-width: 440px;
            box-shadow: var(--shadow-lg);
            transform: scale(0.92) translateY(16px);
            transition: transform var(--transition-medium);
            position: relative; overflow: hidden;
        }
        /* amber top line on card */
        .modal-card::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 2px;
            background: var(--grad-amber);
        }
        .modal-bg.on .modal-card { transform: scale(1) translateY(0); }
        .modal-icon  { font-size: 48px; margin-bottom: 14px; }
        .modal-title {
            font-family: var(--font-display);
            font-size: 1.6rem;
            color: var(--amber-text);
            margin-bottom: 10px;
        }
        .modal-body  { font-size: var(--text-subtitle); color: var(--text-sub); line-height: 1.75; margin-bottom: 28px; }
        .modal-btn {
            background: var(--grad-amber);
            color: #fff;
            border: none; padding: 14px 36px;
            border-radius: var(--radius-full);
            font-family: var(--font-body); font-size: var(--text-subtitle); font-weight: 700;
            cursor: pointer; transition: all var(--transition-fast); letter-spacing: 0.04em;
            box-shadow: var(--shadow-sm);
        }
        .modal-btn:hover:not(:disabled) { background: var(--grad-amber-hi); transform: translateY(-1px); }
        .modal-btn:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; }
        .modal-btn:disabled {
            background: var(--border-mid);
            color: var(--text-sub);
            cursor: not-allowed;
            transform: none;
            box-shadow: none;
        }

        /* ── Stage Preview Modal ── */
        .stage-preview-bg {
            position: fixed; inset: 0;
            background: rgba(42,33,28,0.72);
            backdrop-filter: blur(12px) saturate(1.1);
            display: flex; align-items: center; justify-content: center;
            z-index: 310;
            opacity: 0; pointer-events: none;
            transition: opacity var(--transition-medium);
        }
        .stage-preview-bg.on { opacity: 1; pointer-events: all; }
        .stage-preview-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            padding: 36px 40px 40px;
            border-radius: var(--radius-lg);
            max-width: 560px; width: 92vw;
            box-shadow: var(--shadow-lg);
            transform: scale(0.94) translateY(20px);
            transition: transform var(--transition-medium);
            position: relative; overflow: hidden;
        }
        .stage-preview-bg.on .stage-preview-card { transform: scale(1) translateY(0); }
        .stage-preview-card::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: var(--grad-amber);
        }
        .stage-preview-header {
            display: flex; align-items: baseline; gap: 12px;
            margin-bottom: 8px;
        }
        .stage-preview-num {
            display: inline-flex; align-items: center; justify-content: center;
            width: 32px; height: 32px; border-radius: 50%;
            background: var(--grad-amber);
            color: #fff; font-family: var(--font-display);
            font-size: var(--text-subtitle); font-weight: 700; flex-shrink: 0;
        }
        .stage-preview-title {
            font-family: var(--font-display);
            font-size: 1.35rem;
            color: var(--amber-text);
            line-height: 1.3;
        }
        .stage-preview-subtitle {
            font-size: var(--text-body); color: var(--text-sub);
            margin-bottom: 20px; padding-left: 44px;
            letter-spacing: 0.02em;
        }
        .stage-preview-desc {
            font-size: var(--text-subtitle); color: var(--text-main);
            line-height: 1.7; margin-bottom: 20px;
        }
        .stage-preview-example {
            background: var(--bg-panel);
            border: 1px solid var(--border-mid);
            border-left: 3px solid var(--amber);
            border-radius: var(--radius-sm);
            padding: 12px 18px;
            margin-bottom: 28px;
        }
        .stage-preview-example[hidden] { display: none; }
        .stage-preview-example-label {
            font-size: var(--text-micro); font-weight: 700;
            text-transform: uppercase; letter-spacing: 0.08em;
            color: var(--amber-text);
            display: flex; align-items: center; gap: 6px;
            cursor: pointer; user-select: none;
        }
        .stage-preview-example-label::-webkit-details-marker { display: none; }
        .stage-preview-example-label::marker { display: none; }
        .stage-preview-example[open] .preview-example-arrow { transform: rotate(180deg); }
        .preview-example-arrow { transition: transform 0.2s ease; flex-shrink: 0; }
        @media (prefers-reduced-motion: reduce) { .preview-example-arrow { transition: none; } }
        .stage-preview-example pre {
            margin: 0; font-family: var(--font-body);
            font-size: var(--text-emph); line-height: 1.65;
            color: var(--text-sub);
            white-space: pre-wrap; word-break: break-word;
        }
        .stage-preview-btn {
            background: var(--grad-amber);
            color: #fff;
            border: none; padding: 14px 40px;
            border-radius: var(--radius-full);
            font-family: var(--font-body); font-size: var(--text-subtitle); font-weight: 700;
            cursor: pointer; transition: all var(--transition-fast); letter-spacing: 0.04em;
            box-shadow: var(--shadow-sm);
            display: inline-flex; align-items: center; gap: 8px;
        }
        .stage-preview-btn:hover { background: var(--grad-amber-hi); transform: translateY(-1px); }
        .stage-preview-btn:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; }

        /* Stage preview — completed milestone + back link */
        .preview-completed {
            display: flex; align-items: flex-start; gap: 8px;
            font-size: var(--text-ui); color: var(--jade-text);
            background: var(--bg-panel);
            border: 1px solid var(--jade-glow);
            border-radius: var(--radius-sm);
            padding: 8px 12px;
            margin-bottom: 18px;
            line-height: 1.55;
        }
        .preview-completed-icon {
            flex-shrink: 0; margin-top: 1px;
        }
        .preview-completed[hidden] { display: none; }
        .preview-actions {
            display: flex; flex-direction: column; align-items: stretch; gap: 10px;
            margin-top: 4px;
        }
        .preview-back-btn {
            background: none; border: none;
            color: var(--text-muted); font-family: var(--font-body);
            font-size: var(--text-ui); cursor: pointer;
            padding: 4px 0; text-align: center;
            transition: color var(--transition-fast);
            text-decoration: underline; text-underline-offset: 3px;
        }
        .preview-back-btn:hover { color: var(--text-sub); }
        .preview-back-btn:focus-visible { outline: var(--focus-ring); outline-offset: 2px; border-radius: 2px; }

        /* Stage 6 footer — Guardar as sole dominant action */
        .draft-footer--s6 .draft-action-bar {
            flex-wrap: wrap;
        }
        .draft-footer--s6 .save-btn {
            order: 3;
            flex-basis: 100%;
            padding: 11px 10px;
            font-size: var(--text-emph);
        }

        /* Continue button — stage-specific label visibility */
        .continue-btn-label-es,
        .continue-btn-label-en {
            display: inline;
        }

        /* ── Voice Vault ── */
        .voice-vault {
            background: var(--bg-panel);
            border: 1px solid var(--jade-glow);
            border-left: 3px solid var(--jade);
            border-radius: var(--radius-sm);
            margin: 0;
            flex-shrink: 0;
            overflow: hidden;
        }
        .voice-vault > summary {
            display: flex; align-items: center; gap: 7px;
            padding: 7px 12px;
            cursor: pointer; user-select: none;
            font-size: var(--text-label); font-weight: 700;
            color: var(--jade-text);
            letter-spacing: 0.02em;
            list-style: none;
        }
        .voice-vault > summary::-webkit-details-marker { display: none; }
        .voice-vault > summary::marker { display: none; }
        .voice-vault > summary:focus-visible { outline: var(--focus-ring-alt); outline-offset: -2px; }
        .vault-toggle-arrow { margin-left: auto; font-size: 0.65rem; color: var(--text-muted); transition: transform 0.2s; }
        @media (prefers-reduced-motion: reduce) { .vault-toggle-arrow { transition: none; } }
        .voice-vault[open] .vault-toggle-arrow { transform: rotate(180deg); }
        .vault-count-badge {
            display: inline-flex; align-items: center; justify-content: center;
            min-width: 17px; height: 17px; padding: 0 4px;
            background: var(--jade); color: #fff;
            border-radius: var(--radius-full); font-size: 0.65rem; font-weight: 700;
        }
        .vault-count-badge.empty { background: var(--bg-raised); color: var(--text-muted); border: 1px solid var(--border); }
        .voice-vault-body { padding: 0 12px 10px; }
        .voice-vault-hint {
            font-size: var(--text-label); color: var(--text-muted);
            font-style: italic; line-height: 1.5; margin-bottom: 8px;
        }
        .vault-phrase-list {
            display: flex; flex-direction: column; gap: 4px;
            max-height: 140px; overflow-y: auto;
        }
        .vault-phrase {
            display: flex; align-items: center; gap: 6px;
            padding: 5px 8px;
            background: var(--bg-raised); border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            font-size: var(--text-note);
        }
        .vault-phrase-status {
            width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
        }
        .vault-phrase-status.found   { background: var(--jade); }
        .vault-phrase-status.missing { background: var(--amber); }
        .vault-phrase-text {
            flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
            color: var(--text-primary); cursor: pointer; font-style: italic;
            background: none; border: none; text-align: left;
            font-family: var(--font-display); font-size: var(--text-note);
            padding: 0;
        }
        .vault-phrase-text:hover { color: var(--amber-text); text-decoration: underline; }
        .vault-phrase-text:focus-visible { outline: var(--focus-ring); border-radius: 2px; }
        .vault-phrase-remove {
            background: none; border: none; cursor: pointer;
            color: var(--text-muted); font-size: var(--text-caption); line-height: 1;
            padding: 2px 4px; border-radius: 3px; flex-shrink: 0;
            transition: color var(--transition-fast);
        }
        .vault-phrase-remove:hover { color: var(--text-primary); }
        .vault-phrase-remove:focus-visible { outline: var(--focus-ring); }
        .vault-empty {
            font-size: var(--text-label); color: var(--text-muted); font-style: italic;
            line-height: 1.55; padding: 2px 0 4px;
        }
        /* Protect button toolbar badge */
        .vault-toolbar-count {
            display: inline-flex; align-items: center; justify-content: center;
            min-width: 13px; height: 13px; padding: 0 3px;
            background: var(--jade); color: #fff;
            border-radius: var(--radius-full); font-size: 0.58rem; font-weight: 700;
            vertical-align: top; margin-left: 1px; line-height: 1;
        }
        /* Inline protect button inside Voice Vault panel */
        .vault-protect-inline {
            display: flex; align-items: center; justify-content: center; gap: 6px;
            width: 100%; padding: 8px 12px; margin: 4px 0 10px;
            border: 1.5px solid var(--jade); border-radius: var(--radius-sm);
            background: transparent; color: var(--jade);
            font-size: var(--text-note); font-weight: 600; cursor: pointer;
            transition: background 0.15s, color 0.15s;
        }
        .vault-protect-inline:not(:disabled):hover,
        .vault-protect-inline:not(:disabled):focus-visible {
            background: var(--jade); color: #fff; outline: none;
        }
        .vault-protect-inline:focus-visible { outline: var(--focus-ring-alt); outline-offset: 2px; }
        .vault-protect-inline:disabled {
            opacity: 0.38; cursor: not-allowed;
            border-color: var(--border-mid); color: var(--text-muted);
        }
        @media (prefers-reduced-motion: reduce) { .vault-protect-inline { transition: none; } }

        /* ── Instructor Report Panel ── */
        .instr-panel {
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-top: 3px solid var(--jade);
            border-radius: var(--radius-lg);
            padding: 22px 24px 26px;
            margin-top: 14px;
        }
        .instr-panel-title {
            font-family: var(--font-display);
            font-size: 1.05rem; font-weight: 700;
            color: var(--jade-text); margin-bottom: 3px;
        }
        .instr-panel-sub {
            font-size: var(--text-note); color: var(--text-muted);
            line-height: 1.5; margin-bottom: 18px;
        }
        .instr-divider { height: 1px; background: var(--border-mid); margin: 14px 0; }
        .instr-section-label {
            font-size: var(--text-micro); font-weight: 700;
            text-transform: uppercase; letter-spacing: 0.08em;
            color: var(--text-muted); margin-bottom: 8px;
            display: flex; align-items: center; gap: 8px;
        }
        .instr-sys-badge {
            font-size: 0.62rem; font-weight: 700;
            text-transform: uppercase; letter-spacing: 0.05em;
            padding: 1px 6px; border-radius: 3px;
            background: var(--bg-panel); color: var(--text-muted);
            border: 1px solid var(--border);
        }
        .instr-field-row { margin-bottom: 10px; }
        .instr-field-label {
            display: block; font-size: var(--text-caption); color: var(--text-sub);
            font-weight: 600; margin-bottom: 3px;
        }
        .instr-field-input {
            width: 100%; box-sizing: border-box;
            background: var(--bg-panel); border: 1px solid var(--border-hi);
            border-radius: var(--radius-sm); padding: 7px 10px;
            font-family: var(--font-body); font-size: var(--text-body);
            color: var(--text-primary);
            transition: border-color var(--transition-fast);
        }
        .instr-field-input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber-glow); }
        .instr-evidence {
            background: var(--bg-panel); border: 1px solid var(--border);
            border-radius: var(--radius-sm); padding: 10px 14px;
            font-size: var(--text-ui); line-height: 1.75; color: var(--text-main);
        }
        .instr-evidence-row { display: flex; gap: 8px; align-items: baseline; padding: 1px 0; }
        .instr-evidence-key { color: var(--text-sub); flex-shrink: 0; min-width: 160px; }
        .instr-evidence-val { color: var(--text-primary); font-weight: 600; }
        .instr-evidence-val.ok   { color: var(--jade-text); }
        .instr-evidence-val.warn { color: var(--amber-text); }
        .instr-preview-wrap {
            background: var(--bg-surface); border: 1px solid var(--border);
            border-radius: var(--radius-sm); overflow: hidden;
        }
        .instr-preview-head {
            display: flex; align-items: center; justify-content: space-between;
            padding: 7px 12px; border-bottom: 1px solid var(--border);
            background: var(--bg-panel);
        }
        .instr-preview-head-label { font-size: var(--text-caption); font-weight: 700; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.06em; }
        .instr-preview {
            max-height: 520px; overflow-y: auto;
            padding: 14px 16px;
            font-size: var(--text-note); line-height: 1.7;
            color: var(--text-main); white-space: pre-wrap; word-break: break-word;
            font-family: ui-monospace, 'Cascadia Code', 'Fira Mono', monospace;
        }
        .instr-check-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
        .instr-check-item {
            display: flex; align-items: flex-start; gap: 8px;
            font-size: var(--text-ui); line-height: 1.45; color: var(--text-primary);
        }
        .instr-check-item input[type="checkbox"] {
            margin-top: 1px; flex-shrink: 0;
            accent-color: var(--jade); width: 15px; height: 15px; cursor: pointer;
        }
        .instr-action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
        .instr-primary-btn {
            background: var(--jade); color: #fff;
            border: none; padding: 11px 22px;
            border-radius: var(--radius-full);
            font-family: var(--font-body); font-size: var(--text-emph); font-weight: 700;
            cursor: pointer; transition: all var(--transition-fast); letter-spacing: 0.03em;
            display: inline-flex; align-items: center; gap: 7px;
        }
        .instr-primary-btn:hover { background: var(--jade-dk); transform: translateY(-1px); }
        .instr-primary-btn:focus-visible { outline: var(--focus-ring-alt-strong); outline-offset: 2px; }
        .instr-secondary-btn {
            background: var(--bg-panel); color: var(--text-primary);
            border: 1px solid var(--border-hi); padding: 10px 16px;
            border-radius: var(--radius-full);
            font-family: var(--font-body); font-size: var(--text-body); font-weight: 600;
            cursor: pointer; transition: all var(--transition-fast);
            display: inline-flex; align-items: center; gap: 7px;
        }
        .instr-secondary-btn:hover { border-color: var(--jade); }
        .instr-secondary-btn:focus-visible { outline: var(--focus-ring-alt); outline-offset: 2px; }
        .instr-copy-flash {
            display: none; align-items: center; gap: 5px;
            font-size: var(--text-note); color: var(--jade-text); font-weight: 700;
            align-self: center;
        }
        .instr-copy-flash.show { display: inline-flex; }
        .instr-brightspace-note {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-left: 3px solid var(--amber);
            border-radius: var(--radius-sm);
            padding: 10px 14px; margin-top: 14px;
            font-size: var(--text-note); line-height: 1.6; color: var(--text-sub);
        }
        .instr-report-trigger-btn {
            background: var(--bg-raised); color: var(--jade-text);
            border: 1px solid var(--jade-glow); padding: 9px 18px;
            border-radius: var(--radius-full); margin-top: 14px;
            font-family: var(--font-body); font-size: var(--text-body); font-weight: 700;
            cursor: pointer; transition: all var(--transition-fast);
            display: inline-flex; align-items: center; gap: 7px;
        }
        .instr-report-trigger-btn:hover { background: var(--jade-glow); border-color: var(--jade); }
        .instr-report-trigger-btn:focus-visible { outline: var(--focus-ring-alt); outline-offset: 2px; }
        .instr-report-trigger-sub {
            display: block; font-size: var(--text-label); color: var(--text-muted);
            margin-top: 5px; line-height: 1.4;
        }

        /* ══════════════════════════════════════
           EL LABORATORIO — onboarding wizard
        ══════════════════════════════════════ */
        .lab-bg {
            position: fixed; inset: 0;
            background: rgba(42,33,28,0.78);
            backdrop-filter: blur(14px) saturate(1.2);
            display: flex; justify-content: center;
            z-index: 400;
            opacity: 0; pointer-events: none;
            transition: opacity var(--transition-slow);
            overflow-y: auto;
            padding: 40px 20px;
        }
        .lab-bg.on { opacity: 1; pointer-events: all; }

        .lab-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-lg);
            width: min(720px, 94vw);
            height: auto;
            overflow: visible;
            display: flex; flex-direction: column;
            box-shadow: var(--shadow-lg);
            position: relative;
            margin: auto;
        }
        .lab-card::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: linear-gradient(90deg, var(--amber-dk), var(--amber), var(--amber-text), var(--jade), var(--amber));
            border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        }

        .lab-header {
            padding: 22px 28px 16px;
            border-bottom: 1px solid var(--border-mid);
            display: flex; align-items: center; gap: 14px;
            flex-shrink: 0;
        }
        .lab-icon {
            width: 44px; height: 44px;
            background: var(--grad-amber);
            border-radius: var(--radius-md);
            display: flex; align-items: center; justify-content: center;
            font-size: 20px; flex-shrink: 0;
            box-shadow: 0 0 20px var(--amber-glow);
        }
        .lab-title-wrap h2 {
            font-family: var(--font-display);
            font-size: 1.2rem; font-weight: 600;
            color: var(--text-primary);
        }
        .lab-title-wrap p { font-size: var(--text-micro); color: var(--text-sub); margin-top: 2px; letter-spacing: 0.05em; text-transform: uppercase; }

        /* progress dots */
        .lab-progress {
            margin-left: auto;
            display: flex; gap: 6px; align-items: center;
        }
        .lab-dot {
            width: 8px; height: 8px; border-radius: var(--radius-full);
            background: var(--border-mid);
            transition: all 0.3s;
        }
        .lab-dot.done   { background: var(--metal-mid); }
        .lab-dot.active { background: var(--amber); box-shadow: 0 0 8px var(--amber-glow); width: 20px; border-radius: 4px; }

        .lab-body {
            padding: 24px 28px 32px;
            display: flex; flex-direction: column; gap: 18px;
        }


        .lab-step { display: none; flex-direction: column; gap: 16px; animation: labStepIn 0.3s ease; }
        .lab-step.on { display: flex; }
        @keyframes labStepIn {
            from { opacity: 0; transform: translateX(20px); }
            to   { opacity: 1; transform: translateX(0); }
        }

        .lab-step-label {
            font-size: var(--text-caption); font-weight: 700; letter-spacing: 0.08em;
            text-transform: uppercase; color: var(--amber);
        }
        .lab-step h3 {
            font-family: var(--font-display);
            font-size: 1.25rem; color: var(--text-primary); line-height: 1.35;
        }
        .lab-step p  { font-size: var(--text-subtitle); color: var(--text-primary); line-height: 1.75; }
        .lab-step em { color: var(--amber-text); font-style: normal; font-weight: 600; }

        /* fake AI paragraph block */
        .lab-ai-block {
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-left: 3px solid var(--amber);
            border-radius: var(--radius-sm);
            padding: 14px 16px;
            font-size: var(--text-body); line-height: 1.75;
            color: var(--text-primary);
            position: relative;
        }
        .lab-ai-label {
            font-size: var(--text-caption); font-weight: 700; letter-spacing: 0.06em;
            text-transform: uppercase; color: var(--text-muted);
            margin-bottom: 10px; display: block;
        }

        /* question rows */
        .lab-q {
            background: var(--bg-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            padding: 14px 16px;
            transition: border-color 0.2s;
            display: none;
        }
        .lab-q.on { display: block; }
        .lab-q.answered { border-color: var(--border-mid); }
        .lab-q.answered .lab-choices { opacity: 0.5; pointer-events: none; }
        .lab-q-label {
            font-size: 1rem; font-weight: 700; letter-spacing: 0.04em;
            text-transform: uppercase; margin-bottom: 10px;
        }
        .lab-q-label.q-accuracy    { color: var(--amber-text); }
        .lab-q-label.q-voice       { color: var(--rose); }
        .lab-q-label.q-specificity { color: var(--jade-text); }
        .lab-q-label.q-thinking    { color: var(--success-text); }
        .lab-q-label.q-cultural    { color: #D44E28; }

        .lab-q-text { font-size: var(--text-body); color: var(--text-primary); margin-bottom: 10px; line-height: 1.5; }

        .lab-choices { display: flex; gap: 8px; flex-wrap: wrap; }
        .lab-choice {
            padding: 9px 16px;
            background: var(--bg-surface);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-full);
            font-family: var(--font-body);
            font-size: var(--text-body); font-weight: 500; color: var(--text-sub);
            text-align: left;
            cursor: pointer; transition: all var(--transition-fast);
        }
        .lab-choice:hover { border-color: var(--amber); color: var(--amber-text); }
        .lab-choice:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; }
        .lab-choice.selected-good { background: rgba(114,212,164,0.12); border-color: var(--success-text); color: var(--success-text); }
        .lab-choice.selected-warn { background: rgba(184,92,26,0.10); border-color: var(--amber); color: var(--amber); }

        .lab-feedback {
            display: none; margin-top: 12px;
            padding: 12px 16px;
            background: var(--bg-surface);
            border-radius: var(--radius-sm);
            border-left: 3px solid var(--jade);
            font-size: var(--text-emph); color: var(--text-primary); line-height: 1.65;
            animation: labFeedIn 0.25s ease;
        }
        .lab-feedback.on { display: block; }
        .lab-next-q-btn {
            margin-top: 10px;
            padding: 8px 16px;
            background: var(--bg-raised);
            border: 1px solid var(--jade);
            border-radius: var(--radius-full);
            color: var(--jade-text);
            font-family: var(--font-body);
            font-size: var(--text-ui);
            font-weight: 600;
            cursor: pointer;
            display: none;
        }
        .lab-next-q-btn.on { display: inline-block; }
        @keyframes labFeedIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
        .lab-feedback strong { color: var(--text-primary); }

        /* summary screen */
        .lab-summary-grid {
            display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
        }
        .lab-summary-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-md);
            padding: 12px 14px;
        }
        .lab-summary-card .q-icon { font-size: 18px; margin-bottom: 6px; }
        .lab-summary-card .q-name { font-size: var(--text-caption); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
        .lab-summary-card .q-desc { font-size: var(--text-body); color: var(--text-primary); line-height: 1.55; }
        .lab-summary-card.q-acc  .q-name { color: var(--amber-text); }
        .lab-summary-card.q-voi  .q-name { color: var(--rose); }
        .lab-summary-card.q-spe  .q-name { color: var(--jade-text); }
        .lab-summary-card.q-thi  .q-name { color: var(--success-text); }
        .lab-summary-card.q-cul  .q-name { color: #D44E28; }

        .lab-footer {
            padding: 16px 28px 20px;
            border-top: 1px solid var(--border-mid);
            display: flex; align-items: center; justify-content: space-between;
            flex-shrink: 0; gap: 12px;
        }
        .lab-skip {
            appearance: none;
            background: none;
            border: 0;
            padding: 6px 2px;
            font-family: var(--font-body);
            font-size: var(--text-ui);
            color: var(--text-muted);
            cursor: pointer;
            text-decoration: underline;
            text-underline-offset: 3px;
        }
        .lab-skip:hover { color: var(--text-sub); }
        .lab-skip:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; border-radius: var(--radius-sm); }
        .lab-next-btn {
            background: var(--grad-amber);
            color: #fff;
            border: none; padding: 12px 30px;
            border-radius: var(--radius-full);
            font-family: var(--font-body); font-size: var(--text-emph); font-weight: 700;
            cursor: pointer; transition: all var(--transition-fast); letter-spacing: 0.04em;
            box-shadow: var(--shadow-sm);
        }
        .lab-next-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
        .lab-next-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
        .lab-next-btn.unlock {
            background: var(--grad-amber-hi);
            box-shadow: var(--shadow-md);
            color: #fff;
        }
        .lab-next-btn.unlock:hover { filter: brightness(1.12); }
        .lab-next-btn:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; }

        /* ══════════════════════════════════════
           FOUR-QUESTION EVAL CARD (post-bot)
        ══════════════════════════════════════ */
        .eval-card {
            align-self: flex-start;
            width: 100%;
            max-width: 96%;
            background: var(--bg-surface);
            border: 1px solid var(--border-mid);
            border-left: 3px solid var(--rose);
            border-radius: var(--radius-md);
            overflow: hidden;
            animation: msgIn 0.3s ease;
            margin-top: -2px;
            box-shadow: var(--shadow-sm);
        }
        .eval-card-header {
            padding: 12px 16px;
            display: flex; align-items: center; justify-content: space-between;
            cursor: pointer; user-select: none;
            background: var(--bg-raised);
        }
        .eval-card-header:hover { background: var(--bg-panel); }
        .eval-card-title {
            font-size: var(--text-label); font-weight: 700; letter-spacing: 0.06em;
            text-transform: uppercase; color: var(--rose);
            display: flex; align-items: center; gap: 8px;
        }
        .eval-card-toggle { font-size: var(--text-label); color: var(--text-muted); transition: transform 0.2s; }
        .eval-card.collapsed .eval-card-toggle { transform: rotate(-90deg); }

        .eval-card-body {
            padding: 14px 16px 16px;
            display: flex; flex-direction: column;
            gap: 12px;
        }
        .eval-card.collapsed .eval-card-body { display: none; }

        .eval-row {
            display: flex; align-items: center; gap: 12px;
            padding: 6px 0;
        }
        .eval-q-label {
            font-size: var(--text-caption); font-weight: 700; letter-spacing: 0.06em;
            text-transform: uppercase; min-width: 100px; flex-shrink: 0;
            display: flex; align-items: center; gap: 6px;
        }
        .eval-q-label.q-accuracy    { color: var(--amber-text); }
        .eval-q-label.q-voice       { color: var(--rose); }
        .eval-q-label.q-specificity { color: var(--jade-text); }
        .eval-q-label.q-thinking    { color: var(--success-text); }
        .eval-q-label.q-cultural    { color: #D44E28; }

        .eval-q-hint { font-size: var(--text-ui); color: var(--text-sub); flex: 1; line-height: 1.45; }

        .eval-btns { display: flex; gap: 6px; flex-shrink: 0; }
        .eval-btn {
            min-width: 44px; height: 44px;
            padding: 0 10px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border-mid);
            background: var(--bg-raised);
            font-size: 11px; font-weight: 600; cursor: pointer;
            display: flex; align-items: center; justify-content: center;
            transition: all var(--transition-fast);
            line-height: 1;
            text-transform: uppercase; letter-spacing: 0.04em;
        }
        .eval-btn:hover { border-color: var(--border-hi); transform: scale(1.12); }
        .eval-btn:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .eval-btn.active-good { background: rgba(74,124,89,0.12); border-color: var(--success); color: var(--success); }
        .eval-btn.active-warn { background: rgba(184,92,26,0.10); border-color: var(--amber); color: var(--amber); }
        .eval-btn.active-flag { background: rgba(160,64,32,0.10); border-color: var(--warn); color: var(--warn); }

        .eval-card-footer {
            padding: 0 16px 14px;
            font-size: var(--text-note); color: var(--text-muted);
            font-style: italic; line-height: 1.5;
        }

        /* ══════════════════════════════════════
           INLINE MESSAGE EVAL BAR (per-bot-msg)
        ══════════════════════════════════════ */
        .msg-eval-bar {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-top: 4px;
            padding-left: 44px; /* align with msg-content */
            flex-wrap: wrap;
        }
        .msg-eval-prompt {
            font-size: var(--text-micro);
            color: var(--text-muted);
            letter-spacing: 0.04em;
            text-transform: uppercase;
            margin-right: 4px;
            user-select: none;
        }
        /* Patch 21 — one-time explanatory micro-text above Evaluar bar */
        .msg-eval-hint-once {
            margin: 4px 0 2px 44px;
            font-size: var(--text-caption);
            color: var(--text-sub);
            font-style: italic;
            line-height: 1.4;
        }
        .msg-eval-q {
            display: inline-flex;
            align-items: center;
            gap: 3px;
            padding: 3px 8px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-mid);
            background: var(--bg-raised);
            font-size: var(--text-micro);
            font-weight: 600;
            cursor: pointer;
            transition: all var(--transition-fast);
            color: var(--text-sub);
            line-height: 1;
            user-select: none;
        }
        .msg-eval-q:hover { border-color: var(--border-hi); transform: translateY(-1px); }
        .msg-eval-q:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .msg-eval-q .tp-icon { opacity: 0.6; }
        .msg-eval-q:hover .tp-icon { opacity: 1; }

        /* answered states */
        .msg-eval-q.active-good { background: rgba(74,124,89,0.10); border-color: var(--success); color: var(--success); }
        .msg-eval-q.active-warn { background: rgba(184,92,26,0.08); border-color: var(--amber); color: var(--amber); }
        .msg-eval-q.active-flag { background: rgba(160,64,32,0.08); border-color: var(--warn); color: var(--warn); }
        .msg-eval-q.active-good .tp-icon,
        .msg-eval-q.active-warn .tp-icon,
        .msg-eval-q.active-flag .tp-icon { opacity: 1; }

        /* inline drawer */
        .msg-eval-drawer {
            width: 100%;
            margin-top: 6px;
            padding: 10px 12px;
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-md);
            animation: msgIn 0.2s ease;
        }
        .msg-eval-drawer-q {
            font-size: var(--text-label);
            font-weight: 700;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .msg-eval-choices {
            display: flex;
            gap: 8px;
            margin-bottom: 10px;
        }
        .msg-eval-choice {
            flex: 1;
            padding: 8px 10px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border-mid);
            background: var(--bg-surface);
            font-size: var(--text-label);
            font-weight: 600;
            cursor: pointer;
            text-align: center;
            transition: all var(--transition-fast);
            line-height: 1.3;
        }
        .msg-eval-choice:hover { border-color: var(--border-hi); transform: translateY(-1px); }
        .msg-eval-choice:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .msg-eval-choice.picked-good { background: rgba(74,124,89,0.12); border-color: var(--success); color: var(--success); }
        .msg-eval-choice.picked-warn { background: rgba(184,92,26,0.10); border-color: var(--amber); color: var(--amber); }
        .msg-eval-choice.picked-flag { background: rgba(160,64,32,0.10); border-color: var(--warn); color: var(--warn); }

        .msg-eval-feedback {
            font-size: var(--text-note);
            line-height: 1.5;
            color: var(--text-sub);
            padding: 8px 10px;
            background: var(--bg-surface);
            border-radius: var(--radius-sm);
            border-left: 3px solid var(--border-hi);
        }
        .msg-eval-feedback.good { border-left-color: var(--success); }
        .msg-eval-feedback.warn { border-left-color: var(--amber); }
        .msg-eval-feedback.flag { border-left-color: var(--warn); }

        /* ══════════════════════════════════════
           EVAL MODAL (replaces inline drawer)
           Opens on criterion-pill tap; centered
           on desktop, bottom-sheet on mobile.
        ══════════════════════════════════════ */
        .eval-modal-bg {
            position: fixed; inset: 0; z-index: 1100;
            background: rgba(0,0,0,0.42);
            display: flex; align-items: center; justify-content: center;
            padding: 20px;
            animation: pnModalIn 0.18s ease;
        }
        .eval-modal-card {
            background: var(--bg-panel);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-lg);
            padding: 24px 26px 22px;
            max-width: 500px; width: 100%;
            max-height: 80svh; overflow-y: auto;
            box-shadow: var(--shadow-modal);
            animation: pnModalIn 0.2s ease;
        }
        .eval-modal-header {
            font-family: var(--font-display);
            font-size: var(--text-label); font-weight: 700;
            letter-spacing: 0.06em; text-transform: uppercase;
            color: var(--text-muted);
            margin-bottom: 10px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--border);
        }
        .eval-modal-intro {
            font-size: var(--text-body); color: var(--text-sub);
            line-height: 1.55; margin-bottom: 16px;
        }
        .eval-modal-sub {
            display: block; margin-top: 4px;
            font-size: var(--text-ui); color: var(--text-muted);
            font-style: italic;
        }
        .eval-modal-q {
            font-size: var(--text-body); font-weight: 700;
            letter-spacing: 0.06em; text-transform: uppercase;
            display: flex; align-items: center; gap: 8px;
            margin-bottom: 8px;
        }
        .eval-modal-q.q-accuracy    { color: var(--amber-text); }
        .eval-modal-q.q-voice       { color: var(--rose); }
        .eval-modal-q.q-specificity { color: var(--jade-text); }
        .eval-modal-q.q-thinking    { color: var(--success-text); }
        .eval-modal-q.q-cultural    { color: #D44E28; }
        .eval-modal-hint {
            font-size: var(--text-body); color: var(--text-sub);
            line-height: 1.55; font-style: italic;
            margin-bottom: 18px;
            padding-bottom: 14px;
            border-bottom: 1px solid var(--border);
        }
        .eval-modal-choices {
            display: flex; gap: 10px; flex-wrap: wrap;
            margin-bottom: 16px;
        }
        .eval-modal-choice {
            flex: 1; min-width: 120px; min-height: 44px;
            padding: 10px 14px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--border-mid);
            background: var(--bg-surface);
            color: var(--text-primary);
            font-family: var(--font-body);
            font-size: var(--text-body); font-weight: 600;
            cursor: pointer; text-align: center;
            transition: all var(--transition-fast); line-height: 1.3;
        }
        .eval-modal-choice:hover { border-color: var(--border-hi); transform: translateY(-1px); }
        .eval-modal-choice:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .eval-modal-choice.picked-good { background: rgba(74,124,89,0.12); border-color: var(--success); color: var(--success); font-weight: 700; }
        .eval-modal-choice.picked-warn { background: rgba(184,92,26,0.10); border-color: var(--amber);  color: var(--amber);  font-weight: 700; }
        .eval-modal-choice.picked-flag { background: rgba(160,64,32,0.10); border-color: var(--warn);   color: var(--warn);   font-weight: 700; }
        .eval-modal-feedback {
            font-size: var(--text-ui); line-height: 1.6; color: var(--text-sub);
            padding: 12px 14px; margin-bottom: 14px;
            background: var(--bg-raised);
            border-radius: var(--radius-sm);
            border-left: 3px solid var(--border-hi);
        }
        .eval-modal-feedback.good { border-left-color: var(--success); }
        .eval-modal-feedback.warn { border-left-color: var(--amber); }
        .eval-modal-feedback.flag { border-left-color: var(--warn); }
        .eval-modal-fb-title {
            font-family: var(--font-display);
            font-size: var(--text-subtitle); font-weight: 600;
            color: var(--text-primary); line-height: 1.4; margin-bottom: 6px;
        }
        .eval-modal-fb-body {
            font-size: var(--text-ui); color: var(--text-sub); line-height: 1.65; margin-bottom: 8px;
        }
        .eval-modal-fb-action {
            font-size: var(--text-ui); font-weight: 700; color: var(--jade-text);
            background: var(--jade-glow); border-radius: var(--radius-sm);
            padding: 7px 11px; display: inline-block; line-height: 1.4;
        }
        .eval-modal-close {
            display: block; width: 100%; min-height: 40px;
            padding: 9px;
            background: var(--bg-surface); border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            font-family: var(--font-body); font-size: var(--text-ui); color: var(--text-muted);
            cursor: pointer; transition: border-color var(--transition-fast);
            margin-top: 6px;
        }
        .eval-modal-close:hover { border-color: var(--border-hi); }

        /* ══════════════════════════════════════
           REFLECTION CHECKPOINT BUTTON + MODAL
           Single optional button per bot message
           (replaces the 5-question eval bar).
           Modal reuses eval-modal-bg/card/header.
        ══════════════════════════════════════ */
        .reflect-btn-wrap {
            display: flex; justify-content: flex-end;
            padding: 4px 4px 2px;
        }
        .reflect-btn {
            display: inline-flex; align-items: center; justify-content: center;
            font-family: var(--font-body);
            font-size: var(--text-label); font-weight: 600;
            color: var(--text-muted);
            background: transparent;
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            padding: 6px 14px; min-height: 44px;
            cursor: pointer; transition: all var(--transition-fast);
            letter-spacing: 0.02em;
        }
        .reflect-btn:hover { border-color: var(--jade); color: var(--jade-text); }
        .reflect-btn:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .reflect-skill-label {
            font-size: var(--text-note); color: var(--text-muted);
            margin-bottom: 14px; font-style: italic;
        }
        .reflect-options {
            display: flex; flex-direction: column; gap: 8px;
            margin-bottom: 16px;
        }
        .reflect-option-btn {
            text-align: left; width: 100%; min-height: 44px;
            padding: 10px 14px;
            background: var(--bg-surface);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-sm);
            font-family: var(--font-body); font-size: var(--text-body);
            color: var(--text-primary);
            cursor: pointer; line-height: 1.4;
            transition: all var(--transition-fast);
        }
        .reflect-option-btn:hover { border-color: var(--border-hi); transform: translateX(2px); }
        .reflect-option-btn:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .reflect-option-btn.selected { background: rgba(74,124,89,0.10); border-color: var(--jade); color: var(--jade-text); font-weight: 600; }
        @media (prefers-reduced-motion: reduce) {
            .reflect-option-btn:hover { transform: none; }
        }
        @media (max-width: 430px) {
            .reflect-btn { min-height: 44px; font-size: var(--text-ui); }
            .reflect-option-btn { min-height: 48px; font-size: var(--text-emph); }
        }

        /* ══════════════════════════════════════
           Mi Toolkit · My Writing Toolkit
        ══════════════════════════════════════ */
        .toolkit-modal-bg {
            position: fixed; inset: 0; z-index: 1100;
            background: rgba(0,0,0,0.42);
            display: flex; align-items: center; justify-content: center;
            padding: 20px;
            animation: pnModalIn 0.18s ease;
        }
        .toolkit-modal-card {
            background: var(--bg-panel);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-lg);
            padding: 24px 26px 22px;
            max-width: 560px; width: 100%;
            max-height: 82svh; overflow-y: auto; overflow-x: hidden;
            box-shadow: var(--shadow-modal);
            animation: pnModalIn 0.2s ease;
        }
        .toolkit-modal-top {
            display: flex; align-items: flex-start; justify-content: space-between;
            gap: 12px;
            margin-bottom: 20px;
            padding-bottom: 14px;
            border-bottom: 1px solid var(--border);
        }
        .toolkit-modal-title {
            font-family: var(--font-display);
            font-size: 1.05rem; font-weight: 700;
            color: var(--text-primary); line-height: 1.3;
            margin: 0;
        }
        .toolkit-close {
            flex-shrink: 0;
            background: none;
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-sm);
            color: var(--text-muted); cursor: pointer;
            width: 30px; height: 30px;
            display: flex; align-items: center; justify-content: center;
            transition: border-color var(--transition-fast), color var(--transition-fast);
        }
        .toolkit-close:hover { border-color: var(--border-hi); color: var(--text-primary); }
        .toolkit-close:focus-visible { outline: var(--focus-ring-alt); outline-offset: 2px; }
        .full-review-modal-card { max-width: 760px; padding: 0; }
        .full-review-modal-top {
            margin: 0;
            padding: 22px 24px 18px;
            background: linear-gradient(135deg, var(--jade-glow), transparent 62%);
        }
        .full-review-modal-card > :not(.full-review-modal-top) {
            margin-left: 24px;
            margin-right: 24px;
        }
        .full-review-eyebrow {
            margin: 0 0 5px;
            color: var(--jade-text);
            font-size: var(--text-caption);
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }
        .full-review-intro {
            margin-top: 18px;
            margin-bottom: 12px;
            color: var(--text-sub);
            font-size: var(--text-body);
            line-height: 1.55;
        }
        .full-review-privacy,
        .capstone-ai-disclosure {
            padding: 11px 13px;
            border: 1px solid color-mix(in srgb, var(--jade) 38%, var(--border));
            border-radius: var(--radius-md);
            background: var(--jade-glow);
            color: var(--text-sub);
            font-size: var(--text-note);
            line-height: 1.5;
        }
        .full-review-privacy { margin-top: 0; margin-bottom: 12px; }
        .capstone-ai-disclosure { margin: 10px 0 4px; }
        .full-review-length,
        .full-review-notice {
            padding: 11px 13px;
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            font-size: var(--text-note);
            line-height: 1.5;
        }
        .full-review-length { margin-top: 0; margin-bottom: 14px; }
        .full-review-length--comfortable {
            background: var(--jade-glow);
            border-color: color-mix(in srgb, var(--jade) 36%, var(--border));
            color: var(--jade-text);
        }
        .full-review-length--long {
            background: var(--amber-glow);
            border-color: color-mix(in srgb, var(--amber-text) 34%, var(--border));
        }
        .full-review-length--very-long {
            background: color-mix(in srgb, var(--amber-glow) 72%, var(--bg-panel));
            border-color: var(--amber-text);
        }
        .full-review-notice {
            margin-top: 0;
            margin-bottom: 12px;
            background: var(--bg-surface);
            color: var(--text-sub);
        }
        .full-review-notice--same {
            border-left: 3px solid var(--amber-text);
        }
        .full-review-fieldset {
            border: 0;
            margin-top: 18px !important;
            padding: 0;
            min-width: 0;
        }
        .full-review-fieldset legend {
            margin-bottom: 10px;
            color: var(--text-primary);
            font-size: var(--text-body);
            font-weight: 800;
        }
        .full-review-lens-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 9px;
        }
        .full-review-lens {
            position: relative;
            display: flex;
            min-width: 0;
            min-height: 76px;
            padding: 12px 13px;
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-md);
            background: var(--bg-surface);
            cursor: pointer;
            transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
        }
        .full-review-lens:hover {
            border-color: var(--jade);
            background: var(--jade-glow);
        }
        .full-review-lens:has(input:checked) {
            border-color: var(--jade);
            background: var(--jade-glow);
            box-shadow: 0 0 0 2px color-mix(in srgb, var(--jade) 24%, transparent);
        }
        .full-review-lens:has(input:focus-visible) {
            outline: var(--focus-ring-alt);
            outline-offset: 2px;
        }
        .full-review-lens input {
            width: 17px;
            height: 17px;
            margin: 2px 10px 0 0;
            accent-color: var(--jade);
            flex-shrink: 0;
        }
        .full-review-lens-copy {
            display: flex;
            flex-direction: column;
            gap: 3px;
            min-width: 0;
        }
        .full-review-lens-copy strong {
            color: var(--text-primary);
            font-size: var(--text-note);
            line-height: 1.3;
        }
        .full-review-lens-copy small {
            color: var(--text-muted);
            font-size: var(--text-caption);
            line-height: 1.35;
        }
        .full-review-recommended {
            position: absolute;
            right: 8px;
            top: -8px;
            padding: 2px 6px;
            border-radius: var(--radius-full);
            background: var(--jade);
            color: var(--bg-panel);
            font-size: 0.58rem;
            font-weight: 800;
            letter-spacing: 0.03em;
            text-transform: uppercase;
        }
        .full-review-purpose-label {
            display: block;
            margin-top: 17px;
            color: var(--text-primary);
            font-size: var(--text-note);
            line-height: 1.4;
        }
        .full-review-purpose-label textarea {
            display: block;
            width: 100%;
            min-height: 76px;
            margin-top: 7px;
            padding: 10px 12px;
            resize: vertical;
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-md);
            background: var(--bg-raised);
            color: var(--text-primary);
            font: inherit;
            line-height: 1.5;
        }
        .full-review-purpose-label textarea:focus-visible {
            outline: var(--focus-ring-alt);
            outline-offset: 2px;
        }
        .full-review-purpose-label small {
            display: block;
            margin-top: 5px;
            color: var(--text-muted);
            font-size: var(--text-caption);
        }
        .full-review-override {
            display: flex;
            align-items: flex-start;
            gap: 9px;
            margin-top: 14px;
            padding: 10px 12px;
            border-radius: var(--radius-md);
            background: var(--amber-glow);
            color: var(--text-sub);
            cursor: pointer;
            font-size: var(--text-note);
            line-height: 1.4;
        }
        .full-review-override input {
            width: 18px;
            height: 18px;
            margin: 1px 0 0;
            accent-color: var(--jade);
            flex-shrink: 0;
        }
        .full-review-actions {
            position: sticky;
            bottom: 0;
            display: flex;
            justify-content: flex-end;
            gap: 9px;
            margin-top: 20px;
            margin-bottom: 0 !important;
            padding: 14px 0 20px;
            border-top: 1px solid var(--border);
            background: var(--bg-panel);
        }
        .full-review-passage-btn,
        .full-review-submit {
            min-height: 44px;
            padding: 10px 15px;
            border-radius: var(--radius-md);
            font: 700 var(--text-note)/1.25 var(--font-body);
            cursor: pointer;
        }
        .full-review-passage-btn {
            border: 1px solid var(--border-mid);
            background: var(--bg-raised);
            color: var(--text-sub);
        }
        .full-review-submit {
            border: 1px solid var(--jade);
            background: var(--jade);
            color: var(--bg-panel);
        }
        .full-review-submit:disabled {
            opacity: 0.44;
            cursor: not-allowed;
        }
        .full-review-passage-btn:focus-visible,
        .full-review-submit:focus-visible {
            outline: var(--focus-ring-alt);
            outline-offset: 2px;
        }
        /* ── Review Council (C2) ── */
        .council-offer {
            margin-top: 16px;
            padding: 14px;
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-md);
            background: var(--bg-surface);
        }
        .council-offer-head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
        .council-offer-head strong { font-size: var(--text-ui); color: var(--text-main); }
        .council-offer-sub { font-size: var(--text-note); color: var(--text-sub); line-height: 1.45; }
        .council-disclosure {
            padding: 11px 13px;
            border: 1px solid color-mix(in srgb, var(--jade) 38%, var(--border));
            border-radius: var(--radius-md);
            background: var(--jade-glow);
            color: var(--text-sub);
            font-size: var(--text-note);
            line-height: 1.5;
            margin-bottom: 10px;
        }
        .council-same-draft {
            display: flex; align-items: flex-start; gap: 9px;
            font-size: var(--text-note); color: var(--text-sub);
            margin-bottom: 10px; cursor: pointer;
        }
        .council-same-draft input {
            width: 18px; height: 18px; margin: 1px 0 0;
            accent-color: var(--jade); flex-shrink: 0;
        }
        .council-offer-actions { display: flex; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
        .council-launch, .council-view-last, .council-cancel, .council-return {
            min-height: 44px;
            padding: 10px 15px;
            border-radius: var(--radius-md);
            font: 700 var(--text-note)/1.25 var(--font-body);
            cursor: pointer;
        }
        .council-launch, .council-return {
            border: 1px solid var(--jade);
            background: var(--jade);
            color: var(--bg-panel);
        }
        .council-launch:disabled { opacity: 0.44; cursor: not-allowed; }
        .council-view-last, .council-cancel {
            border: 1px solid var(--border-mid);
            background: var(--bg-raised);
            color: var(--text-sub);
        }
        .council-launch:focus-visible, .council-view-last:focus-visible,
        .council-cancel:focus-visible, .council-return:focus-visible,
        .council-decision-btn:focus-visible {
            outline: var(--focus-ring-alt);
            outline-offset: 2px;
        }
        .council-progress-note { font-size: var(--text-note); color: var(--text-sub); line-height: 1.5; margin-bottom: 14px; }
        .council-chips { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
        .council-chip {
            display: flex; justify-content: space-between; align-items: center; gap: 10px;
            padding: 10px 13px;
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            background: var(--bg-surface);
            font-size: var(--text-note);
        }
        .council-chip-name { font-weight: 700; color: var(--text-main); }
        .council-chip-status { color: var(--text-sub); }
        .council-chip[data-status="done"] { border-color: color-mix(in srgb, var(--jade) 45%, var(--border)); background: var(--jade-glow); }
        .council-chip[data-status="failed"] { border-color: color-mix(in srgb, var(--clay, #b85c1a) 45%, var(--border)); opacity: 0.8; }
        .council-synthesis-row { font-size: var(--text-note); color: var(--text-sub); margin-bottom: 12px; }
        .council-progress-actions, .council-report-actions {
            display: flex; justify-content: flex-end; gap: 9px;
            margin-top: 16px; padding-top: 14px;
            border-top: 1px solid var(--border);
        }
        .council-stale-note, .council-partial-note, .council-abort-note, .council-empty-note {
            padding: 11px 13px;
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-md);
            background: var(--bg-raised);
            color: var(--text-sub);
            font-size: var(--text-note);
            line-height: 1.5;
            margin-bottom: 12px;
        }
        .council-summary { font-size: var(--text-ui); color: var(--text-main); line-height: 1.55; margin-bottom: 14px; }
        .council-section { margin-bottom: 18px; }
        .council-section h3 {
            font-size: var(--text-caption); font-weight: 700;
            letter-spacing: 0.06em; text-transform: uppercase;
            color: var(--jade-text);
            margin-bottom: 10px;
        }
        .council-section--preserve .council-preserve-item {
            padding: 10px 13px;
            border: 1px solid color-mix(in srgb, var(--jade) 38%, var(--border));
            border-radius: var(--radius-md);
            background: var(--jade-glow);
            margin-bottom: 8px;
            font-size: var(--text-note);
            color: var(--text-sub);
        }
        .council-finding {
            padding: 12px 13px;
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-md);
            background: var(--bg-surface);
            margin-bottom: 10px;
        }
        .council-finding-head {
            display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
            margin-bottom: 7px;
            font-size: var(--text-caption);
        }
        .council-dimension {
            font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
            color: var(--jade-text);
        }
        .council-corroboration { color: var(--jade-text); font-weight: 700; }
        .council-single-role { color: var(--text-sub); }
        .council-low-confidence { color: var(--amber-text); font-style: italic; }
        .council-claim { font-size: var(--text-ui); color: var(--text-main); line-height: 1.5; margin-bottom: 7px; }
        .council-quote {
            margin: 0 0 7px;
            padding: 7px 11px;
            border-left: 3px solid var(--jade);
            background: var(--bg-raised);
            font-size: var(--text-note);
            color: var(--text-sub);
            font-style: italic;
            line-height: 1.5;
        }
        .council-why, .council-move { font-size: var(--text-note); color: var(--text-sub); line-height: 1.5; margin-bottom: 6px; }
        .council-voice-note {
            font-size: var(--text-note);
            color: var(--amber-text);
            line-height: 1.5;
            margin-bottom: 6px;
        }
        .council-decisions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
        .council-decision-btn {
            min-height: 36px;
            padding: 7px 11px;
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-full);
            background: var(--bg-raised);
            color: var(--text-sub);
            font: 700 var(--text-caption)/1.2 var(--font-body);
            cursor: pointer;
        }
        .council-decision-btn--chosen {
            border-color: var(--jade);
            background: var(--jade);
            color: var(--bg-panel);
        }
        .council-secondary { margin-bottom: 18px; }
        .council-secondary summary {
            cursor: pointer;
            font-size: var(--text-note);
            font-weight: 700;
            color: var(--text-sub);
            padding: 8px 0;
        }
        .council-section--disagreement .council-disagreement {
            padding: 11px 13px;
            border: 1px solid color-mix(in srgb, var(--amber-text) 40%, var(--border));
            border-radius: var(--radius-md);
            background: var(--amber-glow, var(--bg-raised));
            margin-bottom: 8px;
        }
        .council-disagreement-q { font-size: var(--text-ui); color: var(--text-main); font-weight: 700; line-height: 1.5; margin-bottom: 6px; }
        .council-disagreement-pos { font-size: var(--text-note); color: var(--text-sub); line-height: 1.5; margin-bottom: 3px; }
        .toolkit-section { margin-bottom: 20px; }
        .toolkit-section-title {
            font-size: var(--text-caption); font-weight: 700;
            letter-spacing: 0.06em; text-transform: uppercase;
            color: var(--jade-text);
            margin-bottom: 10px;
        }
        .toolkit-asset-list { display: flex; flex-direction: column; gap: 8px; }
        .toolkit-asset-chip {
            display: flex; align-items: flex-start; gap: 10px;
            padding: 10px 12px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border);
            background: var(--bg-surface);
        }
        .toolkit-asset-claimed { border-color: var(--border-mid); }
        .toolkit-asset-unclaimed { opacity: 0.42; }
        .toolkit-asset-body { flex: 1; min-width: 0; }
        .toolkit-asset-name {
            font-size: var(--text-body); font-weight: 600;
            color: var(--text-primary); line-height: 1.3;
            margin-bottom: 2px;
        }
        .toolkit-asset-desc { font-size: var(--text-note); color: var(--text-muted); line-height: 1.4; }
        .toolkit-asset-check {
            flex-shrink: 0;
            color: var(--jade); font-weight: 700; font-size: var(--text-emph);
            margin-top: 2px;
        }
        .toolkit-claim-block {
            margin-bottom: 20px;
            padding: 14px 16px;
            background: var(--amber-glow);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-md);
        }
        .toolkit-claim-label {
            font-size: var(--text-caption); font-weight: 700;
            letter-spacing: 0.05em; text-transform: uppercase;
            color: var(--amber-text); margin-bottom: 8px;
        }
        .toolkit-claim-text {
            margin: 0;
            font-size: var(--text-emph); font-style: italic;
            color: var(--text-primary); line-height: 1.55;
            border-left: 3px solid var(--amber-text);
            padding-left: 12px;
        }
        .toolkit-claim-empty {
            margin: 0;
            font-size: var(--text-body); color: var(--text-muted); line-height: 1.5;
        }
        .toolkit-knowledge-btn {
            margin-top: 12px;
            min-height: 44px;
            padding: 9px 14px;
            border: 1px solid var(--amber-text);
            border-radius: var(--radius-full);
            background: var(--bg-raised);
            color: var(--amber-text);
            font-family: var(--font-body);
            font-size: var(--text-ui);
            font-weight: 700;
            cursor: pointer;
        }
        .toolkit-knowledge-btn:hover { background: var(--amber-glow); }
        .toolkit-knowledge-btn:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; }
        .toolkit-skills-placeholder {
            margin: 0;
            font-size: var(--text-body); color: var(--text-muted);
            line-height: 1.55; font-style: italic;
            padding: 12px 14px;
            border: 1px dashed var(--border-mid);
            border-radius: var(--radius-sm);
        }
        .toolkit-skills-empty {
            margin: 0;
            font-size: var(--text-body); color: var(--text-muted);
            line-height: 1.55; font-style: italic;
            padding: 12px 14px;
            border: 1px dashed var(--border-mid);
            border-radius: var(--radius-sm);
        }
        .toolkit-skill-gain {
            padding: 12px 14px;
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-sm);
            background: var(--bg-surface);
            margin-bottom: 8px;
        }
        .toolkit-skill-gain:last-child { margin-bottom: 0; }
        .toolkit-skill-gain-name {
            display: flex; align-items: center; gap: 6px;
            font-size: var(--text-emph); color: var(--text-primary);
            margin-bottom: 4px;
        }
        .toolkit-skill-check {
            color: var(--jade-text); font-weight: 700;
            font-size: var(--text-emph);
        }
        .toolkit-skill-gain-desc {
            font-size: var(--text-ui); color: var(--text-sub);
            line-height: 1.5;
        }
        .toolkit-transfer-intro {
            margin: 0 0 10px;
            font-size: var(--text-note); color: var(--text-muted);
            line-height: 1.5; font-style: italic;
        }
        .toolkit-transfer-card {
            padding: 11px 13px;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--bg-panel);
            margin-bottom: 7px;
        }
        .toolkit-transfer-card:last-child { margin-bottom: 0; }
        .toolkit-transfer-principle {
            font-size: var(--text-body); font-weight: 700;
            color: var(--text-primary); margin-bottom: 3px;
            line-height: 1.35;
        }
        .toolkit-transfer-skill {
            font-size: var(--text-ui); font-weight: 500;
            color: var(--text-sub); margin-bottom: 4px;
            line-height: 1.4;
        }
        .toolkit-transfer-desc {
            font-size: var(--text-note); color: var(--text-muted);
            line-height: 1.45;
        }

        /* ── Help / Orientation modal ── */
        .help-modal-card { max-width: 520px; }
        .help-current-stage {
            background: var(--bg-surface);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-sm);
            padding: 8px 12px;
            font-size: var(--text-body); color: var(--text-primary);
            margin-bottom: 18px;
        }
        .help-section { margin-bottom: 18px; }
        .help-section:last-child { margin-bottom: 0; }
        .help-section-title {
            font-size: var(--text-caption); font-weight: 700;
            letter-spacing: 0.06em; text-transform: uppercase;
            color: var(--jade-text);
            margin-bottom: 6px;
        }
        /* Context-Collapse sprint D: help sections are native <details> disclosures —
           closed by default the panel scans as a title list; no storage, no JS state. */
        details.help-section { margin-bottom: 12px; }
        details.help-section > summary.help-section-title {
            list-style: none;
            cursor: pointer;
            user-select: none;
            margin-bottom: 0;
            padding: 3px 0;
        }
        details.help-section[open] > summary.help-section-title { margin-bottom: 6px; }
        details.help-section > summary.help-section-title::-webkit-details-marker { display: none; }
        details.help-section > summary.help-section-title::marker { display: none; }
        details.help-section > summary.help-section-title:hover { color: var(--amber); }
        details.help-section > summary.help-section-title:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .help-sum-arrow {
            display: inline-block;
            margin-left: 6px;
            font-size: var(--text-micro);
            color: var(--text-muted);
            transition: transform var(--transition-fast);
        }
        details.help-section[open] > summary .help-sum-arrow { transform: rotate(180deg); }
        .help-section-body {
            font-size: var(--text-emph); color: var(--text-secondary);
            line-height: 1.55;
        }
        .help-stage-list {
            list-style: none; padding: 0; margin: 0;
            display: flex; flex-direction: column; gap: 6px;
        }
        .help-stage-item {
            display: flex; gap: 8px; align-items: baseline;
            font-size: var(--text-ui); color: var(--text-secondary); line-height: 1.45;
        }
        .help-stage-num {
            font-weight: 700; color: var(--jade-text);
            min-width: 1.4rem; flex-shrink: 0;
        }
        .help-stage-current { font-weight: 600; color: var(--text-primary); }

        /* ── Reusable Guide Card Pattern ── */
        .guide-card {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: var(--radius-md);
            padding: 16px 18px;
            margin: 8px 0;
            box-shadow: var(--shadow-sm);
        }
        .guide-card-title {
            font-family: var(--font-display);
            font-size: 1rem;
            font-weight: 600;
            color: var(--text-primary);
            line-height: 1.4;
            margin-bottom: 8px;
        }
        .guide-card-body {
            font-size: var(--text-emph);
            color: var(--text-sub);
            line-height: 1.7;
            margin-bottom: 10px;
        }
        .guide-card-body em {
            color: var(--amber-text);
            font-style: normal;
            font-weight: 600;
        }
        .guide-card-action {
            font-size: var(--text-ui);
            font-weight: 700;
            color: var(--jade-text);
            background: var(--jade-glow);
            border-radius: var(--radius-sm);
            padding: 8px 12px;
            display: inline-block;
            line-height: 1.5;
        }
        .guide-card-action::before {
            content: '→ ';
            color: var(--jade);
        }

        /* Pana Hint as guide card */
        .pana-hint.guide-card {
            background: var(--bg-raised);
            border-color: var(--amber);
            border-left: 3px solid var(--amber);
            margin: 6px 0 10px;
            padding: 14px 16px;
        }
        .pana-hint.guide-card .pana-hint-label {
            display: block;
            font-size: var(--text-micro);
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--amber-text);
            margin-bottom: 6px;
        }

        /* Lab feedback as guide card */
        .lab-feedback.guide-card {
            background: var(--bg-raised);
            border-left: 3px solid var(--amber);
            margin: 10px 0 4px;
            padding: 14px 16px;
        }
        .lab-feedback.guide-card strong {
            display: block;
            font-family: var(--font-display);
            font-size: var(--text-subtitle);
            font-weight: 600;
            color: var(--text-primary);
            line-height: 1.4;
            margin-bottom: 8px;
        }
        .lab-feedback.guide-card em {
            color: var(--amber-text);
            font-style: normal;
            font-weight: 600;
        }

        .msg-eval-close {
            font-size: var(--text-micro);
            color: var(--text-muted);
            background: none;
            border: none;
            cursor: pointer;
            padding: 2px 0;
            margin-top: 6px;
        }
        .msg-eval-close:hover { color: var(--text-sub); text-decoration: underline; }

        /* Eval habit streak summary */
        .eval-habit {
            display: none;
            align-items: center;
            gap: 8px;
            padding: 4px 0;
            font-size: var(--text-caption);
            color: var(--text-muted);
        }
        .eval-habit.on { display: flex; }
        .eval-habit strong { color: var(--amber-text); }

        /* ══════════════════════════════════════
           FOLLOW-UP QUESTIONS (post-feedback)
        ══════════════════════════════════════ */
        .followup-panel {
            align-self: flex-start;
            width: 100%;
            max-width: 96%;
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-left: 3px solid var(--jade);
            border-radius: var(--radius-md);
            padding: 8px 14px 10px;
            margin-top: 4px;
            animation: msgIn 0.3s ease;
            box-shadow: var(--shadow-sm);
        }
        /* <details> reset */
        .followup-panel summary { list-style: none; }
        .followup-panel summary::-webkit-details-marker { display: none; }
        .followup-title {
            font-size: var(--text-micro); font-weight: 700;
            letter-spacing: 0.07em; text-transform: uppercase;
            color: var(--jade-text);
            display: flex; align-items: center; gap: 6px;
            cursor: pointer;
        }
        /* Collapsed state: no bottom margin; show a ▸ chevron */
        .followup-summary {
            margin-bottom: 0;
            user-select: none;
        }
        .followup-summary::after {
            content: ' ▸';
            font-size: 0.62rem;
            opacity: 0.6;
        }
        details.followup-panel[open] .followup-summary {
            margin-bottom: 8px;
        }
        details.followup-panel[open] .followup-summary::after {
            content: ' ▾';
        }
        .followup-chips {
            display: flex; flex-wrap: wrap; gap: 6px;
        }
        .followup-chip {
            display: inline-flex; align-items: center;
            gap: 5px;
            padding: 6px 12px;
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            font-size: var(--text-note); font-weight: 600;
            color: var(--text-sub);
            cursor: pointer;
            transition: all var(--transition-fast);
            line-height: 1.35;
            text-align: left;
        }
        .followup-chip:hover {
            background: var(--jade-glow);
            border-color: var(--jade);
            color: var(--jade-text);
            transform: translateY(-1px);
        }
        .followup-chip:focus-visible {
            outline: var(--focus-ring-alt);
            outline-offset: 2px;
        }

        /* ══════════════════════════════════════
           TU CONOCIMIENTO — identity affirmation
        ══════════════════════════════════════ */
        .mani-bg {
            position: fixed; inset: 0;
            background: rgba(42,33,28,0.78);
            backdrop-filter: blur(14px) saturate(1.2);
            display: flex; justify-content: center;
            z-index: 500;
            opacity: 0; pointer-events: none;
            transition: opacity var(--transition-slow);
            overflow-y: auto;
            padding: 40px 20px;
        }
        .mani-bg.on { opacity: 1; pointer-events: all; }

        .mani-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-lg);
            width: min(760px, 95vw);
            height: auto;
            overflow: visible;
            display: flex; flex-direction: column;
            box-shadow: var(--shadow-lg);
            position: relative;
            margin: auto;
        }
        .mani-card::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: linear-gradient(90deg,
                var(--amber-dk) 0%, var(--amber) 30%,
                var(--jade) 70%, var(--amber) 100%);
            border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        }

        .mani-header {
            padding: 28px 32px 20px;
            text-align: center;
            flex-shrink: 0;
        }
        .mani-eyebrow {
            font-size: var(--text-caption); font-weight: 700; letter-spacing: 0.12em;
            text-transform: uppercase; color: var(--amber);
            margin-bottom: 12px;
        }
        .mani-title {
            font-family: var(--font-display);
            font-size: 1.9rem; font-weight: 600;
            line-height: 1.25;
            color: var(--text-primary);
            margin-bottom: 12px;
        }
        .mani-subtitle {
            font-size: var(--text-subtitle); color: var(--text-sub);
            line-height: 1.75; max-width: 560px; margin: 0 auto;
        }
        .mani-subtitle em { color: var(--amber-text); font-style: normal; font-weight: 600; }

        /* asset grid */
        .mani-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            padding: 0 28px 24px;
        }


        .mani-asset {
            display: none;
            background: var(--bg-raised);
            border: 2px solid var(--border-mid);
            border-radius: var(--radius-md);
            padding: 16px 18px;
            cursor: pointer;
            transition: all 0.25s ease;
            position: relative;
            overflow: hidden;
            user-select: none;
        }
        .mani-asset::before {
            content: '';
            position: absolute; inset: 0;
            background: radial-gradient(circle at 50% 0%, var(--amber-glow) 0%, transparent 70%);
            opacity: 0; transition: opacity 0.3s;
            pointer-events: none;
        }
        .mani-asset:hover { border-color: var(--amber); transform: translateY(-2px); box-shadow: var(--shadow-md); }
        .mani-asset:hover::before { opacity: 0.5; }

        .mani-asset.claimed {
            border-color: var(--amber);
            background: var(--bg-raised);
            box-shadow: 0 0 0 1px var(--amber-dk), var(--shadow-md);
        }
        .mani-asset.claimed::before { opacity: 0.8; }
        .mani-asset.claimed .mani-asset-icon { transform: scale(1.15); }

        .mani-asset-top {
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 8px;
        }
        .mani-asset-icon { font-size: 22px; transition: transform 0.3s; line-height: 1; }
        .mani-check {
            width: 20px; height: 20px;
            border: 2px solid var(--border-hi);
            border-radius: var(--radius-full);
            display: flex; align-items: center; justify-content: center;
            font-size: 10px; color: transparent;
            transition: all 0.25s;
            flex-shrink: 0;
        }
        .mani-asset.claimed .mani-check {
            background: var(--amber);
            border-color: var(--amber);
            color: var(--bg-base);
        }

        .mani-asset-name {
            font-size: var(--text-ui); font-weight: 700;
            letter-spacing: 0.06em; text-transform: uppercase;
            color: var(--amber-text); margin-bottom: 6px;
        }
        .mani-asset-name-es {
            font-size: var(--text-caption); font-weight: 500;
            color: var(--text-muted); margin-bottom: 10px;
            letter-spacing: 0.04em; text-transform: uppercase;
        }
        .mani-asset-text {
            font-size: var(--text-emph); color: var(--text-primary);
            line-height: 1.6;
        }
        .mani-asset-text-es {
            font-size: var(--text-emph); color: var(--text-sub);
            line-height: 1.55; margin-top: 6px;
            font-style: normal;
        }
        .mani-asset-claimed-label {
            font-size: var(--text-caption); font-weight: 700;
            letter-spacing: 0.08em; text-transform: uppercase;
            color: var(--amber-text);
            margin-top: 8px; opacity: 0;
            transition: opacity 0.25s;
        }
        .mani-asset.claimed .mani-asset-claimed-label { opacity: 1; }

        /* claim confirmation toast */
        .mani-claim-toast {
            margin: 0 32px;
            padding: 10px 16px;
            border-radius: var(--radius-sm);
            background: var(--jade-glow);
            border: 1px solid var(--jade);
            color: var(--jade-text);
            font-size: var(--text-emph); line-height: 1.5;
            text-align: center;
            opacity: 0; transform: translateY(-6px);
            transition: opacity 0.3s, transform 0.3s;
            pointer-events: none;
        }
        @keyframes toastGlow {
            0%, 100% { box-shadow: var(--shadow-sm); }
            50%       { box-shadow: 0 2px 14px rgba(40,120,70,0.18); }
        }
        .mani-claim-toast.on {
            opacity: 1; transform: translateY(0);
            animation: toastGlow 2.4s ease-in-out 0.35s infinite;
        }
        .mani-claim-toast strong {
            color: var(--jade-dk); font-weight: 700;
        }

        /* In-card asset claim celebration */
        .mani-asset-celebration {
            margin-top: 12px;
            padding: 10px 14px;
            border-radius: var(--radius-sm);
            background: var(--jade-glow);
            border: 1px solid var(--jade);
            text-align: center;
            animation: toastGlow 2.4s ease-in-out 0.35s infinite;
        }
        .mac-message {
            font-weight: 700;
            color: var(--jade-dk);
            font-size: var(--text-emph);
            line-height: 1.5;
            margin-bottom: 4px;
        }
        .mac-sub {
            color: var(--jade-text);
            font-size: var(--text-ui);
            line-height: 1.4;
            margin-bottom: 2px;
        }
        .mani-next-btn {
            display: block;
            width: 100%;
            margin-top: 10px;
            padding: 9px 18px;
            font-family: var(--font-body);
            font-size: var(--text-emph);
            font-weight: 700;
            letter-spacing: 0.02em;
            background: var(--amber);
            color: #fff;
            border: none;
            border-radius: var(--radius-full);
            cursor: pointer;
            transition: background 0.2s;
        }
        .mani-next-btn:hover { background: var(--amber-dk); }
        .mani-next-btn:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; }

        /* counter pulse on change */
        @keyframes maniCounterPulse {
            0%   { color: var(--text-muted); }
            30%  { color: var(--amber-text); text-shadow: 0 0 8px var(--amber-glow); }
            100% { color: var(--text-muted); }
        }
        .mani-counter.pulse {
            animation: maniCounterPulse 0.8s ease;
        }
        .mani-counter.all.pulse {
            animation: maniCounterPulse 0.8s ease;
        }

        /* keyboard focus for asset cards */
        .mani-asset:focus-visible {
            outline: var(--focus-ring-strong);
            outline-offset: 2px;
            border-color: var(--amber);
        }

        /* reduced motion */
        @media (prefers-reduced-motion: reduce) {
            .mani-counter.pulse, .mani-counter.all.pulse {
                animation: none;
            }
            .mani-claim-toast {
                transition: none;
            }
            .mani-asset-claimed-label {
                transition: none;
            }
            .mani-asset--active { animation: none; }
            .mani-claim-toast.on { animation: none; }
            .mani-asset-celebration { animation: none; }
        }

        /* claim-all burst animation */
        @keyframes claimBurst {
            0%   { transform: scale(1); }
            40%  { transform: scale(1.03); }
            100% { transform: scale(1); }
        }
        .mani-card.all-claimed { animation: claimBurst 0.5s ease; }

        @keyframes maniCardIn {
            from { opacity: 0; transform: translateY(10px); }
            to   { opacity: 1; transform: translateY(0); }
        }
        .mani-asset--active {
            display: block;
            grid-column: 1 / -1;
            animation: maniCardIn 0.3s ease;
        }
        .mani-prompt.hidden { display: none; }

        .mani-prompt {
            padding: 24px 28px;
            border-top: 1px solid var(--border-mid);
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        .mani-prompt-label {
            font-family: var(--font-display);
            font-size: 1.05rem;
            font-weight: 600;
            color: var(--text-primary);
            line-height: 1.35;
        }
        .mani-prompt-label em {
            color: var(--amber-text);
            font-style: normal;
        }
        .mani-prompt-sub {
            font-size: var(--text-ui);
            color: var(--text-sub);
            line-height: 1.55;
            font-style: italic;
        }
        .mani-prompt-input {
            width: 100%;
            min-height: 72px;
            padding: 14px 16px;
            background: var(--bg-input);
            border: 2px solid var(--border);
            border-radius: var(--radius-md);
            font-family: var(--font-mono);
            font-size: var(--text-emph);
            line-height: 1.65;
            color: var(--text-primary);
            resize: vertical;
            outline: none;
            caret-color: var(--amber);
            transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
        }
        .mani-prompt-input:focus {
            border-color: var(--amber);
            box-shadow: 0 0 0 3px var(--amber-glow);
        }
        .mani-prompt-input::placeholder {
            color: var(--text-muted);
            font-style: italic;
        }
        .mani-prompt-saved {
            font-size: var(--text-note);
            color: var(--success-text);
            font-weight: 600;
            opacity: 0;
            transition: opacity 0.3s;
            min-height: 1.2em;
        }
        .mani-prompt-saved.on { opacity: 1; }

        .mani-footer {
            padding: 18px 28px 24px;
            border-top: 1px solid var(--border-mid);
            flex-shrink: 0;
            display: flex; flex-direction: column; align-items: center; gap: 10px;
        }
        .mani-counter {
            font-size: var(--text-ui); color: var(--text-muted);
            letter-spacing: 0.05em;
            transition: color 0.3s;
        }
        .mani-counter.all { color: var(--amber-text); font-weight: 700; }
        .mani-proceed-btn {
            background: var(--grad-amber);
            color: #fff;
            border: none; padding: 14px 40px;
            border-radius: var(--radius-full);
            font-family: var(--font-body); font-size: var(--text-subtitle); font-weight: 800;
            cursor: pointer; letter-spacing: 0.05em;
            transition: all var(--transition-medium);
            box-shadow: var(--shadow-md);
            opacity: 0; pointer-events: none;
            transform: translateY(8px);
        }
        .mani-proceed-btn.on {
            opacity: 1; pointer-events: all; transform: translateY(0);
        }
        .mani-proceed-btn:hover { background: var(--grad-amber-hi); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
        .mani-proceed-btn:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; }
        .mani-freire-note {
            font-size: var(--text-note); color: var(--text-muted);
            font-style: italic; text-align: center;
            opacity: 0; transition: opacity 0.5s;
            line-height: 1.6;
        }
        .mani-freire-note.on { opacity: 1; }

        /* ── Confirmation Modal (draft-save) ── */
        .confirm-bg {
            position: fixed; inset: 0;
            background: rgba(42,33,28,0.65);
            backdrop-filter: blur(10px) saturate(1.1);
            display: flex; align-items: center; justify-content: center;
            z-index: 350;
            opacity: 0; pointer-events: none;
            transition: opacity var(--transition-medium);
        }
        .confirm-bg.on { opacity: 1; pointer-events: all; }
        .confirm-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            padding: 36px 32px 32px;
            border-radius: var(--radius-lg);
            max-width: 420px; width: 90%;
            text-align: center;
            box-shadow: var(--shadow-lg);
            position: relative; overflow: hidden;
        }
        .confirm-card::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 2px;
            background: var(--grad-amber);
        }
        .confirm-icon-lg { font-size: 36px; margin-bottom: 12px; }
        .confirm-title {
            font-family: var(--font-display);
            font-size: 1.35rem; color: var(--text-primary);
            margin-bottom: 8px; line-height: 1.3;
        }
        .confirm-title span { font-size: var(--text-subtitle); color: var(--text-sub); font-family: var(--font-body); display: block; margin-top: 6px; }
        .confirm-body {
            font-size: var(--text-emph); color: var(--text-sub);
            line-height: 1.75; margin-bottom: 24px;
        }
        .confirm-body em { color: var(--amber-text); font-style: normal; }
        .confirm-btns { display: flex; gap: 10px; justify-content: center; }
        .confirm-btn-cancel {
            padding: 12px 24px;
            min-height: 44px;
            background: var(--bg-surface);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-full);
            color: var(--text-sub);
            font-family: var(--font-body); font-size: var(--text-emph); font-weight: 600;
            cursor: pointer; transition: all var(--transition-fast);
        }
        .confirm-btn-cancel:hover { color: var(--text-primary); border-color: var(--amber); }
        .confirm-btn-cancel:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .confirm-btn-ok {
            padding: 12px 24px;
            min-height: 44px;
            background: var(--grad-amber);
            border: none;
            border-radius: var(--radius-full);
            color: #fff;
            font-family: var(--font-body); font-size: var(--text-emph); font-weight: 700;
            cursor: pointer; transition: all var(--transition-fast);
            box-shadow: var(--shadow-sm);
        }
        .confirm-btn-ok:hover { filter: brightness(1.1); transform: translateY(-1px); }
        .confirm-btn-ok:focus-visible { outline: var(--focus-ring-strong); outline-offset: 2px; }

        /* ── "I'm Stuck" fast-path button ── */
        .stuck-row { padding: 0 0 5px; }
        .stuck-btn {
            padding: 8px 16px;
            background: transparent;
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-full);
            font-family: var(--font-body); font-size: var(--text-ui); font-weight: 600;
            color: var(--text-sub); cursor: pointer;
            transition: all var(--transition-fast); letter-spacing: 0.02em;
        }
        .stuck-btn:hover:not(:disabled) {
            border-color: var(--jade); color: var(--jade-text);
            box-shadow: 0 0 10px var(--jade-glow);
        }
        .stuck-btn:disabled { opacity: 0.35; cursor: not-allowed; }

        /* ── Stuck Triage Menu ── */
        .stuck-triage {
            position: absolute;
            bottom: calc(100% + 8px);
            left: 0;
            right: 0;
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-lg);
            padding: 10px;
            box-shadow: var(--shadow-lg);
            display: none;
            flex-direction: column;
            gap: 4px;
            z-index: 50;
            animation: triageIn 0.2s ease;
            /* Context-Collapse sprint C: never exceed a short viewport (e.g. phone
               with keyboard up) — the open menu scrolls instead of overflowing. */
            max-height: min(420px, 70svh);
            /* Short-desktop occlusion fix: also fit inside the chat panel
               (100cqh = panel height; 160px reserves the input row/hint and
               anchor gap below the menu at every breakpoint), so top options
               never clip under the journey/task band or mobile header.
               Browsers without cqh keep the line above. */
            max-height: min(420px, 70svh, calc(100cqh - 160px));
            overflow-y: auto;
        }
        .stuck-triage.on { display: flex; }
        @keyframes triageIn {
            from { opacity: 0; transform: translateY(8px); }
            to   { opacity: 1; transform: translateY(0); }
        }
        .stuck-triage-title {
            font-size: var(--text-caption); font-weight: 700;
            color: var(--text-sub); letter-spacing: 0.06em;
            text-transform: uppercase;
            padding: 6px 10px 4px;
            border-bottom: 1px solid var(--border);
            margin-bottom: 4px;
        }
        /* Intent group headers — the menu scans as three small choices
           (writing help / pace / instructor) instead of five equal rows. */
        .stuck-group-label {
            font-size: var(--text-micro); font-weight: 700;
            color: var(--text-sub); letter-spacing: 0.05em;
            text-transform: uppercase;
            padding: 7px 10px 2px;
        }
        /* ADHD Nav B6: a hairline + breathing room where each new group starts —
           the intent groups read as clearly separate zones (same buttons,
           same handlers; presentation only). */
        .stuck-option + .stuck-group-label {
            border-top: 1px solid var(--border);
            margin-top: 6px;
            padding-top: 9px;
        }
        .stuck-option {
            display: flex; align-items: center; gap: 10px;
            padding: 9px 12px;
            border-radius: var(--radius-md);
            background: transparent;
            border: none;
            cursor: pointer;
            font-family: var(--font-body);
            font-size: var(--text-body);
            color: var(--text-primary);
            text-align: left;
            transition: background var(--transition-fast);
        }
        .stuck-option:hover {
            background: var(--bg-panel);
        }
        .stuck-option-icon {
            font-size: 1rem;
            width: 24px; text-align: center;
            flex-shrink: 0;
        }
        .stuck-option-label {
            line-height: 1.35;
        }
        .stuck-option-sub {
            font-size: var(--text-label);
            color: var(--text-muted);
            display: block;
        }
        .stuck-triage-close {
            margin-top: 4px;
            padding: 6px 12px;
            border: none; background: none;
            font-family: var(--font-body);
            font-size: var(--text-note);
            color: var(--text-muted);
            cursor: pointer;
            text-align: center;
            border-radius: var(--radius-md);
        }
        .stuck-triage-close:hover { color: var(--text-primary); background: var(--bg-panel); }

        /* ── Phase Celebration Toast ── */
        .phase-toast {
            position: fixed;
            top: 50%; left: 50%;
            transform: translateX(-50%) translateY(-40%) scale(0.92);
            background: var(--bg-raised);
            border: 2px solid var(--amber);
            border-radius: var(--radius-lg);
            padding: 28px 36px 24px;
            box-shadow: var(--shadow-lg), 0 0 50px var(--amber-glow);
            z-index: 500;
            text-align: center;
            max-width: min(520px, 92vw);
            /* H1 (2026-06-12, iPhone QA): long bilingual bodies (e.g., stage 9)
               exceeded short viewports with overflow:hidden — the Continue CTA
               was clipped and unreachable. Cap height and allow scroll. */
            max-height: 82vh;
            max-height: 82dvh; /* iOS Safari dynamic viewport */
            opacity: 0;
            transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
            pointer-events: none;
            overflow-y: auto;
            overflow-x: hidden;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
        }
        @media (max-width: 640px) {
            .phase-toast {
                padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px));
            }
        }
        .phase-toast::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 4px;
            background: var(--grad-amber);
        }
        .phase-toast.on {
            transform: translateX(-50%) translateY(-50%) scale(1);
            opacity: 1;
            pointer-events: auto;
        }
        .phase-toast-icon {
            font-size: 36px; margin-bottom: 10px;
        }
        .phase-toast-badge {
            font-size: var(--text-caption); font-weight: 700;
            letter-spacing: 0.1em; text-transform: uppercase;
            color: var(--amber-text);
            margin-bottom: 6px;
        }
        .phase-toast-title {
            font-family: var(--font-display);
            font-size: 1.25rem; font-weight: 600;
            color: var(--text-primary);
            line-height: 1.4;
            margin-bottom: 8px;
        }
        .phase-toast-body {
            font-size: var(--text-emph);
            color: var(--text-sub);
            line-height: 1.7;
            margin-bottom: 16px;
        }
        .phase-toast-body em {
            color: var(--amber-text); font-style: normal; font-weight: 600;
        }
        .phase-toast-close {
            position: absolute; top: 10px; right: 12px;
            background: none; border: none; color: var(--text-muted);
            font-size: 1.1rem; cursor: pointer; padding: 4px;
            line-height: 1; border-radius: var(--radius-sm);
            transition: all var(--transition-fast);
        }
        .phase-toast-close:hover { color: var(--text-primary); background: var(--bg-panel); }
        .phase-toast-cta {
            display: inline-flex; align-items: center; gap: 6px;
            background: var(--grad-amber); color: #fff;
            border: none; padding: 10px 28px;
            border-radius: var(--radius-full);
            font-family: var(--font-body); font-size: var(--text-emph); font-weight: 700;
            cursor: pointer; letter-spacing: 0.03em;
            box-shadow: var(--shadow-sm);
            transition: all var(--transition-fast);
        }
        .phase-toast-cta:hover { background: var(--grad-amber-hi); transform: translateY(-1px); }

        /* ── Skill Badges ── */
        .badge-strip {
            display: none; flex-wrap: wrap; gap: 6px;
            padding: 6px 0;
        }
        .badge-strip.on { display: flex; }
        .skill-badge {
            display: inline-flex; align-items: center; gap: 5px;
            padding: 4px 10px;
            border-radius: var(--radius-full);
            font-size: var(--text-caption); font-weight: 600;
            letter-spacing: 0.02em;
            border: 1px solid;
            white-space: nowrap;
        }
        .skill-badge.story    { background: rgba(184,92,26,0.08); border-color: var(--amber); color: var(--amber-text); }
        .skill-badge.arch     { background: rgba(42,122,106,0.08); border-color: var(--jade); color: var(--jade-text); }
        .skill-badge.voice    { background: rgba(176,106,106,0.08); border-color: var(--rose); color: var(--rose); }
        .skill-badge.bridge   { background: rgba(74,124,89,0.08); border-color: var(--success); color: var(--success-text); }
        .skill-badge.editor   { background: rgba(139,115,85,0.08); border-color: var(--metal-hi); color: var(--metal-hi); }
        .skill-badge.doc      { background: rgba(160,144,128,0.08); border-color: var(--border-hi); color: var(--text-sub); }

        /* ── Session Streak Indicator ── */
        .streak-bar {
            display: none; align-items: center; gap: 8px;
            padding: 4px 0;
            font-size: var(--text-caption);
            color: var(--text-muted);
        }
        .streak-bar.on { display: flex; }
        .streak-dot {
            width: 6px; height: 6px;
            border-radius: 50%;
            background: var(--border);
        }
        .streak-dot.active {
            background: var(--amber);
            box-shadow: 0 0 6px var(--amber-glow);
        }

        /* ── Mixed-genre essay definition ── */
        .essay-def-wrap { margin-top: 5px; }
        .essay-def-toggle {
            display: inline-flex; align-items: center; gap: 5px;
            font-size: var(--text-label); color: var(--text-muted);
            cursor: pointer; user-select: none;
            letter-spacing: 0.02em; border: none; background: none;
            font-family: var(--font-body); padding: 0;
        }
        .essay-def-toggle:hover { color: var(--amber-text); }
        .essay-def-badge {
            width: 14px; height: 14px; border-radius: 50%;
            border: 1px solid var(--border-hi);
            display: inline-flex; align-items: center; justify-content: center;
            font-size: 9px; font-style: italic; color: var(--text-sub);
            flex-shrink: 0; line-height: 1;
        }
        .essay-def-popup {
            display: none; margin-top: 8px;
            padding: 12px 16px;
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-left: 3px solid var(--amber);
            border-radius: var(--radius-sm);
            font-size: var(--text-body); color: var(--text-primary);
            line-height: 1.65; font-style: normal;
        }
        .essay-def-popup.on { display: block; }
        .essay-def-popup em { color: var(--amber-text); font-style: normal; }

        /* ── Session-restore divider in chat ── */
        .session-divider {
            display: flex; align-items: center; gap: 10px;
            padding: 10px 0; flex-shrink: 0;
        }
        .session-divider::before, .session-divider::after {
            content: ''; flex: 1; height: 1px; background: var(--border);
        }
        .session-divider span {
            font-size: var(--text-note); color: var(--text-muted);
            letter-spacing: 0.04em; white-space: nowrap; font-style: italic;
        }
        .session-divider time {
            font-size: var(--text-caption); color: var(--text-muted);
            letter-spacing: 0.04em; white-space: nowrap;
            font-weight: 600;
        }

        .msg-content {
            display: flex;
            flex-direction: column;
            min-width: 0;
        }
        .msg-time {
            font-size: var(--text-label);
            color: var(--text-muted);
            font-variant-numeric: tabular-nums;
            padding-top: 4px;
            opacity: 0.7;
        }
        .msg.user .msg-time { text-align: right; }
        .msg.bot .msg-time { text-align: left; }

        /* ── TEMP: Onboarding Preview Bar ── */
        .dev-preview-bar {
            position: fixed;
            bottom: 18px; right: 18px;
            display: none; /* hidden by default; shown via ?dev=true */
            gap: 8px;
            z-index: 1000;
            background: var(--bg-raised);
            border: 1px dashed var(--amber);
            border-radius: var(--radius-md);
            padding: 10px 14px;
            box-shadow: var(--shadow-lg);
            align-items: center;
        }
        .dev-preview-label {
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--amber-text);
            margin-right: 6px;
            white-space: nowrap;
        }
        .dev-preview-btn {
            padding: 6px 12px;
            background: var(--bg-surface);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-sm);
            font-family: var(--font-body);
            font-size: var(--text-note);
            font-weight: 600;
            color: var(--text-sub);
            cursor: pointer;
            transition: all var(--transition-fast);
            white-space: nowrap;
        }
        .dev-preview-btn:hover {
            border-color: var(--amber);
            color: var(--amber-text);
            background: var(--bg-panel);
        }
        .dev-preview-btn:focus-visible {
            outline: var(--focus-ring);
            outline-offset: 2px;
        }
        @media (max-width: 768px) {
            .dev-preview-bar {
                bottom: 10px; right: 10px;
                padding: 8px 10px;
                gap: 6px;
                flex-wrap: wrap;
                justify-content: flex-end;
                max-width: calc(100vw - 20px);
            }
            .dev-preview-label {
                width: 100%;
                text-align: right;
                margin-right: 0;
                margin-bottom: 2px;
            }
        }

        /* ── Custom SVG Icon System ── */
        .tp-icon {
            display: inline-block;
            vertical-align: middle;
            flex-shrink: 0;
        }
        .tp-icon svg {
            fill: none;
            stroke: var(--text-sub);
            stroke-width: 1.85;
            stroke-linecap: round;
            stroke-linejoin: round;
            vector-effect: non-scaling-stroke;
            display: block;
        }
        .tp-icon .soft { opacity: 0.18; fill: var(--amber); stroke: none; }
        .tp-icon .tp-fill-paper { fill: var(--bg-raised); stroke: var(--text-sub); }
        .tp-icon .tp-fill-paper2 { fill: var(--bg-panel); stroke: var(--text-sub); }
        .tp-icon .tp-fill-mango { fill: var(--amber-text); stroke: var(--text-sub); }
        .tp-icon .tp-fill-jade { fill: var(--jade); stroke: var(--text-sub); }
        .tp-icon .tp-fill-teal { fill: var(--jade-text); stroke: var(--text-sub); }
        .tp-icon .tp-fill-clay { fill: var(--rose); stroke: var(--text-sub); }
        .tp-icon .tp-fill-plum { fill: #9a6aaa; stroke: var(--text-sub); }
        .tp-icon .tp-fill-sky { fill: var(--sky); stroke: var(--text-sub); }
        .tp-icon .tp-fill-leaf { fill: var(--success); stroke: var(--text-sub); }
        .tp-icon .tp-fill-rose { fill: var(--rose); stroke: var(--text-sub); }

        .header-logo .tp-icon svg { width: 28px; height: 28px; }
        .chat-avatar .tp-icon svg { width: 20px; height: 20px; }
        .eval-q-icon .tp-icon svg { width: 18px; height: 18px; }
        .btn-icon .tp-icon svg { width: 16px; height: 16px; }
        .toast-icon .tp-icon svg { width: 36px; height: 36px; }
        .badge-icon .tp-icon svg { width: 14px; height: 14px; }

        /* ── Responsive ── */
        @media (max-width: 1024px) {
            .workspace { grid-template-columns: 50% 50%; }
            .stage-node { padding: 0 16px; }
            .phase-group + .phase-group { margin-left: 6px; }
        }
        @media (max-width: 768px) {
            .workspace { grid-template-columns: 1fr; grid-template-rows: 55% 45%; }
            .draft-panel { border-right: none; border-bottom: 1px solid var(--border); }
            .app-header  { padding: 10px 16px; }
            .journey-wrap { padding: 10px 14px; gap: 6px; }
            .journey-toggle { padding: 6px 10px; }
            .journey-toggle-text { display: none; }
            .stage-circle { width: 36px; height: 36px; font-size: var(--text-caption); }
            .stage-node:not(:last-child)::after { top: 17px; left: calc(50% + 15px); width: calc(100% - 30px); }
            .stage-label { font-size: 0.65rem; max-width: 64px; }
            .stage-label .label-en { font-size: var(--text-micro); }
            .mani-grid { grid-template-columns: 1fr; padding: 0 20px 8px; }
            .mani-claim-toast { margin: 0 20px; font-size: var(--text-ui); }
            .lab-body { padding: 18px 20px; }
            .mani-header { padding: 20px 20px 16px; }
            .lab-header { padding: 18px 20px 14px; }
            .mani-footer { padding: 14px 20px 18px; }
            .lab-footer { padding: 14px 20px 18px; }
            .workspace.focus-mode { grid-template-columns: 1fr; grid-template-rows: 100% 0fr; }
            .workspace.focus-mode .draft-panel { display: flex; }
            .header-text h1 { font-size: 1.1rem; }
            .lab-card, .mani-card { border-radius: var(--radius-md); }
            .mani-prompt { padding: 18px 20px; }
            .mani-prompt-label { font-size: var(--text-subtitle); }
        }

        /* ── Animated Laptop + Coffee Avatar ── */
        .chat-avatar-anim {
            width: 58px !important;
            height: 46px !important;
            border-radius: var(--radius-sm) !important;
            padding: 3px !important;
            overflow: visible !important;
            flex-shrink: 0;
        }
        .tp-av-bg      { fill: #f4dfbd; opacity: 0.82; }
        .tp-av-glow    { fill: #f0c783; opacity: 0.18; transform-origin: 120px 110px; animation: tpAvGlow 4.2s ease-in-out infinite; }
        .tp-av-laptop  { fill: #5f8a65; stroke: #315642; stroke-width: 4; stroke-linejoin: round; }
        .tp-av-screen  { fill: #fffaf0; stroke: #315642; stroke-width: 3.5; stroke-linejoin: round; }
        .tp-av-screen-inner { fill: #f7ecd8; opacity: 0.68; }
        .tp-av-base    { fill: #e8ddc8; stroke: #315642; stroke-width: 3.5; stroke-linejoin: round; }
        .tp-av-trackpad { fill: #fffaf0; stroke: rgba(49,86,66,0.5); stroke-width: 2; }
        .tp-av-key     { fill: rgba(49,86,66,0.38); }
        .tp-av-line    { fill: none; stroke: #c68642; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 76; stroke-dashoffset: 76; animation: tpAvLine 4.8s ease-in-out infinite; }
        .tp-av-line.l2 { stroke-dasharray: 62; stroke-dashoffset: 62; animation-delay: 0.42s; }
        .tp-av-line.l3 { stroke-dasharray: 48; stroke-dashoffset: 48; animation-delay: 0.84s; }
        .tp-av-cursor  { fill: #315642; animation: tpAvCursor 1s steps(1,end) infinite; }
        .tp-av-spark   { fill: #d79638; opacity: 0.78; transform-origin: center; animation: tpAvSpark 2.8s ease-in-out infinite; }
        .tp-av-cup     { fill: #fff7ea; stroke: #315642; stroke-width: 3.5; stroke-linejoin: round; }
        .tp-av-coffee  { fill: #6b4329; opacity: 0.9; }
        .tp-av-handle  { fill: none; stroke: #315642; stroke-width: 3.5; stroke-linecap: round; }
        .tp-av-saucer  { fill: #eadfce; stroke: #315642; stroke-width: 3; }
        .tp-av-steam   { fill: none; stroke: #8a6b4d; stroke-width: 3.2; stroke-linecap: round; opacity: 0.62; animation: tpAvSteam 3.4s ease-in-out infinite; }
        .tp-av-steam.s2 { animation-delay: 0.45s; }
        .tp-av-steam.s3 { animation-delay: 0.9s; }
        @keyframes tpAvGlow {
            0%,100% { transform: scale(0.96); opacity: 0.14; }
            50%      { transform: scale(1.05); opacity: 0.28; }
        }
        @keyframes tpAvLine {
            0%,18%   { stroke-dashoffset: 76; }
            45%,78%  { stroke-dashoffset: 0; }
            100%     { stroke-dashoffset: 76; }
        }
        @keyframes tpAvCursor {
            0%,48%  { opacity: 1; }
            49%,100% { opacity: 0; }
        }
        @keyframes tpAvSteam {
            0%   { transform: translateY(8px) scale(0.92); opacity: 0; }
            35%  { opacity: 0.55; }
            70%  { opacity: 0.4; }
            100% { transform: translateY(-14px) scale(1.08); opacity: 0; }
        }
        @keyframes tpAvSpark {
            0%,100% { transform: scale(0.9) rotate(0deg); opacity: 0.4; }
            50%     { transform: scale(1.12) rotate(8deg); opacity: 0.9; }
        }
        @media (prefers-reduced-motion: reduce) {
            .tp-av-glow, .tp-av-line, .tp-av-cursor, .tp-av-steam, .tp-av-spark { animation: none; }
        }

        /* ── Tone Toggle ── */
        .tone-toggle {
            margin-left: auto;
            display: flex; align-items: center; gap: 5px;
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-full);
            padding: 5px 12px;
            font-family: var(--font-body);
            font-size: var(--text-caption); font-weight: 700;
            color: var(--text-sub);
            cursor: pointer;
            white-space: nowrap;
            letter-spacing: 0.04em;
            transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
        }
        .tone-toggle:hover { background: var(--bg-surface); color: var(--amber); border-color: var(--amber); }
        .tone-toggle.direct { color: var(--jade-text); border-color: var(--jade); background: var(--jade-glow); }

        /* ── Stuck Mini Panel ── */
        .stuck-mini {
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-lg);
            padding: 20px 22px 16px;
            display: flex; flex-direction: column; gap: 14px;
            box-shadow: var(--shadow-md);
            animation: stuckMiniIn 0.22s ease;
        }
        @keyframes stuckMiniIn {
            from { opacity: 0; transform: translateY(6px); }
            to   { opacity: 1; transform: translateY(0); }
        }
        .stuck-mini-affirmation {
            font-size: var(--text-emph); font-weight: 700;
            color: var(--jade-text); letter-spacing: 0.01em;
        }
        .stuck-mini-task {
            font-size: var(--text-ui); color: var(--text-sub);
            padding: 8px 12px;
            background: var(--bg-panel);
            border-left: 3px solid var(--jade);
            border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
            line-height: 1.5;
        }
        .stuck-mini-task strong { color: var(--text-primary); display: block; margin-bottom: 2px; }
        .stuck-mini-starter {
            font-family: var(--font-display); font-style: italic;
            font-size: var(--text-subtitle); color: var(--amber-text);
            background: var(--amber-glow);
            border-radius: var(--radius-sm);
            padding: 10px 14px;
            line-height: 1.5;
            cursor: pointer;
            user-select: text;
        }
        .stuck-mini-starter-label {
            font-family: var(--font-body); font-style: normal;
            font-size: var(--text-micro); font-weight: 700;
            color: var(--text-muted); text-transform: uppercase;
            letter-spacing: 0.06em; display: block; margin-bottom: 4px;
        }
        .stuck-mini-actions {
            display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
        }
        .stuck-mini-primary {
            display: inline-flex; align-items: center; justify-content: center;
            padding: 9px 18px; min-height: 44px;
            background: var(--grad-success); color: #fff;
            border: none; border-radius: var(--radius-full);
            font-family: var(--font-body); font-size: var(--text-body); font-weight: 700;
            cursor: pointer; transition: opacity var(--transition-fast);
            flex-shrink: 0;
        }
        .stuck-mini-primary:hover { opacity: 0.88; }
        .stuck-mini-secondary {
            display: inline-flex; align-items: center; justify-content: center;
            padding: 8px 14px; min-height: 44px;
            background: none; border: 1px solid var(--border-hi);
            border-radius: var(--radius-full);
            font-family: var(--font-body); font-size: var(--text-ui);
            color: var(--text-sub); cursor: pointer;
            transition: all var(--transition-fast);
        }
        .stuck-mini-secondary:hover { border-color: var(--amber); color: var(--amber-text); }
        .stuck-mini-close {
            display: inline-flex; align-items: center; justify-content: center;
            margin-left: auto; background: none; border: none;
            font-size: var(--text-label); color: var(--text-muted); cursor: pointer;
            padding: 4px 6px; min-height: 44px; min-width: 44px; border-radius: var(--radius-sm);
        }
        .stuck-mini-close:hover { color: var(--text-primary); }
        @media (prefers-reduced-motion: reduce) {
            .stuck-mini { animation: none; }
        }

        /* ── Save Stamp / Mini-Ceremony ── */
        .save-stamp {
            display: flex; align-items: center; gap: 10px;
            background: var(--success-glow);
            border: 1px solid var(--success);
            border-radius: var(--radius-md);
            padding: 10px 16px;
            animation: stampIn 0.35s cubic-bezier(0.22, 1.1, 0.36, 1);
        }
        @keyframes stampIn {
            from { opacity: 0; transform: scale(0.82) rotate(-4deg); }
            to   { opacity: 1; transform: scale(1) rotate(0deg); }
        }
        .save-stamp-icon { font-size: 1.5rem; flex-shrink: 0; }
        .save-stamp-text { font-size: var(--text-emph); font-weight: 700; color: var(--success-text); line-height: 1.35; }
        .save-stamp-sub  { font-size: var(--text-note); font-weight: 400; color: var(--text-sub); }
        @media (prefers-reduced-motion: reduce) {
            .save-stamp { animation: none; }
        }
        .save-ceremony-actions {
            display: flex; flex-direction: column; gap: 8px; margin-top: 4px;
        }
        .save-ceremony-btn {
            padding: 11px 18px; border-radius: var(--radius-md);
            font-family: var(--font-body); font-size: var(--text-emph); font-weight: 700;
            cursor: pointer; border: none; transition: all var(--transition-fast);
            text-align: left;
        }
        .save-ceremony-btn.primary {
            background: var(--grad-amber); color: #fff;
        }
        .save-ceremony-btn.primary:hover { background: var(--grad-amber-hi); }
        .save-ceremony-btn.secondary {
            background: var(--bg-panel); color: var(--text-primary);
            border: 1px solid var(--border-hi);
        }
        .save-ceremony-btn.secondary:hover { border-color: var(--amber); }

        /* ── Revision Mode Panel ── */
        .revision-panel {
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-lg);
            padding: 18px 20px;
            display: flex; flex-direction: column; gap: 14px;
        }
        .revision-panel-title {
            font-family: var(--font-display); font-size: 1rem; font-weight: 600;
            color: var(--text-primary); line-height: 1.3;
        }
        .revision-panel-sub {
            font-size: var(--text-ui); color: var(--text-sub); line-height: 1.5; margin-top: -8px;
        }
        .revision-category { display: flex; flex-direction: column; gap: 6px; }
        .revision-category-header {
            display: flex; align-items: center; gap: 8px;
            font-size: var(--text-ui); font-weight: 700; letter-spacing: 0.04em;
            text-transform: uppercase; cursor: pointer; user-select: none;
        }
        .revision-category-header.small { color: var(--jade-text); }
        .revision-category-header.big   { color: var(--amber-text); }
        .revision-category-toggle { margin-left: auto; font-size: var(--text-micro); color: var(--text-muted); }
        .revision-examples {
            display: flex; flex-direction: column; gap: 4px;
            padding-left: 4px;
        }
        .revision-examples.hidden { display: none; }
        .revision-example-btn {
            text-align: left; background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 8px 12px;
            font-family: var(--font-body); font-size: var(--text-body);
            color: var(--text-primary); cursor: pointer;
            transition: background var(--transition-fast), border-color var(--transition-fast);
            line-height: 1.4;
        }
        .revision-example-btn:hover { background: var(--bg-surface); border-color: var(--jade); }
        .revision-example-btn.selected { border-color: var(--jade); background: var(--jade-glow); color: var(--jade-text); font-weight: 600; }
        .revision-panel-note {
            font-size: var(--text-note); color: var(--text-muted); line-height: 1.55;
            border-top: 1px solid var(--border); padding-top: 10px;
        }

        /* ── Stage 4 Research Guidance Card ── */
        .research-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-left: 3px solid var(--sky);
            border-radius: var(--radius-lg);
            padding: 18px 20px;
            display: flex; flex-direction: column; gap: 12px;
            margin: 6px 0 10px;
        }
        /* In-flow micro-reflection (Batch 4) — compact, warm, one question */
        .micro-reflect {
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-left: 3px solid var(--jade);
            border-radius: var(--radius-lg);
            padding: 14px 16px;
            display: flex; flex-direction: column; gap: 8px;
            margin: 6px 0 10px;
        }
        .micro-reflect-prompt {
            font-size: var(--text-emph); font-weight: 600; color: var(--text-primary); line-height: 1.4;
        }
        .micro-reflect-text {
            width: 100%; box-sizing: border-box; resize: vertical; min-height: 44px;
            font-family: inherit; font-size: var(--text-emph); line-height: 1.5;
            color: var(--text-primary); background: var(--bg-surface);
            border: 1px solid var(--border-mid); border-radius: var(--radius-sm);
            padding: 8px 10px;
        }
        .micro-reflect-text:focus { outline: none; border-color: var(--jade); }
        .micro-reflect-benefit { font-size: var(--text-note); color: var(--text-sub); line-height: 1.5; }
        .research-card-title {
            font-family: var(--font-display); font-size: 1rem; font-weight: 600;
            color: var(--text-primary); line-height: 1.3;
        }
        .research-guardrail {
            font-size: var(--text-ui); color: var(--text-sub); line-height: 1.6;
            background: var(--amber-glow); border: 1px solid var(--amber);
            border-radius: var(--radius-sm);
            padding: 10px 13px;
        }
        .research-guardrail strong { color: var(--amber-text); font-weight: 700; }
        .research-card-sub {
            font-size: var(--text-note); font-weight: 700; letter-spacing: 0.04em;
            text-transform: uppercase; color: var(--sky);
            margin-bottom: -4px;
        }
        .research-strategy-list {
            display: flex; flex-direction: column; gap: 5px;
        }
        .research-strategy-btn {
            text-align: left; background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 9px 13px;
            font-family: var(--font-body); font-size: var(--text-body);
            color: var(--text-primary); cursor: pointer;
            transition: background var(--transition-fast), border-color var(--transition-fast);
            line-height: 1.45; min-height: 44px;
        }
        .research-strategy-btn:hover  { background: var(--bg-surface); border-color: var(--sky); }
        .research-strategy-btn.selected {
            border-color: var(--sky); background: rgba(108,158,207,0.12);
            color: var(--text-primary); font-weight: 600;
        }
        .research-card-note {
            font-size: var(--text-note); color: var(--text-muted); line-height: 1.55;
            border-top: 1px solid var(--border); padding-top: 10px;
        }

        /* ── Stage 8 Voice Polish Card ── */
        .voice-polish-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            border-left: 3px solid var(--amber);
            border-radius: var(--radius-lg);
            padding: 18px 20px;
            display: flex; flex-direction: column; gap: 12px;
            margin: 6px 0 10px;
        }
        .vp-card-title {
            font-family: var(--font-display); font-size: 1rem; font-weight: 600;
            color: var(--text-primary); line-height: 1.3;
        }
        .vp-steps {
            display: flex; flex-direction: column; gap: 8px;
            padding-left: 0; list-style: none;
        }
        .vp-step {
            display: flex; align-items: flex-start; gap: 10px;
            font-size: var(--text-body); color: var(--text-sub); line-height: 1.55;
        }
        .vp-step-num {
            flex-shrink: 0;
            width: 22px; height: 22px;
            display: inline-flex; align-items: center; justify-content: center;
            background: var(--amber-glow); border: 1px solid var(--amber);
            border-radius: 50%;
            font-size: var(--text-caption); font-weight: 700; color: var(--amber-text);
            margin-top: 1px;
        }
        .vp-routes-label {
            font-size: var(--text-note); font-weight: 700; letter-spacing: 0.04em;
            text-transform: uppercase; color: var(--amber-text);
            margin-bottom: -4px;
        }
        .vp-routes { display: flex; flex-direction: column; gap: 5px; }
        .vp-route-btn {
            text-align: left; background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 9px 13px; width: 100%;
            font-family: var(--font-body); font-size: var(--text-body);
            color: var(--text-primary); cursor: pointer;
            transition: background var(--transition-fast), border-color var(--transition-fast);
            line-height: 1.45; min-height: 44px;
        }
        .vp-route-btn:hover  { background: var(--bg-surface); border-color: var(--amber); }
        .vp-route-btn.selected {
            border-color: var(--amber); background: var(--amber-glow);
            color: var(--amber-text); font-weight: 600;
        }
        .vp-route-protect              { border-color: rgba(42,122,106,0.35); }
        .vp-route-protect:hover        { border-color: var(--jade); }
        .vp-route-protect.selected     {
            border-color: var(--jade); background: var(--jade-glow);
            color: var(--jade-text); font-weight: 600;
        }
        .vp-guardrail {
            font-size: var(--text-note); color: var(--text-muted); line-height: 1.55;
            border-top: 1px solid var(--border); padding-top: 10px;
            font-style: italic;
        }
        .vp-protect-note {
            font-size: var(--text-ui); color: var(--text-sub); line-height: 1.6;
            background: var(--jade-glow); border: 1px solid var(--jade);
            border-radius: var(--radius-sm); padding: 10px 13px;
        }

        /* ── Current Task Bar ── */
        .current-task-bar {
            background: var(--bg-raised);
            border-bottom: 1px solid var(--border);
            padding: 0 20px;
            flex-shrink: 0;
            display: flex;
            align-items: stretch;
            min-height: 46px;   /* B1: room for the dominant task line */
        }
        .ctb-stage-col {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 14px 8px 0;
            border-right: 1px solid var(--border);
            flex-shrink: 0;
        }
        .ctb-stage {
            font-size: var(--text-caption);
            font-weight: 700;
            color: var(--amber-text);
            white-space: nowrap;
        }
        .ctb-dots {
            display: flex;
            gap: 5px;
            align-items: center;
        }
        .ctb-dot {
            width: 6px; height: 6px;
            border-radius: 50%;
            background: var(--border-hi);
            flex-shrink: 0;
            transition: background var(--transition-fast), transform var(--transition-fast);
        }
        .ctb-dot.active  { background: var(--jade); transform: scale(1.35); }
        .ctb-dot.done    { background: var(--success); }
        /* ADHD Nav B2: future dots recede — the active dot is the one open door */
        .ctb-dot:not(.active):not(.done) { opacity: 0.55; }
        /* B7: concrete next-step line in the draft-protected ceremony */
        .modal-next-hint {
            font-size: var(--text-label); color: var(--text-muted);
            line-height: 1.5; margin-bottom: 12px; text-align: left;
        }

        /* B6: purpose group headers inside the export panel's "Other options" —
           backup/data vs report-only vs destructive read as separate small zones. */
        .report-group-label {
            font-size: var(--text-micro); font-weight: 700;
            color: var(--text-muted); letter-spacing: 0.05em;
            text-transform: uppercase;
            margin: 12px 0 4px;
        }
        .report-group-label.report-group-danger { color: var(--rose); }
        /* ADHD Nav B9: the destructive group also separates with a hairline —
           same zone grammar as the stuck menu; danger reads as its own space */
        .report-group-label.report-group-danger {
            border-top: 1px solid var(--border);
            margin-top: 16px;
            padding-top: 10px;
        }

        /* B5: live-AI attribution chip on freshly rendered coach replies —
           supports process reporting; restored messages carry no chip (documented). */
        .msg-mode-chip {
            display: block; margin-top: 6px;
            font-size: var(--text-micro); color: var(--text-muted);
            letter-spacing: 0.04em; text-transform: uppercase;
        }

        /* B4: quiet numeric echo of the dots — orientation, not a grade */
        .ctb-dot-count {
            font-size: var(--text-micro); color: var(--text-muted);
            margin-left: 4px; font-variant-numeric: tabular-nums;
        }
        .ctb-task-col {
            display: flex;
            align-items: center;
            gap: 14px;
            flex: 1;
            padding: 8px 0 8px 14px;
            min-width: 0;
        }
        /* De-overwhelm B1: the current TASK is the student's one clear next move —
           it carries the visual weight; the stage chrome around it stays secondary.
           Task text arrives via getStageStepOverride, so this emphasis is pathway-
           aware for Default / CAP 200 / Research automatically. */
        .ctb-instruction {
            flex: 1;
            font-size: var(--text-body);
            line-height: 1.35;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            /* ADHD Nav B2: quiet jade threshold — links the current cue to the
               active dot so the task reads as the one open door (display-only) */
            padding-left: 10px;
            border-left: 2px solid var(--jade);
        }
        .ctb-es  { color: var(--text-primary); font-weight: 600; }
        .ctb-sep { color: var(--border-hi); margin: 0 3px; }
        .ctb-en  { color: var(--text-sub); font-size: var(--text-note); }
        /* "de 5 / of 5" — hidden on desktop where the journey map shows progress */
        .ctb-of-total { display: none; }
        @media (max-width: 640px) {
            .current-task-bar { padding: 0 14px; }
            .ctb-sep, .ctb-en { display: none; }
            .ctb-stage { font-size: var(--text-micro); }
            /* B2 threshold dropped on mobile: the narrow cue column needs every
               pixel and the jade active dot sits directly beside the text */
            .ctb-instruction { font-size: var(--text-ui); padding-left: 0; border-left: none; }
        }
        .ctb-toolkit-col {
            display: flex; align-items: center;
            padding: 0 0 0 12px;
            flex-shrink: 0;
        }
        .ctb-toolkit-btn {
            font-family: var(--font-body);
            font-size: var(--text-caption); font-weight: 600;
            color: var(--jade-text);
            background: none;
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-full);
            padding: 3px 10px;
            cursor: pointer; white-space: nowrap;
            transition: border-color var(--transition-fast), background var(--transition-fast);
        }
        .ctb-toolkit-btn:hover { border-color: var(--jade); background: var(--jade-glow); }
        .ctb-toolkit-btn:focus-visible { outline: var(--focus-ring-alt); outline-offset: 2px; }

        /* ── Pana Hint ── */
        .pana-hint {
            display: flex; align-items: flex-start; gap: 8px;
            background: var(--amber-glow);
            border-left: 3px solid var(--amber);
            border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
            padding: 9px 13px;
            font-size: var(--text-ui);
            color: var(--text-sub);
            line-height: 1.5;
            margin: 4px 0 2px;
        }
        .pana-hint-label {
            font-weight: 700; color: var(--amber); font-size: var(--text-caption);
            text-transform: uppercase; letter-spacing: 0.06em;
            white-space: nowrap; padding-top: 1px;
        }

        /* ── Capstone Modal Overlay ──────────────────────── */
        .capstone-bg {
            position: fixed; inset: 0;
            background: rgba(42,33,28,0.78);
            backdrop-filter: blur(14px) saturate(1.2);
            display: flex; justify-content: center;
            z-index: 350;
            opacity: 0; pointer-events: none;
            transition: opacity var(--transition-slow);
            overflow-y: auto;
            padding: 40px 20px;
        }
        .capstone-bg.on { opacity: 1; pointer-events: all; }

        .capstone-modal-card {
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-lg);
            width: min(760px, 94vw);
            display: flex; flex-direction: column;
            box-shadow: var(--shadow-lg), 0 0 40px rgba(45,122,95,0.15);
            position: relative;
            margin: auto;
        }
        .capstone-modal-card::before {
            content: '';
            position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: linear-gradient(90deg, var(--jade), var(--amber), var(--jade));
            border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        }

        .capstone-modal-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: 18px 20px 14px;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }
        .capstone-modal-header-title {
            font-family: var(--font-display);
            font-size: 1.05rem;
            font-weight: 600;
            color: var(--jade);
        }
        .capstone-modal-close {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 1.1rem;
            cursor: pointer;
            padding: 6px 8px;
            border-radius: var(--radius-sm);
            line-height: 1;
            transition: color 0.15s, background 0.15s;
            flex-shrink: 0;
        }
        .capstone-modal-close:hover { color: var(--text); background: var(--bg-panel); }
        .capstone-modal-close:focus-visible { outline: var(--focus-ring-alt); outline-offset: 2px; }

        .capstone-modal-body {
            flex: 1;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            padding: 20px 20px 28px;
        }

        /* persistent chat trigger */
        .capstone-chat-trigger {
            display: flex; flex-direction: column; gap: 8px;
            background: var(--jade-glow);
            border: 1px solid var(--jade);
            border-radius: var(--radius-md);
            padding: 12px 14px;
            margin: 10px 0 6px;
        }
        .capstone-chat-trigger-label {
            font-size: var(--text-note);
            color: var(--text-sub);
        }
        .capstone-reopen-btn {
            display: inline-flex; align-items: center; gap: 4px;
            background: var(--jade);
            color: #fff;
            border: none;
            border-radius: var(--radius-sm);
            padding: 8px 14px;
            font-size: var(--text-ui);
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            transition: background 0.15s, transform 0.1s;
            align-self: flex-start;
        }
        .capstone-reopen-btn:hover { background: var(--jade-dk); transform: translateX(2px); }
        .capstone-reopen-btn:focus-visible { outline: var(--focus-ring-alt); outline-offset: 2px; }

        /* ── Capstone Self-Assessment Panel ── */
        .capstone-panel {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-left: 3px solid var(--jade);
            border-radius: var(--radius-md);
            padding: 20px 20px 24px;
            margin: 10px 0 6px;
            font-size: var(--text-body);
        }
        .capstone-panel-title {
            font-family: var(--font-display);
            font-size: 1rem;
            font-weight: 600;
            color: var(--jade);
            margin-bottom: 2px;
        }
        .capstone-panel-subtitle {
            font-size: var(--text-label);
            color: var(--text-muted);
            margin-bottom: 11px;
        }
        .capstone-intro {
            background: var(--jade-glow);
            border-left: 2px solid var(--jade);
            border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
            padding: 10px 13px;
            font-size: var(--text-ui);
            color: var(--text-sub);
            line-height: 1.55;
            margin-bottom: 14px;
        }
        .capstone-section-label {
            font-size: var(--text-caption);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: var(--text-muted);
            margin: 18px 0 8px;
        }
        .capstone-criterion { margin-bottom: 11px; }
        .capstone-criterion-label {
            font-size: var(--text-ui);
            color: var(--text-primary);
            margin-bottom: 5px;
            line-height: 1.4;
        }
        .capstone-criterion-key {
            font-weight: 700;
            color: var(--jade-text);
        }
        .capstone-rating-group {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
        }
        .capstone-rating-btn {
            padding: 4px 11px;
            font-size: var(--text-label);
            border: 1px solid var(--border);
            background: var(--bg-raised);
            color: var(--text-sub);
            border-radius: var(--radius-full);
            cursor: pointer;
            transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
            font-family: var(--font-body);
            line-height: 1.4;
            min-height: 28px;
        }
        .capstone-rating-btn:hover {
            border-color: var(--jade);
            color: var(--jade-text);
        }
        .capstone-rating-btn:disabled {
            opacity: 0.48;
            cursor: not-allowed;
            border-style: dashed;
        }
        .capstone-rating-btn:disabled:hover {
            border-color: var(--border);
            color: var(--text-sub);
        }
        .capstone-rating-btn[aria-pressed="true"],
        .capstone-rating-btn.selected {
            background: var(--jade);
            border-color: var(--jade);
            color: #fff;
            font-weight: 600;
        }
        .capstone-divider {
            border: none;
            border-top: 1px solid var(--border);
            margin: 20px 0 14px;
        }
        .capstone-reflection-field { margin-bottom: 14px; }
        .capstone-reflection-hint {
            font-size: var(--text-caption);
            color: var(--text-muted);
            margin-bottom: 5px;
            line-height: 1.45;
        }
        .capstone-reflection-label {
            font-size: var(--text-note);
            color: var(--text-sub);
            font-style: italic;
            margin-bottom: 4px;
            display: block;
        }
        .capstone-reflection-text {
            width: 100%;
            min-height: 72px;
            background: var(--bg-input);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            padding: 9px 11px;
            font-family: var(--font-body);
            font-size: var(--text-ui);
            color: var(--text-primary);
            resize: vertical;
            line-height: 1.55;
            transition: border-color var(--transition-fast);
        }
        .capstone-reflection-text:focus {
            outline: none;
            border-color: var(--jade);
            box-shadow: 0 0 0 2px var(--jade-glow);
        }
        .capstone-reflection-text[aria-invalid="true"] {
            border-color: var(--rose);
            box-shadow: 0 0 0 2px var(--rose-glow);
        }
        .capstone-required-note {
            font-weight: 400;
            text-transform: none;
            font-size: var(--text-label);
        }
        .capstone-evidence-status,
        .capstone-evidence-error {
            margin-top: 5px;
            padding: 9px 11px;
            border-radius: var(--radius-sm);
            font-size: var(--text-note);
            line-height: 1.45;
        }
        .capstone-evidence-status {
            color: var(--text-sub);
            background: var(--bg-raised);
            border: 1px solid var(--border);
        }
        .capstone-evidence-status.ready {
            color: var(--jade-text);
            background: var(--jade-glow);
            border-color: var(--jade);
        }
        .capstone-evidence-error {
            color: var(--rose);
            background: var(--rose-glow);
            border: 1px solid var(--rose);
        }

        /* Revision checkpoint */
        .revision-gate-card { max-width: 580px; }
        .revision-gate-eyebrow {
            margin-bottom: 5px;
            color: var(--jade-text);
            font-size: var(--text-caption);
            font-weight: 800;
            letter-spacing: 0.07em;
            text-transform: uppercase;
        }
        .revision-gate-card > p {
            color: var(--text-primary);
            font-size: var(--text-body);
            line-height: 1.6;
        }
        .revision-gate-card .revision-gate-en {
            margin-top: -5px;
            color: var(--text-sub);
        }
        .revision-gate-primary,
        .revision-gate-secondary {
            width: 100%;
            min-height: 44px;
            border-radius: var(--radius-full);
            padding: 10px 16px;
            font: 700 var(--text-body) var(--font-body);
            cursor: pointer;
        }
        .revision-gate-primary {
            margin: 7px 0 16px;
            border: 0;
            color: #fff;
            background: var(--grad-success);
        }
        .revision-gate-secondary {
            margin-top: 10px;
            border: 1px solid var(--border-hi);
            color: var(--text-primary);
            background: var(--bg-raised);
        }
        .revision-exception {
            border-top: 1px solid var(--border);
            padding-top: 12px;
            color: var(--text-sub);
            font-size: var(--text-note);
        }
        .revision-exception summary {
            min-height: 44px;
            display: flex;
            align-items: center;
            color: var(--text-sub);
            font-weight: 700;
            cursor: pointer;
        }
        .revision-exception label:not(.revision-exception-check) {
            display: block;
            margin: 10px 0 5px;
            color: var(--text-primary);
            font-weight: 700;
        }
        .revision-exception textarea {
            width: 100%;
            min-height: 72px;
            padding: 10px 12px;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--bg-input);
            color: var(--text-primary);
            font: var(--text-ui) var(--font-body);
            resize: vertical;
        }
        .revision-exception-check {
            display: flex;
            align-items: flex-start;
            gap: 9px;
            margin-top: 10px;
            line-height: 1.45;
        }
        .revision-exception-check input {
            width: 20px;
            height: 20px;
            flex: 0 0 auto;
        }
        .revision-exception-error {
            margin-top: 9px;
            color: var(--rose);
            font-weight: 700;
        }
        .capstone-action-row {
            display: flex;
            gap: 8px;
            margin-top: 14px;
            flex-wrap: wrap;
            align-items: center;
        }
        .capstone-submit-btn {
            background: var(--grad-success);
            color: #fff;
            border: none;
            border-radius: var(--radius-full);
            padding: 8px 18px;
            font-size: var(--text-ui);
            font-weight: 700;
            font-family: var(--font-body);
            cursor: pointer;
            transition: opacity var(--transition-fast);
            min-height: 36px;
        }
        .capstone-submit-btn:hover { opacity: 0.88; }
        .capstone-export-btn {
            background: transparent;
            border: 1px solid var(--jade);
            color: var(--jade-text);
            border-radius: var(--radius-full);
            padding: 7px 14px;
            font-size: var(--text-note);
            font-family: var(--font-body);
            cursor: pointer;
            transition: background var(--transition-fast);
            min-height: 36px;
        }
        .capstone-export-btn:hover { background: var(--jade-glow); }
        .capstone-done-msg {
            display: none;
            background: var(--jade-glow);
            border: 1px solid var(--jade);
            border-radius: var(--radius-md);
            padding: 12px 16px;
            font-size: var(--text-body);
            color: var(--text-sub);
            line-height: 1.55;
            margin-top: 12px;
        }
        .capstone-done-msg.on { display: block; }
        .capstone-done-title {
            font-weight: 700;
            font-family: var(--font-display);
            font-size: var(--text-subtitle);
            color: var(--jade-text);
            margin-bottom: 6px;
        }
        .capstone-copied-flash {
            font-size: var(--text-label);
            color: var(--success-text);
            display: none;
            align-items: center;
            gap: 4px;
        }
        .capstone-copied-flash.show { display: inline-flex; }

        /* ── Capstone card labels (10A / 10B / 10C) ── */
        .capstone-card-label {
            font-size: var(--text-micro);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.09em;
            color: var(--jade-text);
            margin-bottom: 4px;
        }
        .capstone-compare-btn {
            display: none;
            align-items: center;
            gap: 6px;
            background: var(--bg-raised);
            border: 1px solid var(--jade);
            color: var(--jade-text);
            border-radius: var(--radius-full);
            padding: 8px 16px;
            font-size: var(--text-ui);
            font-weight: 600;
            font-family: var(--font-body);
            cursor: pointer;
            transition: background var(--transition-fast), box-shadow var(--transition-fast);
            min-height: 36px;
        }
        .capstone-compare-btn:hover { background: var(--jade-glow); box-shadow: 0 0 0 2px var(--jade-glow); }
        .capstone-compare-btn:disabled { opacity: 0.5; cursor: not-allowed; }

        /* ── 10B Coach Perspective panel ── */
        .capstone-10b-panel {
            background: var(--ai-bg);
            border: 1px solid var(--border);
            border-left: 3px solid var(--metal-mid);
            border-radius: var(--radius-md);
            padding: 16px;
            margin: 8px 0 4px;
            font-size: var(--text-body);
        }
        .capstone-10b-panel .capstone-card-label { color: var(--text-muted); }
        .capstone-10b-panel .capstone-panel-title { color: var(--metal-hi); }
        .capstone-pre-note {
            background: var(--amber-glow);
            border-left: 2px solid var(--amber);
            border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
            padding: 9px 13px;
            font-size: var(--text-ui);
            color: var(--text-sub);
            line-height: 1.55;
            margin-bottom: 14px;
        }
        .capstone-loading {
            display: flex; align-items: center; gap: 8px;
            padding: 10px 0;
            color: var(--text-muted);
            font-size: var(--text-ui);
        }
        .capstone-loading-dots span {
            display: inline-block; width: 5px; height: 5px;
            background: var(--metal-mid); border-radius: 50%;
            animation: capstoneDot 1.2s infinite;
            margin-right: 3px;
        }
        .capstone-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
        .capstone-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
        @keyframes capstoneDot {
            0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
            40% { transform: scale(1); opacity: 1; }
        }
        .coach-rubric-row {
            display: grid;
            grid-template-columns: 1fr;
            gap: 4px;
            padding: 9px 11px;
            background: var(--bg-panel);
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            margin-bottom: 7px;
        }
        .coach-rubric-dim {
            font-weight: 700;
            font-size: var(--text-note);
            color: var(--text-sub);
        }
        .coach-rubric-rating-chip {
            display: inline-flex;
            align-items: center;
            padding: 2px 9px;
            font-size: var(--text-caption);
            font-weight: 600;
            background: var(--bg-surface);
            border: 1px solid var(--border-mid);
            border-radius: var(--radius-full);
            color: var(--text-sub);
            margin: 2px 0;
        }
        .coach-rubric-obs {
            font-size: var(--text-ui);
            color: var(--text-primary);
            line-height: 1.45;
        }
        .coach-rubric-sugg {
            font-size: var(--text-note);
            color: var(--text-sub);
            font-style: italic;
            line-height: 1.4;
            padding-top: 2px;
        }
        .capstone-limitation-box {
            margin: 12px 0 10px;
            background: var(--amber-glow);
            border: 1px solid var(--amber);
            border-radius: var(--radius-sm);
            padding: 9px 13px;
            font-size: var(--text-note);
            color: var(--text-sub);
            line-height: 1.5;
        }
        .capstone-limitation-label {
            font-weight: 700; font-size: var(--text-micro); text-transform: uppercase;
            letter-spacing: 0.07em; color: var(--amber); margin-bottom: 4px;
        }
        .capstone-respond-btn {
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            color: var(--text-sub);
            border-radius: var(--radius-full);
            padding: 8px 16px;
            font-size: var(--text-ui);
            font-weight: 600;
            font-family: var(--font-body);
            cursor: pointer;
            transition: background var(--transition-fast), border-color var(--transition-fast);
            min-height: 36px;
        }
        .capstone-respond-btn:hover { background: var(--bg-surface); border-color: var(--jade); color: var(--jade-text); }

        /* ── 10C My Response panel ── */
        .capstone-10c-panel {
            background: var(--bg-panel);
            border: 1px solid var(--jade);
            border-left: 3px solid var(--jade);
            border-radius: var(--radius-md);
            padding: 16px;
            margin: 8px 0 4px;
            font-size: var(--text-body);
        }
        .capstone-10c-panel .capstone-card-label { color: var(--jade-text); }
        .capstone-final-btn {
            background: var(--grad-success);
            color: #fff;
            border: none;
            border-radius: var(--radius-full);
            padding: 9px 20px;
            font-size: var(--text-body);
            font-weight: 700;
            font-family: var(--font-body);
            cursor: pointer;
            transition: opacity var(--transition-fast);
            min-height: 38px;
        }
        .capstone-final-btn:hover { opacity: 0.88; }
        .capstone-final-done {
            display: none;
            background: var(--jade-glow);
            border: 1px solid var(--jade);
            border-radius: var(--radius-md);
            padding: 12px 16px;
            font-size: var(--text-body);
            color: var(--text-sub);
            line-height: 1.55;
            margin-top: 12px;
        }
        .capstone-final-done.on { display: block; }
        .capstone-final-done-title {
            font-weight: 700; font-family: var(--font-display);
            font-size: var(--text-subtitle); color: var(--jade-text); margin-bottom: 6px;
        }

        /* ── Focus Spotlight System ── */
        /* Dim the entire opposite panel */
        body.spotlight-coach .draft-panel,
        body.spotlight-editor .chat-panel {
            opacity: 0.10;
            pointer-events: none;
            transition: opacity 220ms ease;
        }
        /* During coach spotlight: dim individual chat children — but only when a single
           message is targeted. When #chatMessages itself is the target (whole-window mode)
           children are left at full opacity so the entire window glows together. */
        body.spotlight-coach #chatMessages:not(.spotlight-target) > *:not(.spotlight-target) {
            opacity: 0.08;
            pointer-events: none;
            transition: opacity 220ms ease;
        }
        /* During coach spotlight: dim chat panel chrome (header, input row, etc.) */
        body.spotlight-coach .chat-panel > *:not(#chatMessages):not(#fiveQStrip) {
            opacity: 0.08;
            pointer-events: none;
            transition: opacity 220ms ease;
        }
        /* During editor spotlight: dim everything in draft panel except textarea wrap */
        body.spotlight-editor .draft-panel > *:not(.draft-textarea-wrap) {
            opacity: 0.08;
            pointer-events: none;
            transition: opacity 220ms ease;
        }
        /* Keep action bar buttons (Report, Focus, Save) clickable during any spotlight */
        body.spotlight-coach .draft-action-bar,
        body.spotlight-editor .draft-action-bar {
            pointer-events: all;
        }
        /* Patch 7: spotlight takes precedence over draft focus mode dimming.
           draft-focus-active fades .chat-panel to 0.45 — that stacking context
           buries the spotlight glow and makes it only visible on hover. Override. */
        body.draft-focus-active.spotlight-coach .chat-panel {
            opacity: 1;
        }
        /* The spotlighted element gets a warm glow */
        .spotlight-target {
            border-radius: var(--radius-md);
            box-shadow:
                0 0 0 3px rgba(184, 92, 26, 0.60),
                0 0 0 8px rgba(184, 92, 26, 0.14),
                0 16px 48px rgba(42, 33, 28, 0.28);
            transition: box-shadow 220ms ease;
        }
        .spotlight-label {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin-top: 10px;
            padding: 0.38rem 0.75rem;
            border-radius: var(--radius-full);
            background: var(--bg-raised);
            border: 1px solid var(--border-mid);
            font-family: var(--font-body);
            font-size: var(--text-ui);
            font-weight: 600;
            box-shadow: var(--shadow-sm);
            pointer-events: all;
        }
        .spotlight-label-text { color: var(--text-sub); }
        .spotlight-label-btn {
            background: var(--grad-amber);
            color: #fff;
            border: none;
            border-radius: var(--radius-full);
            padding: 0.22rem 0.65rem;
            font-size: var(--text-label);
            font-weight: 700;
            font-family: var(--font-body);
            cursor: pointer;
            flex-shrink: 0;
            transition: opacity var(--transition-fast);
        }
        .spotlight-label-btn:hover { opacity: 0.85; }
        .spotlight-label-btn:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .spotlight-opt-out {
            position: fixed;
            bottom: 18px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 500;
            background: var(--bg-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            padding: 0.28rem 1.1rem;
            font-size: var(--text-label);
            color: var(--text-muted);
            cursor: pointer;
            font-family: var(--font-body);
            transition: color var(--transition-fast);
        }
        .spotlight-opt-out:hover { color: var(--text-primary); }
        .spotlight-opt-out:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        @media (prefers-reduced-motion: reduce) {
            .spotlight-target,
            body.spotlight-coach .draft-panel, body.spotlight-coach #chatMessages:not(.spotlight-target) > *,
            body.spotlight-coach .chat-panel > *,
            body.spotlight-editor .chat-panel, body.spotlight-editor .draft-panel > * {
                transition: none; animation: none;
            }
        }

        /* ── Post-onboarding chat focus ── */
        body.post-onboarding-focus .draft-panel,
        body.post-onboarding-focus .journey-wrap,
        body.post-onboarding-focus .app-header,
        body.post-onboarding-focus .current-task-bar {
            opacity: 0.25;
            pointer-events: none;
            transition: opacity 0.5s ease;
        }
        #chatMessages.post-onboarding-chat {
            box-shadow:
                0 0 0 2px rgba(184, 92, 26, 0.45),
                0 0 0 8px rgba(184, 92, 26, 0.10),
                0 8px 32px rgba(42, 33, 28, 0.18);
            border-radius: var(--radius-md);
            transition: box-shadow 0.5s ease;
        }
        @media (prefers-reduced-motion: reduce) {
            body.post-onboarding-focus .draft-panel,
            body.post-onboarding-focus .journey-wrap,
            body.post-onboarding-focus .app-header,
            body.post-onboarding-focus .current-task-bar,
            #chatMessages.post-onboarding-chat {
                transition: none;
            }
        }

        /* ── Post-onboarding chat focus — Patch 6: smooth exit ── */
        body.post-onboarding-exiting .draft-panel,
        body.post-onboarding-exiting .journey-wrap,
        body.post-onboarding-exiting .app-header,
        body.post-onboarding-exiting .current-task-bar {
            opacity: 1;
            transition: opacity 0.5s ease;
        }
        #chatMessages.post-onboarding-chat-exiting {
            box-shadow: none;
            transition: box-shadow 0.5s ease;
        }
        @media (prefers-reduced-motion: reduce) {
            body.post-onboarding-exiting .draft-panel,
            body.post-onboarding-exiting .journey-wrap,
            body.post-onboarding-exiting .app-header,
            body.post-onboarding-exiting .current-task-bar,
            #chatMessages.post-onboarding-chat-exiting {
                transition: none;
            }
        }

        /* ── Draft Focus Mode (persistent gentle writing state) ── */
        /* Textarea wrap: soft jade ring signals "write here" without relying on color alone */
        body.draft-focus-active .draft-textarea-wrap {
            outline: var(--focus-ring-alt);
            outline-offset: 3px;
            border-radius: var(--radius-sm);
            box-shadow: 0 0 0 6px rgba(49,138,90,0.09), 0 8px 32px rgba(42,33,28,0.10);
            transition: outline-color 260ms ease, box-shadow 260ms ease;
        }
        /* Panel header and toolbar gently recede — hover restores them */
        body.draft-focus-active .draft-panel .panel-header {
            opacity: 0.62;
            transition: opacity 260ms ease;
        }
        body.draft-focus-active .draft-panel .panel-header:hover {
            opacity: 1;
        }
        body.draft-focus-active .draft-panel .edit-toolbar {
            opacity: 0.5;
            transition: opacity 260ms ease;
        }
        body.draft-focus-active .draft-panel .edit-toolbar:hover,
        body.draft-focus-active .draft-panel .edit-toolbar:focus-within {
            opacity: 1;
        }
        /* Chat panel fades to secondary — hover/focus-within restores readability */
        body.draft-focus-active .chat-panel {
            opacity: 0.45;
            transition: opacity 260ms ease;
        }
        body.draft-focus-active .chat-panel:hover,
        body.draft-focus-active .chat-panel:focus-within {
            opacity: 1;
            transition: opacity 180ms ease;
        }
        /* Focus toggle button label shifts to green when in focus mode */
        body.draft-focus-active #focusToggle .focus-toggle-label {
            color: var(--jade-text);
        }
        /* On mobile (stacked layout) don't dim the chat panel — it's below, not competing */
        @media (max-width: 768px) {
            body.draft-focus-active .chat-panel {
                opacity: 1;
            }
        }
        @media (prefers-reduced-motion: reduce) {
            body.draft-focus-active .draft-textarea-wrap,
            body.draft-focus-active .draft-panel .panel-header,
            body.draft-focus-active .draft-panel .edit-toolbar,
            body.draft-focus-active .chat-panel {
                transition: none;
            }
        }

        /* ═══ ADHD Nav B5: focus states quiet the journey rail too ═══
           The map stays visible for orientation but recedes while the student
           is writing (draft focus) or simplified the screen (focus mode).
           Hover or keyboard focus restores it instantly — nothing is hidden,
           disabled, or removed; Help, Save/Export, and "Estoy atascado" keep
           their normal presentation and remain operable throughout. */
        body.draft-focus-active .journey-wrap,
        body:has(.workspace.focus-mode) .journey-wrap {
            opacity: 0.55;
            transition: opacity 260ms ease;
        }
        body.draft-focus-active .journey-wrap:hover,
        body.draft-focus-active .journey-wrap:focus-within,
        body:has(.workspace.focus-mode) .journey-wrap:hover,
        body:has(.workspace.focus-mode) .journey-wrap:focus-within {
            opacity: 1;
        }
        @media (prefers-reduced-motion: reduce) {
            body.draft-focus-active .journey-wrap,
            body:has(.workspace.focus-mode) .journey-wrap { transition: none; }
        }

        /* ═══ ADHD Nav B3: shared "orientation layer" tag ═══
           The Five Questions strip, in-chat eval card, and Voice Vault are
           TRAINING/ORIENTATION supports, not writing steps. One shared quiet
           micro-tag ("Apoyo · Support") marks them as the same secondary layer
           across all pathways so they stop competing with the current task.
           Display-only; no content removed; language-mode-aware via show-es/en. */
        .orient-tag {
            margin-left: auto;
            flex-shrink: 0;
            font-size: var(--text-micro); font-weight: 700;
            color: var(--text-muted);
            letter-spacing: 0.06em; text-transform: uppercase;
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            padding: 1px 7px;
            opacity: 0.9;
        }
        /* ≤480px: the surfaces' existing borders carry the separation; the tag
           would crowd the summary rows */
        @media (max-width: 480px) { .orient-tag { display: none; } }

        /* ── Five Questions Reference Strip ── */
        .five-q-strip {
            border-bottom: 1px solid var(--border);
            background: var(--bg-surface);
            flex-shrink: 0;
        }
        .five-q-strip.hidden { display: none; }
        .five-q-details { margin: 0; }
        .five-q-details > summary {
            list-style: none;
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 7px 14px;
            cursor: pointer;
            font-size: var(--text-note);
            font-weight: 600;
            color: var(--text-primary);
            letter-spacing: 0.01em;
            font-family: var(--font-body);
            user-select: none;
        }
        .five-q-details > summary::-webkit-details-marker { display: none; }
        .five-q-details > summary::marker { display: none; }
        .five-q-details > summary:hover { color: var(--amber); }
        .five-q-details > summary:focus-visible { outline: var(--focus-ring); outline-offset: -2px; }
        .five-q-sum-arrow {
            margin-left: auto;
            font-size: var(--text-micro);
            color: var(--text-muted);
            transition: transform var(--transition-fast);
        }
        .five-q-details[open] > summary .five-q-sum-arrow { transform: rotate(180deg); }
        .five-q-hint {
            font-weight: 400;
            font-size: var(--text-caption);
            color: var(--text-muted);
        }
        .five-q-body {
            padding: 6px 14px 10px;
            border-top: 1px solid var(--border);
            max-height: 280px;
            overflow-y: auto;
        }
        .five-q-list {
            list-style: none;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            gap: 1px;
        }
        .five-q-list > li { margin: 0; }
        .five-q-item { margin: 0; }
        .five-q-item > summary {
            list-style: none;
            display: flex;
            align-items: baseline;
            gap: 7px;
            padding: 5px 4px 5px 0;
            cursor: pointer;
            font-size: var(--text-note);
            color: var(--text-primary);
            font-family: var(--font-body);
            border-radius: var(--radius-sm);
            line-height: 1.4;
        }
        .five-q-item > summary::-webkit-details-marker { display: none; }
        .five-q-item > summary::marker { display: none; }
        .five-q-item > summary:hover { color: var(--amber); }
        .five-q-item > summary:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
        .five-q-num {
            font-size: var(--text-micro);
            font-weight: 700;
            color: var(--amber);
            width: 16px;
            flex-shrink: 0;
            font-family: var(--font-mono);
            padding-top: 1px;
        }
        .five-q-q { flex: 1; }
        .five-q-expand {
            padding: 5px 6px 8px 23px;
            font-size: var(--text-label);
            color: var(--text-sub);
            line-height: 1.55;
        }
        .five-q-expand em {
            display: block;
            margin-top: 3px;
            color: var(--text-muted);
            font-style: italic;
        }
        .five-q-example {
            display: block;
            margin-top: 6px;
            padding: 5px 8px;
            background: var(--bg-raised);
            border: 1px solid var(--border);
            border-left: 3px solid var(--amber);
            border-radius: var(--radius-sm);
            font-size: var(--text-caption);
            color: var(--text-sub);
            line-height: 1.5;
        }
        /* ADHD Nav B4: Five Questions in Help — scannable chip + one-line question
           (same AI-literacy content, list presentation instead of a text wall) */
        .help-fiveq-list {
            list-style: none; margin: 8px 0; padding: 0;
            display: flex; flex-direction: column; gap: 6px;
        }
        .help-fiveq-list li {
            font-size: var(--text-label); color: var(--text-sub); line-height: 1.5;
        }
        .fiveq-chip {
            display: inline-block;
            font-size: var(--text-micro); font-weight: 700;
            color: var(--amber-text);
            background: var(--bg-raised);
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            padding: 1px 8px;
            margin-right: 6px;
            letter-spacing: 0.03em;
        }

        /* Stage-level eval trigger — injected at bottom of five-q-body (Stage 7+) */
        .five-q-eval-action {
            display: block;
            width: 100%;
            margin-top: 10px;
            padding: 7px 12px;
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-sm);
            color: var(--amber-text);
            font-family: var(--font-body);
            font-size: var(--text-note);
            font-weight: 600;
            cursor: pointer;
            text-align: left;
            transition: border-color var(--transition-fast), background var(--transition-fast);
        }
        .five-q-eval-action:hover { border-color: var(--amber); background: var(--amber-glow); }
        .five-q-eval-action:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

        /* ── Lab progressive-disclosure expander ── */
        .lab-expander {
            margin: 8px 0 4px;
            border: 1px solid var(--border);
            border-radius: var(--radius-sm);
            background: var(--bg-surface);
            overflow: hidden;
        }
        .lab-expander > summary {
            list-style: none;
            padding: 7px 12px;
            cursor: pointer;
            font-size: var(--text-ui);
            font-weight: 600;
            color: var(--text-sub);
            display: flex;
            align-items: center;
            gap: 6px;
            font-family: var(--font-body);
        }
        .lab-expander > summary::-webkit-details-marker { display: none; }
        .lab-expander > summary::marker { display: none; }
        .lab-expander > summary:hover { color: var(--text-primary); }
        .lab-expander > summary:focus-visible { outline: var(--focus-ring); outline-offset: -2px; }
        .lab-exp-arrow {
            font-size: var(--text-micro);
            margin-left: auto;
            color: var(--text-muted);
            transition: transform var(--transition-fast);
        }
        .lab-expander[open] > summary .lab-exp-arrow { transform: rotate(180deg); }
        .lab-expander-body {
            padding: 4px 12px 10px;
            font-size: var(--text-ui);
            color: var(--text-sub);
            line-height: 1.6;
            border-top: 1px solid var(--border);
        }
        .lab-expander-body p { margin: 6px 0 0; }

        /* ── Language preference system ── */
        /* ES mode: hide English-only elements */
        html[data-lang="es"] .show-en,
        html[data-lang="es"] .lang-sep { display: none !important; }
        html[data-lang="es"] .ctb-en,
        html[data-lang="es"] .ctb-sep { display: none !important; }

        /* EN mode: hide Spanish-only elements */
        html[data-lang="en"] .show-es,
        html[data-lang="en"] .lang-sep { display: none !important; }
        html[data-lang="en"] .ctb-es,
        html[data-lang="en"] .ctb-sep { display: none !important; }
        html[data-lang="en"] .ctb-en {
            color: var(--text-primary) !important;
            font-size: inherit !important;
            font-weight: 500 !important;
        }
        html[data-lang="en"] .label-es { display: none !important; }
        html[data-lang="en"] .label-en {
            color: var(--text-primary) !important;
            font-size: var(--text-caption) !important;
            font-weight: 600 !important;
            margin-top: 0 !important;
        }

        /* BOTH mode: override mobile hide rule */
        @media (max-width: 640px) {
            html[data-lang="both"] .ctb-sep,
            html[data-lang="both"] .ctb-en { display: inline !important; }
        }

        /* ═══ ADHD Nav B7: bilingual prose density (bilingual mode only) ═══
           Long dual-language guidance prose no longer interleaves on one line:
           Spanish leads, English follows as a quieter twin on its own line
           (same grammar the Five-Questions strip already uses). Both languages
           stay complete and visible; ES-only / EN-only modes are untouched.
           Privacy and Google Gemini disclosures are deliberately NOT quieted —
           this applies only to help/export/draft guidance prose. */
        html[data-lang="both"] .help-section-body > .show-en,
        html[data-lang="both"] .packet-note > .show-en,
        html[data-lang="both"] .report-export-hint > .show-en,
        html[data-lang="both"] .draft-footer-note > .show-en {
            display: block;
            margin-top: 3px;
            font-size: 0.95em;
        }
        /* Only the non-privacy export/draft notes also soften ink; Help bodies
           keep their full contrast (they include mode/privacy guidance). */
        html[data-lang="both"] .packet-note > .show-en,
        html[data-lang="both"] .report-export-hint > .show-en,
        html[data-lang="both"] .draft-footer-note > .show-en {
            color: var(--text-muted);
        }
        html[data-lang="both"] .help-section-body > .lang-sep,
        html[data-lang="both"] .packet-note > .lang-sep,
        html[data-lang="both"] .report-export-hint > .lang-sep { display: none; }

        /* ── Language switcher ── */
        .lang-switcher {
            display: flex;
            align-items: center;
            gap: 2px;
            background: var(--bg-surface);
            border: 1px solid var(--border);
            border-radius: var(--radius-full);
            padding: 3px;
            flex-shrink: 0;
        }
        .lang-btn {
            background: transparent;
            border: none;
            border-radius: var(--radius-full);
            color: var(--text-muted);
            cursor: pointer;
            font-family: var(--font-body);
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            line-height: 1;
            padding: 4px 8px;
            transition: background var(--transition-fast), color var(--transition-fast);
            white-space: nowrap;
        }
        @media (prefers-reduced-motion: reduce) {
            .lang-btn { transition: none; }
        }
        .lang-btn:hover { color: var(--text-primary); background: var(--bg-raised); }
        .lang-btn[aria-pressed="true"] {
            background: var(--amber);
            color: #fff;
        }
        .lang-btn:focus-visible {
            outline: var(--focus-ring);
            outline-offset: 1px;
        }
        @media (max-width: 640px) {
            .lang-switcher { gap: 1px; padding: 2px; }
            .lang-btn { padding: 3px 6px; font-size: 0.62rem; }
        }

        /* Mobile-only compact language selector — hidden by default, shown at ≤480px */
        .lang-select-mobile { display: none; }
        /* Mobile short-form brand title — hidden by default, swapped in at ≤480px */
        .header-text h1 .h1-short { display: none; }

        /* ── Coach Mode Toggle ── */
        .coach-mode-toggle {
            display: flex;
            gap: 2px;
            background: var(--bg-raised);
            border: 1px solid var(--border-hi);
            border-radius: var(--radius-full);
            padding: 2px;
            flex-shrink: 0;
        }
        .coach-mode-btn {
            padding: 4px 10px;
            border: 0;
            border-radius: var(--radius-full);
            background: transparent;
            font-family: var(--font-body);
            font-size: var(--text-micro);
            font-weight: 600;
            color: var(--text-sub);
            cursor: pointer;
            transition: all var(--transition-fast);
            white-space: nowrap;
            line-height: 1.4;
        }
        .coach-mode-btn.active {
            background: var(--amber);
            color: #fff;
            box-shadow: var(--shadow-sm);
        }
        .coach-mode-btn:not(.active):hover { color: var(--text-primary); }

        /* ── Dify Embed Panel ── */
        .dify-embed-panel {
            display: none;
            flex-direction: column;
            flex: 1;
            min-height: 0;
            overflow: hidden;
        }
        .dify-embed-panel.active { display: flex; }

        .dify-test-notice {
            background: #fff8e6;
            border-bottom: 1px solid #e8c97a;
            font-size: var(--text-note); line-height: 1.5;
            color: #7a4f10;
            flex-shrink: 0;
        }
        .dify-test-notice-summary {
            display: flex; gap: 8px; align-items: center;
            padding: 7px 16px;
            cursor: pointer;
            list-style: none;
            font-weight: 600;
            user-select: none;
        }
        .dify-test-notice-summary::-webkit-details-marker { display: none; }
        .dify-test-notice-summary::after {
            content: '▾';
            margin-left: auto;
            font-size: var(--text-caption);
            opacity: 0.6;
            transition: transform 0.2s;
        }
        .dify-test-notice:not([open]) .dify-test-notice-summary::after { transform: rotate(-90deg); }
        .dify-test-notice-body {
            padding: 0 16px 8px 36px;
            font-weight: 400;
        }

        .dify-iframe-wrap {
            flex: 1;
            position: relative;
            min-height: 360px;
            overflow: hidden;
        }
        .dify-fallback {
            padding: 24px 20px;
            font-size: var(--text-emph); line-height: 1.65;
            color: var(--text-sub);
            background: var(--bg-raised);
            border-radius: var(--radius-md);
            margin: 12px;
            border: 1px solid var(--border-mid);
        }

        /* ── Copilot Studio Embed Panel ── */
        .copilot-embed-panel {
            display: none;
            flex-direction: column;
            flex: 1;
            min-height: 0;
            overflow: hidden;
        }
        .copilot-embed-panel.active { display: flex; }

        .copilot-stage-hint {
            display: flex; gap: 8px; align-items: flex-start;
            padding: 9px 16px;
            background: var(--bg-surface);
            border-bottom: 1px solid var(--border-mid);
            font-size: var(--text-ui); line-height: 1.5;
            color: var(--text-sub);
            flex-shrink: 0;
        }
        .copilot-stage-hint em { color: var(--text-primary); font-style: italic; }

        .copilot-status-bar {
            display: flex; align-items: center; gap: 7px;
            padding: 5px 16px;
            background: color-mix(in srgb, var(--jade) 8%, var(--bg-surface));
            border-bottom: 1px solid var(--border-mid);
            font-size: var(--text-label); font-weight: 600;
            color: var(--jade-text);
            flex-shrink: 0;
        }
        .copilot-status-dot {
            width: 7px; height: 7px;
            border-radius: 50%;
            background: var(--jade);
            flex-shrink: 0;
            animation: pulseDot 2.5s ease-in-out infinite;
        }
        @keyframes pulseDot {
            0%, 100% { opacity: 1; }
            50%       { opacity: 0.4; }
        }

        .copilot-iframe-wrap {
            flex: 1;
            position: relative;
            min-height: 360px;
            overflow: hidden;
            border-radius: 0 0 var(--radius-md) var(--radius-md);
        }
        .copilot-iframe-wrap iframe {
            position: absolute; inset: 0;
            width: 100%; height: 100%;
            border: 0;
            display: block;
        }
        .copilot-fallback {
            padding: 24px 20px;
            font-size: var(--text-emph); line-height: 1.65;
            color: var(--text-sub);
            background: var(--bg-raised);
            border-radius: var(--radius-md);
            margin: 12px;
            border: 1px solid var(--border-mid);
        }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Mobile Additions  (2026-05-08)
   Appended last; overrides earlier declarations by cascade.
   Works alongside the existing @media blocks above.
   ═══════════════════════════════════════════════════════════ */

/* ── Mobile tabs: visible only at ≤480px ── */
.mobile-tabs { display: none; }

/* ── Scrolling hint marquee (activated by JS on mobile when text overflows) ── */
@keyframes ctb-marquee {
    0%, 12%  { transform: translateX(0); }
    75%, 87% { transform: translateX(var(--ctb-scroll, -80px)); }
    100%     { transform: translateX(0); }
}
/* Container stays in place — only the inner span moves */
.ctb-instruction.ctb-marquee { text-overflow: clip; }
.ctb-marquee-inner {
    display: inline-block;
    white-space: nowrap;
    padding-right: 20px;
    animation: ctb-marquee 9s ease-in-out 2;
}
/* After 2 cycles: show replay cursor so student knows to tap */
.ctb-instruction.ctb-marquee.ctb-marquee-done { cursor: pointer; }
.ctb-instruction.ctb-marquee:hover .ctb-marquee-inner,
.ctb-instruction.ctb-marquee:focus-within .ctb-marquee-inner {
    animation-play-state: paused;
}

/* ── Prevent embedded/media content from exceeding viewport ── */
img, video, embed, object { max-width: 100%; height: auto; }

/* ── iOS: compensate for collapsible browser chrome ── */
@supports (-webkit-touch-callout: none) {
    html { height: -webkit-fill-available; }
    body { min-height: -webkit-fill-available; }
}

/* ═══════════════════════════════════════════════════════════
   ≤ 768px — phones and small tablets
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Block any remaining horizontal overflow */
    html { overflow-x: hidden; }
    body { overflow-x: hidden; }

    /* Better workspace height split — draft gets more breathing room */
    .workspace { grid-template-rows: 58% 42%; }
    .workspace.focus-mode { grid-template-rows: 100% 0fr; }

    /* ── Tap targets: minimum 44 × 44 px ── */
    .save-btn         { min-height: 44px; padding: 11px 10px; }
    .continue-btn     { min-height: 44px; padding: 11px 10px; }
    .footer-btn       { min-height: 44px; padding: 10px 12px; }
    .send-btn         { width: 44px; height: 44px; }
    .theme-toggle     { width: 44px; height: 44px; }
    .reset-btn        { width: 44px; height: 44px; }
    .help-btn         { width: 44px; height: 44px; }
    .stuck-btn        { min-height: 44px; padding: 10px 16px; }
    .capstone-rating-btn { min-height: 40px; padding: 8px 12px; }

    /* ── Chat input: 16 px minimum prevents iOS auto-zoom on focus ── */
    .chat-input { font-size: 1rem; }

    /* ── Modals: reduce padding, raise max-height cap ── */
    .pn-modal-bg   { padding: 16px 12px; }
    .pn-modal-card { min-height: 0; max-height: 92svh; }

    .report-bg   { padding: 16px 12px; }
    .report-card { max-height: 92svh; }

    .stage-preview-bg   { padding: 16px 12px; }
    .stage-preview-card { max-height: 90svh; overflow-y: auto; }

    .modal-bg    { padding: 16px; }
    .modal-card  { width: min(92vw, 440px); }

    .confirm-bg   { padding: 16px; }
    .confirm-card { width: min(92vw, 420px); }

    /* ── Report action buttons: 2-col grid on phones ── */
    .report-actions { flex-wrap: wrap; gap: 8px; padding: 12px 20px 16px; }
    .report-action-btn {
        min-height: 44px;
        flex: 1 1 calc(50% - 4px);
        white-space: normal;
        text-align: center;
    }
    /* Odd last button spans full width */
    .report-action-btn:nth-last-child(odd):last-child { flex-basis: 100%; }

    /* ── Instructor report: let action row wrap ── */
    .instr-action-row { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════
   ≤ 480px — phones: tab interface + hide journey map
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    /* Journey map hidden — stage info visible in current-task-bar + mobile stage nav */
    .journey-wrap { display: none; }
    /* Current-task instruction: wrap to two lines instead of clipping mid-word;
       marquee scroll is neutralized at this width (Visual Polish Q5). */
    .ctb-instruction, .ctb-instruction.ctb-marquee {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.3;
    }
    .ctb-instruction .ctb-marquee-inner {
        display: inline;
        white-space: normal;
        padding-right: 0;
        animation: none;
    }
    /* Draft cue: on phones the placeholder fills the whole textarea, so no floating
       position can avoid text. Render the cue as a static row BELOW the textarea
       instead — zero overlap possible; :placeholder-shown hiding still applies
       (Visual Polish Q1, mobile treatment). */
    .draft-start-cue {
        position: static;
        transform: none;
        align-self: center;
        margin: 6px auto 2px;
    }
    /* Banner simplified: subtitle + stage text hidden — stage shown in current-task-bar */
    #headerSub { display: none; }
    /* M3 header decrowding: theme & reset become quiet ghost icons (same 44px
       targets, still visible) while Help and Problema keep their bordered
       affordance — pilot-critical controls stay visually distinct. Tighter rhythm. */
    .app-header { padding: 6px 8px; gap: 4px; }
    .theme-toggle, .reset-btn { background: transparent; border-color: transparent; }
    /* Pathway chip stays (only sub-line on phones) — compacted to fit the tight header */
    .pathway-chip { font-size: 0.58rem; margin-top: 2px; padding: 0 7px; }
    /* Title: single line; ellipsis is a safety net only — intentional short form used instead */
    .header-text h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    /* Swap full title for intentional "Tu Pana" short form on mobile */
    .header-text h1 .h1-full { display: none; }
    .header-text h1 .h1-short { display: inline; }
    /* Compact lang selector replaces 3-button group on mobile (~120px → ~45px) */
    #langSwitcher { display: none; }
    .lang-select-mobile {
        display: block;
        -webkit-appearance: none;
        appearance: none;
        background: var(--bg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 7px center / 8px 5px;
        border: 1px solid var(--border);
        border-radius: var(--radius-full);
        color: var(--text-primary);
        cursor: pointer;
        font-family: var(--font-body);
        font-size: var(--text-micro);
        font-weight: 700;
        letter-spacing: 0.04em;
        padding: 5px 22px 5px 10px;
        flex-shrink: 0;
        min-height: 44px;
        min-width: 42px;
        max-width: 52px;
    }
    .lang-select-mobile:focus-visible {
        outline: var(--focus-ring);
        outline-offset: 2px;
    }

    /* Mobile stage navigator replaces journey map on phones */
    .mobile-stage-nav {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 14px;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-mid);
        flex-shrink: 0;
    }
    .mobile-stage-label {
        font-size: var(--text-note);
        font-weight: 600;
        color: var(--text-sub);
        white-space: nowrap;
        flex-shrink: 0;
    }
    .mobile-stage-select {
        flex: 1;
        min-width: 0;
        font-family: var(--font-body);
        font-size: 1rem;
        color: var(--text-main);
        background: var(--bg-raised);
        border: 1px solid var(--border-mid);
        border-radius: var(--radius-sm);
        padding: 6px 8px;
        min-height: 44px;
        cursor: pointer;
    }

    /* Show "de 5 / of 5" so students know overall progress without the journey map */
    .ctb-of-total {
        display: inline;
        color: var(--text-muted);
        font-weight: 400;
        font-size: 0.65rem;
    }

    /* Toolkit button: hide CTB version (mobile uses the mobile-stage-nav button) */
    .ctb-toolkit-col { display: none; }
    .mobile-toolkit-btn {
        flex-shrink: 0;
        font-family: var(--font-body);
        font-size: var(--text-ui); font-weight: 600;
        color: var(--jade-text);
        background: none;
        border: 1px solid var(--border-mid);
        border-radius: var(--radius-full);
        padding: 5px 12px;
        cursor: pointer; min-height: 44px;
        transition: border-color var(--transition-fast);
    }
    .mobile-toolkit-btn:hover { border-color: var(--jade); }
    .mobile-toolkit-btn:focus-visible { outline: var(--focus-ring-alt); outline-offset: 2px; }

    /* Slim jade progress strip at bottom of current-task-bar (driven by --ctb-progress JS var) */
    .current-task-bar {
        position: relative;
        overflow: visible;
    }
    .current-task-bar::after {
        content: '';
        position: absolute;
        bottom: 0; left: 0;
        height: 2px;
        width: var(--ctb-progress, 10%);
        background: var(--jade);
        border-radius: 0 2px 2px 0;
        transition: width 0.4s ease;
        pointer-events: none;
    }

    /* Mobile tab bar — positioned after <main> in DOM, sits at bottom naturally */
    .mobile-tabs {
        display: flex;
        flex-shrink: 0;
        background: var(--bg-surface);
        border-top: 1px solid var(--border-mid);
        /* Extend into iOS home-indicator safe area */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .mobile-tab {
        flex: 1;
        position: relative;
        padding: 10px 8px;
        min-height: 44px;
        font-size: var(--text-emph);
        font-weight: 600;
        font-family: var(--font-body);
        background: none;
        border: none;
        border-top: 3px solid transparent;
        color: var(--text-sub);
        cursor: pointer;
        transition: color 0.15s, border-color 0.15s, background 0.15s;
    }
    .mobile-tab.mobile-tab-active {
        color: var(--amber);
        border-top-color: var(--amber);
        background: var(--amber-glow);
    }
    /* Notification dot when coach replies while student is in draft tab */
    .mobile-tab.has-notification::after {
        content: '';
        position: absolute;
        top: 8px;
        right: calc(50% - 22px);
        width: 8px; height: 8px;
        background: var(--amber);
        border-radius: 50%;
        border: 2px solid var(--bg-surface);
    }

    /* Workspace: single full-height panel at a time */
    .workspace {
        grid-template-columns: 1fr !important;
        grid-template-rows: 1fr !important;
    }
    .workspace .draft-panel { display: flex !important; flex-direction: column; }
    .workspace .chat-panel  { display: none  !important; }
    .workspace.mobile-panel-chat .draft-panel { display: none  !important; }
    /* Anchor the active panel to workspace bounds using position:absolute.
       Avoids the percentage-in-1fr-track height ambiguity that affects Opera iOS and
       other non-Safari WebKit builds when align-self:stretch does not propagate a
       definite height through the flex→grid chain.
       .workspace already has position:relative + overflow:hidden, so the absolute
       panel is clipped precisely to workspace bounds on every browser. */
    .workspace.mobile-panel-chat .chat-panel  {
        display: flex !important;
        flex-direction: column;
        min-height: 0;
        position: absolute;
        inset: 0;
    }

    /* Focus mode on mobile: just hide chat (same as draft tab) */
    .workspace.focus-mode { grid-template-rows: 1fr !important; }
    .workspace.focus-mode .focus-hint { display: none; }

    .draft-panel { border-right: none; border-bottom: none; }

    /* ── Report modal ── */
    .report-bg   { padding: 8px; align-items: flex-start; }
    .report-card { width: 100%; max-height: 98svh; border-radius: var(--radius-md); }
    .report-header { padding: 10px 14px 8px; }
    .report-title  { font-size: 1rem; }
    .report-sub    { display: none; }
    /* Body: tighter padding, flex column so we can reorder */
    .report-body   { padding: 10px 12px; gap: 10px; flex-direction: column; }
    /* Show the process note (textareas) FIRST on mobile */
    .report-note-box { order: -1; padding: 12px; }
    .report-note-box h4 { font-size: var(--text-emph); margin-bottom: 6px; }
    .report-note-box > p { font-size: var(--text-note); margin-bottom: 6px; }
    .report-pn-section { margin-bottom: 12px; }
    .report-pn-title   { font-size: var(--text-ui); padding-bottom: 4px; }
    .report-pn-text    { min-height: 70px; font-size: 1rem; padding: 8px 10px; }
    .report-section-body { max-height: 120px; font-size: var(--text-ui); padding: 10px 12px; }
    .report-section-header { padding: 8px 12px; font-size: var(--text-label); }
    /* Action buttons: compact 2-col grid */
    .report-actions { padding: 8px 12px 10px; gap: 6px; }
    .report-action-btn {
        min-height: 44px;
        padding: 6px 8px;
        font-size: var(--text-label);
        flex: 1 1 calc(50% - 3px);
    }
    .report-persistence-note { padding: 4px 12px 6px; }
    .report-persistence-summary { padding: 5px 0; }
    .report-persistence-body { padding: 4px 0 6px; }

    /* ── Chat header: strip it down on mobile ── */
    /* Avatar and full title are redundant — tab already reads "Tu Pana" */
    .chat-avatar    { display: none; }
    .chat-name      { display: none; }
    /* Coach-mode toggle: compact on mobile */
    .coach-mode-toggle { gap: 2px; }
    .coach-mode-btn    { padding: 3px 7px; font-size: var(--text-caption); }
    /* Compact header: status + tone + mode toggle in one tight row */
    .chat-header    { padding: 6px 12px; gap: 8px; min-height: 40px; }
    .chat-status    { font-size: var(--text-ui); }
    .tone-toggle    { padding: 4px 7px; font-size: var(--text-micro); }
    #toneToggleLabel .lang-sep,
    #toneToggleLabel .show-en { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   ≤ 430px — phones (iPhone 14 / Pixel 7 and below)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 430px) {
    /* ── Header ── */
    .app-header    { padding: 8px 12px; gap: 6px; }
    .header-logo   { width: 38px; height: 38px; }
    .header-logo.chat-avatar-anim { width: 44px !important; height: 35px !important; }
    .header-text   { min-width: 0; }
    .header-text h1 { font-size: 1rem; }

    /* ── Journey map ── */
    .journey-wrap   { padding: 6px 10px 8px; }
    .stage-circle   { width: 30px; height: 30px; font-size: 0.62rem; }
    .stage-node:not(:last-child)::after {
        top: 14px;
        left: calc(50% + 12px);
        width: calc(100% - 24px);
    }
    .stage-label    { font-size: 0.58rem; max-width: 52px; }

    /* ── Current task bar ── */
    .current-task-bar { min-height: 36px; }

    /* ── Edit toolbar: icon-only saves horizontal space ── */
    .etb-label    { display: none; }
    .etb-btn      { padding: 8px; min-height: 44px; }
    .edit-toolbar { padding: 4px 8px; }

    /* ── Draft panel ── */
    .panel-header    { padding: 10px 14px; }
    .draft-textarea  { padding: 14px 14px 28px; font-size: 1rem; line-height: 1.8; }
    .draft-footer    { padding: 5px 10px 8px; gap: 4px; }
    .draft-action-bar { gap: 6px; }

    /* ── Chat panel ── */
    .chat-header     { padding: 8px 12px; }
    .chat-stage-tag  { display: none; }
    .chat-messages   { padding: 10px 12px 6px; gap: 8px; }
    .msg             { max-width: 96%; }
    .chat-name       { font-size: var(--text-subtitle); }
    .chat-input-wrap { padding: 8px 12px 10px; }

    /* ── Capstone panel ── */
    .capstone-panel           { padding: 14px; }
    .capstone-rating-btn      { min-height: 38px; padding: 6px 10px; font-size: var(--text-caption); }
    .capstone-reflection-text { min-height: 88px; }

    /* ── Instructor report panel ── */
    .instr-field-input { font-size: 1rem; }       /* prevent iOS auto-zoom on focus */
    .instr-preview     { max-height: 55svh; }
    .instr-action-row  { flex-direction: column; }

    /* ── Five Questions eval modal ── */
    .eval-modal-bg   { align-items: flex-end; padding: 0; }
    .eval-modal-card {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 80svh;
        padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    }
    .eval-modal-choices { flex-direction: column; }
    .eval-modal-choice  { width: 100%; min-height: 44px; }

    /* ── Mi Toolkit — bottom sheet on mobile ── */
    @keyframes toolkitSlideUp {
        from { opacity: 0; transform: translateY(40px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .toolkit-modal-bg { align-items: flex-end; padding: 0; animation: none; }
    .toolkit-modal-card {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-width: 100%; width: 100%;
        max-height: 82svh;
        padding: 28px 18px calc(20px + env(safe-area-inset-bottom, 0px));
        animation: toolkitSlideUp 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .toolkit-modal-card::before {
        content: '';
        display: block;
        width: 36px; height: 4px;
        background: var(--border-mid);
        border-radius: 2px;
        margin: -12px auto 16px;
    }
    .toolkit-close { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
    .full-review-modal-card { max-height: 90svh; }
    .full-review-modal-card::before { margin-left: auto; margin-right: auto; }
    .full-review-modal-top { padding: 12px 16px 14px; }
    .full-review-modal-card > :not(.full-review-modal-top) {
        margin-left: 16px;
        margin-right: 16px;
    }
    .full-review-lens-grid { grid-template-columns: 1fr; }
    .full-review-lens { min-height: 70px; }
    .full-review-actions {
        flex-direction: column-reverse;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    .full-review-passage-btn,
    .full-review-submit { width: 100%; min-height: 48px; }

    /* ── Process note modal ── */
    .pn-modal-header  { padding: 14px 16px 12px; }
    .pn-modal-body    { padding: 14px 16px; }
    .pn-modal-actions { padding: 10px 16px 14px; flex-wrap: wrap; gap: 8px; }
    .pn-modal-btn     { min-height: 44px; flex: 1; min-width: 120px; }

    /* ── Stage preview modal ── */
    .stage-preview-card { padding: 18px 16px 22px; }

    /* ── Report modal ── */
    .report-header { padding: 14px 16px 12px; }

    /* ── Tu Conocimiento / El Laboratorio ── */
    .mani-header { padding: 16px 16px 12px; }
    .mani-footer { padding: 10px 16px 14px; }
    .lab-header  { padding: 14px 16px 12px; }
    .lab-footer  { padding: 10px 16px 14px; }

    /* ── Lab / Mani modal: pin footer by constraining card height and
          scrolling the body internally (fixes iOS fixed-overlay scroll bug) ── */
    .lab-bg, .mani-bg {
        padding: 8px;
        align-items: flex-start;
    }
    .lab-card, .mani-card {
        width: 100%;
        max-height: 96svh;
        height: 96svh;
        display: flex; flex-direction: column;
    }
    .lab-body, .mani-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ── Capstone modal: full-height scrollable on mobile ── */
    .capstone-bg {
        padding: 8px;
        align-items: flex-start;
    }
    .capstone-modal-card {
        width: 100%;
        max-height: 96svh;
        height: 96svh;
    }
    .capstone-modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── Passage Coach: contextual selection actions ────────── */
.passage-coach-menu {
    position: fixed;
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: calc(100vw - 16px);
    padding: 6px;
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--bg-raised) 96%, transparent);
    color: var(--text-primary);
    box-shadow: 0 12px 32px rgba(30, 24, 18, 0.18);
    backdrop-filter: blur(12px);
    white-space: nowrap;
}
.passage-coach-title {
    padding-left: 8px;
    color: var(--text-sub);
    font-size: var(--text-caption);
    font-weight: 700;
}
.passage-coach-actions {
    display: flex;
    align-items: center;
    gap: 3px;
}
.passage-coach-actions button {
    min-height: 34px;
    padding: 5px 10px;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-sub);
    cursor: pointer;
    font: 700 var(--text-caption)/1 var(--font-body);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.passage-coach-actions button:hover {
    background: var(--jade-glow);
    color: var(--jade-text);
}
.passage-coach-actions button:disabled {
    cursor: default;
    opacity: 0.42;
}
.passage-coach-actions .passage-coach-ask {
    background: var(--jade);
    color: #fff;
}
.passage-coach-actions .passage-coach-ask:hover {
    background: var(--jade-dk);
    color: #fff;
}
.passage-coach-actions button:focus-visible {
    outline: var(--focus-ring-alt);
    outline-offset: 2px;
}

/* Selected passage carried into the open-ended composer. */
.passage-context-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 9px 8px 11px;
    border: 1px solid var(--border-mid);
    border-left: 3px solid var(--jade);
    border-radius: var(--radius-md);
    background: var(--bg-panel);
}
.passage-context-chip[hidden] { display: none; }
.passage-context-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 2px;
}
.passage-context-label {
    color: var(--jade-text);
    font-size: var(--text-micro);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.passage-context-excerpt {
    overflow: hidden;
    color: var(--text-sub);
    font-family: var(--font-display);
    font-size: var(--text-caption);
    font-style: italic;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.passage-context-chip > button {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.05rem;
}
.passage-context-chip > button:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.passage-context-chip > button:focus-visible {
    outline: var(--focus-ring-alt);
    outline-offset: 1px;
}

@media (max-width: 480px) {
    .passage-coach-menu {
        align-items: stretch;
        flex-direction: column;
        gap: 4px;
        width: calc(100vw - 16px);
        padding: 8px;
        border-radius: var(--radius-lg);
    }
    .passage-coach-title {
        padding: 2px 5px 5px;
    }
    .passage-coach-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .passage-coach-actions button {
        min-height: 44px;
        padding-inline: 5px;
        font-size: var(--text-micro);
    }
    .passage-coach-actions .passage-coach-ask {
        grid-column: span 2;
    }
}

/* ═══════════════════════════════════════════════════════════
   ≤ 375px — iPhone SE, small Android, 320 px support
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 375px) {
    /* ── Header: maximum compression ── */
    .app-header    { padding: 7px 10px; gap: 6px; }
    .header-logo   { width: 34px; height: 34px; }
    .header-logo.chat-avatar-anim { width: 38px !important; height: 30px !important; }
    .header-text h1 {
        font-size: var(--text-emph);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .theme-toggle, .reset-btn, .help-btn { width: 44px; height: 44px; }
    .lang-btn { padding: 3px 5px; font-size: 0.58rem; }

    /* ── Workspace: draft gets most of the screen ── */
    .workspace { grid-template-rows: 60% 40%; }

    /* ── Stage circles ── */
    .stage-circle { width: 28px; height: 28px; font-size: 0.55rem; }

    /* ── Save / Continue: slightly smaller text ── */
    .save-btn, .continue-btn { font-size: var(--text-ui); }

    /* ── Chat messages ── */
    .msg { max-width: 98%; }
    .chat-messages { padding: 8px 10px 4px; }

    /* ── Instructor report: stack key / value pairs ── */
    .instr-evidence-row { flex-direction: column; gap: 2px; }
    .instr-evidence-key { min-width: unset; }

    /* ── Mi Toolkit: tighten spacing on smallest screens ── */
    .toolkit-modal-card { padding: 24px 14px calc(16px + env(safe-area-inset-bottom, 0px)); }
    .toolkit-section { margin-bottom: 14px; }
    .toolkit-claim-block { padding: 10px 12px; margin-bottom: 14px; }
    .toolkit-asset-chip { padding: 8px 10px; }
}

/* ═══════════════════════════════════════════════════════
   SKILL TOAST — Phase 5 micro-notification
   Non-blocking, bilingual, fades in then out.
   ═══════════════════════════════════════════════════════ */
.skill-toast {
    position: fixed;
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--jade);
    color: #fff;
    border-radius: var(--radius-full);
    padding: 10px 40px 10px 20px;
    font-size: var(--text-ui);
    line-height: 1.45;
    max-width: min(380px, calc(100vw - 32px));
    text-align: center;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: auto;
    z-index: 1400;
}
.skill-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.skill-toast-label {
    font-size: var(--text-micro);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    opacity: 0.82;
}
.skill-toast-text { opacity: 0.96; }
.skill-toast-dismiss {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.skill-toast-dismiss:hover { color: #fff; background: rgba(255,255,255,0.15); }
@media (prefers-reduced-motion: reduce) {
    .skill-toast { transition: opacity 0.1s ease; transform: translateX(-50%) translateY(0); }
    .toolkit-modal-bg,
    .toolkit-modal-card { animation: none; }
}

/* ── Patch 11: Read-Aloud / Escuchar ── */
.welcome-strip-text { flex: 1; min-width: 0; }
.tts-listen-btn {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    flex-shrink: 0;
    background: transparent;
    border: 1.5px solid var(--border-hi);
    border-radius: var(--radius-full);
    color: var(--text-sub);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: var(--text-subtitle);
    font-weight: 600;
    line-height: 1;
    min-height: 36px;
    padding: 6px 16px;
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.tts-listen-btn:hover {
    background: var(--bg-raised);
    color: var(--text-primary);
    border-color: var(--border-hi);
}
.tts-listen-btn:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}
.tts-listen-btn[data-tts-playing="true"] {
    background: var(--amber);
    color: #fff;
    border-color: var(--amber);
}
@media (max-width: 640px) {
    .tts-listen-btn {
        font-size: var(--text-note);
        min-height: 30px;
        padding: 4px 11px;
        border-width: 1px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .tts-listen-btn { transition: none; }
}

/* ── P2: Gemini→Offline fallback button (coach error bubbles) ── */
.offline-fallback-btn {
    display: flex;
    align-items: center;
    width: fit-content;
    margin-top: 10px;
    background: transparent;
    border: 1.5px solid var(--border-hi);
    border-radius: var(--radius-full);
    color: var(--text-sub);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: var(--text-emph);
    font-weight: 600;
    line-height: 1;
    min-height: 36px;
    padding: 6px 16px;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.offline-fallback-btn:hover {
    background: var(--bg-raised);
    color: var(--text-primary);
}
.offline-fallback-btn:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}
.offline-fallback-btn:disabled {
    opacity: 0.55;
    cursor: default;
}
@media (prefers-reduced-motion: reduce) {
    .offline-fallback-btn { transition: none; }
}

/* ── P4: Journey Complete card (Stage 10 submission instructions) ── */
.journey-complete-card {
    background: var(--bg-raised);
    border: 1.5px solid var(--border-hi);
    border-left: 4px solid var(--jade, #5f8a65);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin: 14px 8px;
    padding: 16px 18px;
}
.journey-complete-badge {
    color: var(--jade, #5f8a65);
    font-size: var(--text-caption);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.journey-complete-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
    margin: 6px 0 10px;
}
.journey-complete-steps {
    color: var(--text-sub);
    font-size: var(--text-body);
    line-height: 1.5;
    margin: 0 0 12px;
    padding-left: 20px;
}
.journey-complete-steps li { margin-bottom: 8px; }
.journey-complete-steps li [lang="en"] { color: var(--text-muted); }
.journey-complete-cta {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: 1.5px solid var(--border-hi);
    border-radius: var(--radius-full);
    color: var(--text-sub);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: var(--text-emph);
    font-weight: 600;
    line-height: 1;
    min-height: 36px;
    padding: 6px 16px;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.journey-complete-cta:hover {
    background: var(--bg-hover, rgba(0,0,0,0.05));
    color: var(--text-primary);
}
.journey-complete-cta:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}
@media (max-width: 640px) {
    .journey-complete-card { margin: 10px 4px; padding: 13px 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .journey-complete-cta { transition: none; }
}

/* ── Patch 12: Onboarding Audio Playback ── */
.lab-audio-wrap { margin-bottom: 8px; }
#maniIntroAudioWrap { margin-top: 8px; }
#maniFreireAudioWrap { margin-bottom: 8px; }

/* ════════════════════════════════════════════════════════
   FALL 2026 POLISHING SPRINT
   Calm, editor-first shell over the existing ten-stage engine.
   ════════════════════════════════════════════════════════ */

/* The assignment chip already supplies the useful context; the uppercase
   marketing subtitle competes with it. */
#headerSub { display: none; }
.app-header { padding-block: 10px; }
.header-logo { width: 38px; height: 38px; }

/* Three student-facing phases. Detailed stages remain available on demand. */
.calm-progress {
    --calm-progress: 0%;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
    padding: 10px 22px;
    background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
    border-bottom: 1px solid var(--border-mid);
}
.calm-progress-list {
    position: relative;
    display: grid;
    grid-template-columns: max-content minmax(44px, 1fr) max-content minmax(44px, 1fr) max-content;
    align-items: center;
    gap: 12px;
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 0;
    list-style: none;
}
.calm-phase {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    color: var(--text-muted);
}
.calm-phase-marker {
    display: inline-grid;
    place-items: center;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    border: 1.5px solid var(--border-hi);
    border-radius: 50%;
    background: var(--bg-raised);
    color: var(--text-muted);
    font-size: var(--text-label);
    font-weight: 700;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.calm-phase-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    white-space: nowrap;
}
.calm-phase-copy strong {
    color: currentColor;
    font-size: var(--text-ui);
    font-weight: 700;
}
.calm-phase-copy small {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: var(--text-micro);
}
.calm-progress-connector {
    height: 2px;
    min-width: 28px;
    border-radius: var(--radius-full);
    background: var(--border-hi);
}
.calm-phase.done .calm-phase-marker {
    border-color: var(--jade);
    background: var(--jade);
    color: #fff;
}
.calm-phase.done .calm-phase-marker::before {
    content: '✓';
}
.calm-phase.done .calm-phase-marker {
    font-size: 0;
}
.calm-phase.done .calm-phase-marker::before {
    font-size: var(--text-label);
}
.calm-phase.done,
.calm-phase.active {
    color: var(--text-primary);
}
.calm-phase.active .calm-phase-marker {
    border-color: var(--jade);
    background: var(--jade-glow);
    color: var(--jade-text);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--jade-glow) 60%, transparent);
}
.calm-path-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    flex-shrink: 0;
    padding: 5px 11px;
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-sub);
    cursor: pointer;
    font: 600 var(--text-label)/1 var(--font-body);
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.calm-path-toggle:hover {
    border-color: var(--jade);
    background: var(--jade-glow);
    color: var(--jade-text);
}
.calm-path-toggle:focus-visible {
    outline: var(--focus-ring-alt);
    outline-offset: 2px;
}
.calm-path-toggle svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform var(--transition-fast);
}
.path-details-open .calm-path-toggle svg { transform: rotate(180deg); }
.journey-wrap--details { display: none; }
.path-details-open .journey-wrap--details { display: flex; }

/* Give the student's document more visual authority than the coach. */
@media (min-width: 769px) {
    .workspace {
        grid-template-columns: minmax(0, 1.16fr) minmax(340px, 0.84fr);
    }
}

/* Streamlined first visit */
.welcome-bg {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 12% 12%, var(--amber-glow), transparent 34%),
        radial-gradient(circle at 88% 88%, var(--jade-glow), transparent 36%),
        color-mix(in srgb, var(--bg-base) 92%, transparent);
    backdrop-filter: blur(14px);
    opacity: 0;
    transition: opacity 320ms ease;
}
.welcome-card {
    width: min(680px, 100%);
    max-height: min(760px, 92svh);
    overflow-y: auto;
    padding: clamp(24px, 4vw, 42px);
    border: 1px solid var(--border-hi);
    border-radius: 24px;
    background: var(--bg-raised);
    box-shadow: 0 24px 70px rgba(30, 24, 18, 0.18);
}
.welcome-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.welcome-eyebrow {
    color: var(--jade-text);
    font-size: var(--text-label);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.welcome-languages {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-full);
    background: var(--bg-panel);
}
.welcome-languages .lang-btn {
    min-height: 32px;
    padding: 4px 10px;
    border: 0;
    box-shadow: none;
    background: transparent;
}
.welcome-languages .lang-btn[aria-pressed="true"] {
    background: var(--bg-raised);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}
.welcome-copy {
    margin: clamp(28px, 5vw, 42px) 0 26px;
}
.welcome-copy h2 {
    max-width: 570px;
    margin: 0;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.35rem);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.04;
}
.welcome-copy p {
    max-width: 560px;
    margin: 18px 0 0;
    color: var(--text-sub);
    font-size: clamp(1rem, 2vw, 1.1rem);
    line-height: 1.55;
}
.welcome-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.welcome-steps li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    background: var(--bg-panel);
}
.welcome-step-num {
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    border-radius: 50%;
    background: var(--jade-glow);
    color: var(--jade-text);
    font-size: var(--text-caption);
    font-weight: 700;
}
.welcome-steps strong,
.welcome-steps small {
    display: block;
}
.welcome-steps strong {
    color: var(--text-primary);
    font-size: var(--text-ui);
}
.welcome-steps small {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: var(--text-caption);
    line-height: 1.35;
}
.welcome-trust {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 18px 0 22px;
    color: var(--text-sub);
    font-size: var(--text-note);
    line-height: 1.45;
}
.welcome-trust svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    fill: none;
    stroke: var(--jade-text);
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.welcome-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.welcome-primary,
.welcome-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 9px 18px;
    border-radius: var(--radius-full);
    cursor: pointer;
    font: 700 var(--text-emph)/1.15 var(--font-body);
}
.welcome-primary {
    border: 1px solid var(--jade);
    background: var(--jade);
    color: #fff;
    box-shadow: 0 8px 20px var(--jade-glow);
}
.welcome-primary:hover { background: var(--jade-dk); }
.welcome-primary svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.welcome-secondary {
    border: 1px solid var(--border-hi);
    background: transparent;
    color: var(--text-sub);
}
.welcome-secondary:hover {
    border-color: var(--jade);
    background: var(--jade-glow);
    color: var(--jade-text);
}
.welcome-primary:focus-visible,
.welcome-secondary:focus-visible {
    outline: var(--focus-ring-alt-strong);
    outline-offset: 2px;
}

@media (max-width: 720px) {
    .calm-progress { gap: 10px; padding-inline: 14px; }
    .calm-progress-list { gap: 7px; }
    .calm-progress-connector { min-width: 14px; }
    .calm-phase-copy small { display: none; }
    .calm-phase-copy strong { font-size: var(--text-label); }
    .calm-path-toggle { padding-inline: 9px; }
    .welcome-steps { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .calm-progress {
        padding: 8px 10px;
        gap: 8px;
    }
    .calm-progress-list {
        grid-template-columns: max-content 1fr max-content 1fr max-content;
        gap: 5px;
    }
    .calm-phase { gap: 0; }
    .calm-phase-marker {
        width: 25px;
        height: 25px;
        flex-basis: 25px;
    }
    .calm-phase-copy { display: none; }
    .calm-progress-connector { min-width: 10px; }
    .calm-path-toggle {
        width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
    }
    .calm-path-toggle #calmPathToggleText { display: none; }
    .path-details-open .journey-wrap--details { display: none; }
    .mobile-stage-nav { display: none; }
    .path-details-open .mobile-stage-nav { display: flex; }

    .welcome-bg {
        align-items: end;
        padding: 10px;
    }
    .welcome-card {
        max-height: 94svh;
        padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
        border-radius: 22px;
    }
    .welcome-topline {
        align-items: flex-start;
        flex-direction: column;
    }
    .welcome-copy { margin: 24px 0 20px; }
    .welcome-copy h2 { font-size: 2rem; }
    .welcome-copy p { font-size: 0.98rem; }
    .welcome-steps li { padding: 11px 12px; }
    .welcome-actions { align-items: stretch; flex-direction: column; }
    .welcome-primary,
    .welcome-secondary { width: 100%; }
    #landingTtsWrap { align-self: center; }
}

@media (prefers-reduced-motion: reduce) {
    .welcome-bg,
    .calm-phase-marker,
    .calm-path-toggle,
    .calm-path-toggle svg {
        transition: none;
    }
}
