/* === A4 Print Layout === */
        @page {
            size: A4;
            margin: 20mm 18mm 25mm 18mm;
        }

        @media print {
            body { padding: 0; margin: 0; max-width: 170mm; }
            .no-print { display: none !important; }
            .page-break { page-break-before: always; }
            .avoid-break { page-break-inside: avoid; }
            a { color: inherit; text-decoration: none; }
            .toc a { color: #1a1a2e; }
        }

        /* === Base Styles === */
        * { box-sizing: border-box; margin: 0; padding: 0; }

        body {
            font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
            font-size: 11pt;
            line-height: 1.7;
            color: #1a1a2e;
            max-width: 960px;
            margin: 0 auto;
            padding: 40px 48px;
            background: white;
        }

        /* === Typography === */
        h1 {
            font-size: 22pt;
            font-weight: 700;
            color: #0f172a;
            margin-bottom: 8pt;
            line-height: 1.2;
        }

        h2 {
            font-size: 15pt;
            font-weight: 600;
            color: #1e293b;
            margin-top: 24pt;
            margin-bottom: 10pt;
            padding-bottom: 4pt;
            border-bottom: 2px solid #e2e8f0;
        }

        h3 {
            font-size: 12pt;
            font-weight: 600;
            color: #334155;
            margin-top: 16pt;
            margin-bottom: 8pt;
        }

        h4 {
            font-size: 10.5pt;
            font-weight: 600;
            color: #475569;
            margin-top: 12pt;
            margin-bottom: 6pt;
        }

        p { margin-bottom: 8pt; }

        /* === Title Page (slim header, not a full-screen cover) === */
        .title-page {
            text-align: center;
            padding: 18pt 0 12pt;
        }

        .title-page .series-label {
            font-size: 9.5pt;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 2px;
            color: #1a9c8d;
            margin-bottom: 6pt;
        }

        .title-page h1 {
            font-size: 19pt;
            margin-bottom: 5pt;
        }

        .title-page .subtitle {
            font-size: 11pt;
            color: #64748b;
            font-weight: 400;
            max-width: 620px;
            margin: 0 auto 8pt;
        }

        .title-page .meta {
            font-size: 9pt;
            color: #94a3b8;
        }

        /* === Table of Contents === */
        .toc {
            counter-reset: toc;
            padding: 16pt 20pt;
            background: #f8fafc;
            border-radius: 8pt;
            margin: 20pt 0;
        }

        .toc h2 {
            font-size: 12pt;
            margin-top: 0;
            border: none;
            padding-bottom: 8pt;
        }

        .toc ol {
            list-style: none;
            padding: 0;
        }

        .toc > ol > li {
            counter-increment: toc;
            margin-bottom: 4pt;
        }

        .toc > ol > li::before {
            content: counter(toc) ". ";
            font-weight: 600;
            color: #1a9c8d;
        }

        .toc a {
            color: #334155;
            text-decoration: none;
        }

        .toc a:hover { color: #1a9c8d; }

        .toc .sub-items {
            padding-left: 20pt;
            list-style: none;
        }

        .toc .sub-items li {
            font-size: 9.5pt;
            color: #64748b;
            margin-bottom: 2pt;
        }

        .toc .toc-part-label {
            font-weight: 600;
            font-size: 10pt;
            color: #1a9c8d;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-top: 12pt;
            margin-bottom: 4pt;
            padding-top: 8pt;
            border-top: 1px solid #e2e8f0;
        }

        .toc .toc-part-label:first-child {
            margin-top: 0;
            padding-top: 0;
            border-top: none;
        }

        /* === Part Dividers === */
        .part-divider {
            text-align: center;
            padding: 18pt 0 14pt;
        }

        .part-divider .part-label {
            font-size: 10pt;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 3px;
            color: #1a9c8d;
            margin-bottom: 8pt;
        }

        .part-divider h2 {
            border: none;
            font-size: 18pt;
            margin-top: 0;
        }

        .part-divider p {
            color: #64748b;
            font-size: 10.5pt;
        }

        /* === Info Boxes === */
        .info-box {
            background: #fafafa;
            border: 1px solid #e2e8f0;
            padding: 12pt 16pt;
            border-radius: 6pt;
            margin: 12pt 0;
            font-size: 10pt;
        }



        .info-box-title {
            font-weight: 600;
            margin-bottom: 4pt;
        }

        /* === Glossary / Definition Box === */
        .glossary {
            background: #fafafa;
            border: 1px solid #e2e8f0;
            border-radius: 8pt;
            padding: 16pt;
            margin: 16pt 0;
        }

        .glossary h3 {
            margin-top: 0;
            font-size: 11pt;
        }

        .glossary dl {
            margin: 0;
        }

        .glossary dt {
            font-weight: 600;
            color: #1e293b;
            margin-top: 8pt;
        }

        .glossary dd {
            margin-left: 0;
            padding-left: 16pt;
            color: #475569;
            font-size: 10pt;
        }

        /* === Figures === */
        figure {
            margin: 16pt 0;
            text-align: center;
            page-break-inside: avoid;
        }

        figure img {
            max-width: 100%;
            border: 1px solid #e2e8f0;
            border-radius: 6pt;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        }
        /* Tall, narrow screenshots (dialogs, sidebars) */
        figure.figure-narrow img {
            max-width: 320px;
        }


        figcaption {
            font-size: 9pt;
            color: #64748b;
            font-style: italic;
            margin-top: 6pt;
        }

        /* === Tables === */
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 12pt 0;
            font-size: 10pt;
            page-break-inside: avoid;
        }

        th, td {
            padding: 8pt 10pt;
            text-align: left;
            border-bottom: 1px solid #e2e8f0;
        }

        th {
            background: #f8fafc;
            font-weight: 600;
            color: #334155;
            font-size: 9.5pt;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        /* === Code / Formulas === */
        code {
            font-family: 'JetBrains Mono', monospace;
            font-size: 9pt;
            background: #f1f5f9;
            padding: 1pt 4pt;
            border-radius: 3pt;
            color: #0f172a;
        }

        pre {
            font-family: 'JetBrains Mono', monospace;
            font-size: 9pt;
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 6pt;
            padding: 12pt 16pt;
            overflow-x: auto;
            margin: 10pt 0;
            line-height: 1.6;
        }

        .formula-box {
            background: #f8fafc;
            border: 1px solid #cbd5e1;
            border-radius: 8pt;
            padding: 16pt 20pt;
            margin: 14pt 0;
            text-align: center;
            page-break-inside: avoid;
        }

        .formula-box .formula {
            font-family: 'JetBrains Mono', monospace;
            font-size: 11pt;
            color: #1e293b;
            margin: 8pt 0;
        }

        .formula-box .formula-label {
            font-size: 9pt;
            color: #64748b;
            margin-top: 6pt;
        }

        /* === Example Walkthrough === */
        .example-box {
            background: #fefce8;
            border: 1px solid #fde68a;
            border-radius: 8pt;
            padding: 16pt;
            margin: 14pt 0;
            page-break-inside: avoid;
        }

        .example-box h4 {
            color: #92400e;
            margin-top: 0;
        }

        .example-box .calculation {
            font-family: 'JetBrains Mono', monospace;
            font-size: 9.5pt;
            background: white;
            border-radius: 4pt;
            padding: 10pt;
            margin: 8pt 0;
        }

        /* === UI Mockup Boxes === */
        .ui-box {
            background: #f8fafc;
            border: 2px solid #e2e8f0;
            border-radius: 10pt;
            padding: 20pt;
            margin: 14pt 0;
            page-break-inside: avoid;
        }

        .ui-box .ui-label {
            font-size: 9pt;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: #94a3b8;
            font-weight: 600;
            margin-bottom: 6pt;
        }

        .ui-box .ui-field {
            display: flex;
            align-items: center;
            gap: 10pt;
            margin-bottom: 8pt;
        }

        .ui-box .ui-field-name {
            font-weight: 600;
            min-width: 120pt;
            color: #334155;
        }

        .ui-box .ui-field-value {
            background: white;
            border: 1px solid #cbd5e1;
            border-radius: 4pt;
            padding: 4pt 10pt;
            flex: 1;
            color: #475569;
            font-size: 10pt;
        }

        /* === Choicery UI Replica (faithful) =================== */
        /* Matches app/templates/analysis/hub/_estimation_cbc.html */
        :root {
            --cho-teal: #0f766e;
            --cho-teal-dark: #115e59;
            --cho-teal-soft: #ccfbf1;
            --cho-teal-ring: rgba(15, 118, 110, 0.12);
            --cho-border: #e2e8f0;
            --cho-border-strong: #94a3b8;
            --cho-border-soft: #f1f5f9;
            --cho-bg-header: #f8fafc;
            --cho-bg-panel: #f9fafb;
            --cho-text: #1f2937;
            --cho-text-soft: #64748b;
            --cho-text-muted: #9ca3af;
            --cho-label: #374151;
        }

        .cho-card {
            border: 1px solid var(--cho-border);
            border-radius: 10px;
            background: #fff;
            margin: 16pt 0;
            page-break-inside: avoid;
            font-size: 10pt;
            box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05),
                        0 1px 2px rgba(15, 23, 42, 0.04);
            overflow: hidden;
        }
        .cho-card-header {
            background: linear-gradient(180deg, #fbfdfe 0%, var(--cho-bg-header) 100%);
            border-bottom: 1px solid var(--cho-border);
            padding: 11px 16px;
            color: var(--cho-text);
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 10pt;
        }
        .cho-card-header strong { font-weight: 600; font-size: 10.5pt; }
        .cho-badge {
            font-size: 8.5pt;
            padding: 3px 10px;
            border-radius: 5px;
            font-weight: 500;
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }
        .cho-badge-muted { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
        .cho-badge-pending { background: #fef3c7; color: #92400e; }

        .cho-form-section {
            padding: 14px 16px;
            border-bottom: 1px solid var(--cho-border-soft);
            color: var(--cho-text);
            background: #fff;
        }
        .cho-form-section:last-child { border-bottom: none; }

        .cho-section-title {
            font-size: 8pt;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            color: var(--cho-text-soft);
            margin-bottom: 9px;
        }

        .cho-inline-group {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
            align-items: flex-end;
        }
        .cho-form-group {
            flex: 1;
            min-width: 130px;
            display: flex;
            flex-direction: column;
        }
        .cho-form-group.cho-narrow {
            flex: 0 0 120px;
            min-width: 120px;
        }
        .cho-form-group.cho-wide { flex: 0 0 190px; }

        .cho-form-label {
            font-size: 9pt;
            font-weight: 500;
            color: var(--cho-label);
            margin-bottom: 5px;
            display: flex;
            align-items: center;
            gap: 5px;
            line-height: 1.2;
        }
        .cho-form-label .cho-info {
            color: var(--cho-text-muted);
            font-size: 8.5pt;
            cursor: help;
        }

        .cho-form-control {
            font-size: 9.5pt;
            padding: 5px 11px;
            border-radius: 6px;
            border: 1.5px solid var(--cho-border-strong);
            background: #fff;
            color: var(--cho-text);
            box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05);
            min-height: 30px;
            display: flex;
            align-items: center;
            line-height: 1.2;
        }
        .cho-form-control.cho-focus {
            border-color: var(--cho-teal);
            box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.05), 0 0 0 3px var(--cho-teal-ring);
        }
        .cho-form-control.cho-disabled {
            background: #f8fafc;
            color: #94a3b8;
        }
        .cho-form-control .cho-placeholder { color: #94a3b8; }

        .cho-run-btn {
            padding: 7px 18px;
            font-weight: 600;
            font-size: 9.5pt;
            border-radius: 6px;
            background: var(--cho-teal);
            border: none;
            color: #fff;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            box-shadow: 0 1px 2px rgba(15, 118, 110, 0.18),
                        0 2px 6px rgba(15, 118, 110, 0.14);
            min-height: 30px;
        }

        .cho-options-bar {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px 18px;
            margin-top: 12px;
            padding: 8px 12px;
            background: var(--cho-bg-header);
            border: 1px solid #e5e7eb;
            border-radius: 8px;
        }

        .cho-pill-toggle {
            display: inline-flex;
            border: 1.5px solid var(--cho-border-strong);
            border-radius: 6px;
            overflow: hidden;
            height: 28px;
            background: #fff;
        }
        .cho-pill-toggle .cho-pill {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 0 12px;
            font-size: 8.5pt;
            font-weight: 500;
            color: var(--cho-text-soft);
            background: #fff;
            border-right: 1px solid var(--cho-border);
            white-space: nowrap;
        }
        .cho-pill-toggle .cho-pill:last-child { border-right: none; }
        .cho-pill-toggle .cho-pill.cho-active {
            background: var(--cho-teal);
            color: #fff;
        }

        .cho-adv-toggle {
            font-size: 9.5pt;
            font-weight: 600;
            color: #4b5563;
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 9px 14px;
            background: #fff;
            border: 1.5px solid var(--cho-border-strong);
            border-radius: 8px;
            box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
        }
        .cho-adv-toggle .cho-chevron {
            font-size: 8.5pt;
            color: var(--cho-text-muted);
            transform: rotate(90deg);
            display: inline-block;
        }
        .cho-adv-section {
            background: var(--cho-bg-panel);
            border-radius: 8px;
            padding: 14px;
            margin-top: 10px;
            border: 1.5px solid var(--cho-border);
        }

        .cho-switch {
            display: inline-block;
            width: 32px;
            height: 18px;
            border-radius: 10px;
            background: var(--cho-teal);
            position: relative;
            margin-top: 5px;
            box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.15);
        }
        .cho-switch::after {
            content: '';
            position: absolute;
            top: 2px;
            left: 16px;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: #fff;
            box-shadow: 0 1px 2px rgba(0,0,0,0.25);
        }
        .cho-switch.cho-off { background: #cbd5e1; }
        .cho-switch.cho-off::after { left: 2px; }

        /* Sub-panel (Covariates / Sign Constraints pattern) */
        .cho-sub-panel {
            background: #fff;
            border: 1px solid #e5e7eb;
            border-left: 4px solid var(--cho-teal);
            border-radius: 4px 10px 10px 4px;
            padding: 12px 15px;
        }
        .cho-sub-panel-head {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
            margin-bottom: 4px;
        }
        .cho-sub-panel-help {
            font-size: 8pt;
            color: #6b7280;
            margin: 0 0 8px;
        }
        .cho-optional-tag {
            display: inline-flex;
            align-items: center;
            padding: 1px 7px;
            border-radius: 3px;
            font-size: 6.5pt;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: var(--cho-teal);
            background: var(--cho-teal-soft);
        }

        /* Meta-strip for results summary bar */
        .cho-meta-strip {
            display: flex;
            flex-wrap: wrap;
            gap: 0;
            border: 1px solid var(--cho-border);
            border-radius: 10px;
            background: #fff;
            overflow: hidden;
            margin: 16pt 0;
            page-break-inside: avoid;
            box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
        }
        .cho-meta-cell {
            flex: 1 1 130px;
            padding: 10px 14px;
            border-right: 1px solid var(--cho-border);
            min-width: 130px;
        }
        .cho-meta-cell:last-child { border-right: none; }
        .cho-meta-label {
            font-size: 7.5pt;
            text-transform: uppercase;
            letter-spacing: 0.6px;
            color: var(--cho-text-soft);
            font-weight: 600;
            margin-bottom: 3px;
        }
        .cho-meta-value {
            font-size: 12pt;
            font-weight: 700;
            color: var(--cho-text);
            line-height: 1.15;
        }
        .cho-meta-value.cho-ok { color: #15803d; }
        .cho-meta-value.cho-warn { color: #b91c1c; }
        .cho-meta-hint {
            font-size: 7.5pt;
            color: var(--cho-text-soft);
            margin-top: 3px;
            font-weight: 500;
        }
        .cho-meta-hint.cho-ok { color: #15803d; }
        .cho-meta-hint.cho-warn { color: #b91c1c; }

        /* "Not offered" row for comparison tables */
        .cho-not-offered td {
            background: #fafbfc;
            color: #64748b;
        }
        .cho-not-offered td:first-child strong {
            text-decoration: line-through;
            text-decoration-color: #cbd5e1;
            color: #94a3b8;
        }
        .cho-not-offered-badge {
            display: inline-block;
            margin-left: 6pt;
            padding: 1pt 7pt;
            font-size: 7.5pt;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            color: #92400e;
            background: #fef3c7;
            border-radius: 3pt;
            vertical-align: middle;
            text-decoration: none;
        }

        /* "Side output" row: method is accessible but not a primary analysis */
        .cho-side-output td {
            background: #fafbfc;
        }
        .cho-side-badge {
            display: inline-block;
            margin-left: 6pt;
            padding: 1pt 7pt;
            font-size: 7.5pt;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            color: #1e40af;
            background: #dbeafe;
            border-radius: 3pt;
            vertical-align: middle;
            text-decoration: none;
        }

        /* === Step-by-Step === */
        .step {
            display: flex;
            gap: 12pt;
            margin: 12pt 0;
            padding: 12pt;
            background: #fafafa;
            border-radius: 8pt;
            page-break-inside: avoid;
        }

        .step-number {
            flex-shrink: 0;
            width: 28pt;
            height: 28pt;
            background: #1a9c8d;
            color: white;
            font-weight: 700;
            font-size: 12pt;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .step-content {
            flex: 1;
        }

        .step-content p:last-child { margin-bottom: 0; }

        /* === Comparison Table (Method Summary) === */
        .method-comparison {
            border: 2px solid #e2e8f0;
            border-radius: 8pt;
            overflow: hidden;
            margin: 16pt 0;
        }

        .method-comparison th {
            background: #1e293b;
            color: white;
            text-transform: none;
            font-size: 10pt;
        }

        .method-comparison td {
            vertical-align: top;
        }

        .method-comparison .rank-best { color: #16a34a; font-weight: 600; }
        .method-comparison .rank-good { color: #2563eb; font-weight: 600; }
        .method-comparison .rank-ok { color: #d97706; font-weight: 600; }
        .method-comparison .rank-caution { color: #dc2626; font-weight: 600; }

        /* === References (APA 6) === */
        .references {
            margin-top: 30pt;
        }

        .references h2 {
            border-bottom: 2px solid #334155;
        }

        .references p {
            padding-left: 36pt;
            text-indent: -36pt;
            margin-bottom: 6pt;
            font-size: 9.5pt;
            line-height: 1.5;
        }

        /* === Utility === */
        .text-muted { color: #94a3b8; }
        .text-primary { color: #1a9c8d; }
        .font-mono { font-family: 'JetBrains Mono', monospace; }
        .mt-1 { margin-top: 8pt; }
        .mt-2 { margin-top: 16pt; }
        .mb-1 { margin-bottom: 8pt; }
        .mb-2 { margin-bottom: 16pt; }

        ul, ol { margin-bottom: 8pt; padding-left: 20pt; }
        li { margin-bottom: 4pt; }

        /* === Print Button (screen only) === */
        .print-btn {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background: #1a9c8d;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.2);
            z-index: 100;
        }

        .print-btn:hover { background: #2d8a9e; }

        /* ============================================================= */
        /* ======  CONJOINT MOCKUPS (choice task, maxdiff, bars)  ====== */
        /* Faithful participant-view + results mockups. Class-only.      */
        /* ============================================================= */

        /* --- CBC / shop choice task (participant view) --- */
        .ct { background: #fff; border: 1px solid #e2e8f0; border-radius: 8pt; padding: 14pt 16pt; margin: 12pt 0; }
        .ct-q { font-weight: 600; color: #1e293b; font-size: 11pt; margin-bottom: 12pt; }
        .ct-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10pt; }
        .ct-row.four { grid-template-columns: repeat(4, 1fr); }
        .ct-card { border: 1px solid #e2e8f0; border-radius: 8pt; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
        .ct-card.sel { border-color: #1a9c8d; box-shadow: 0 0 0 2px rgba(26, 156, 141, 0.25); }
        .ct-img { height: 62pt; background: #f1f5f9; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 8.5pt; text-align: center; padding: 4pt; }
        .ct-body { padding: 8pt 10pt; }
        .ct-attr { display: flex; justify-content: space-between; gap: 8pt; font-size: 9pt; padding: 4pt 0; border-top: 1px solid #f1f5f9; }
        .ct-attr .k { color: #94a3b8; } .ct-attr .v { color: #334155; font-weight: 500; text-align: right; }
        .ct-price { font-size: 12pt; font-weight: 700; color: #0f172a; text-align: center; padding: 7pt 0 3pt; }
        .ct-pick { margin: 4pt 10pt 10pt; text-align: center; border: 1px solid #cbd5e1; border-radius: 6pt; padding: 6pt; font-size: 9pt; color: #475569; }
        .ct-card.sel .ct-pick { background: #1a9c8d; color: #fff; border-color: #1a9c8d; }
        .ct-none { text-align: center; margin-top: 10pt; font-size: 9.5pt; color: #475569; }
        .ct-none .mark { display: inline-block; width: 14px; height: 14px; border: 2px solid #cbd5e1; border-radius: 50%; vertical-align: middle; margin-right: 6px; }

        /* --- MaxDiff / BW-CBC best-worst task --- */
        .mx { background: #fff; border: 1px solid #e2e8f0; border-radius: 8pt; padding: 14pt 16pt; margin: 12pt 0; }
        .mx-q { font-weight: 600; color: #1e293b; font-size: 11pt; margin-bottom: 10pt; }
        .mx-head, .mx-row { display: grid; grid-template-columns: 66pt 1fr 66pt; align-items: center; }
        .mx-head { font-size: 8pt; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; font-weight: 600; padding-bottom: 6pt; border-bottom: 1px solid #e2e8f0; }
        .mx-head .c { text-align: center; }
        .mx-row { border-bottom: 1px solid #f1f5f9; }
        .mx-row .item { font-size: 10pt; color: #334155; padding: 8pt 8pt; }
        .mx-cell { text-align: center; padding: 8pt 0; }
        .mx-dot { width: 15px; height: 15px; border: 2px solid #cbd5e1; border-radius: 50%; display: inline-block; vertical-align: middle; }
        .mx-dot.best { border-color: #16a34a; } .mx-dot.best.on { background: #16a34a; }
        .mx-dot.worst { border-color: #dc2626; } .mx-dot.worst.on { background: #dc2626; }

        /* --- Importance / utility bars (results) --- */
        .imp { margin: 12pt 0; }
        .imp-row { display: grid; grid-template-columns: 130pt 1fr 46pt; align-items: center; gap: 9pt; margin: 5pt 0; }
        .imp-row .lbl { font-size: 9.5pt; color: #334155; text-align: right; }
        .imp-bar { height: 15pt; background: #f1f5f9; border-radius: 3pt; overflow: hidden; }
        .imp-bar > span { display: block; height: 100%; background: #1a9c8d; }
        .imp-bar > span.neg { background: #dc2626; }
        .imp-row .val { font-size: 9pt; color: #475569; font-weight: 600; }
        .imp-w-8{width:8%}.imp-w-10{width:10%}.imp-w-12{width:12%}.imp-w-15{width:15%}.imp-w-18{width:18%}.imp-w-20{width:20%}.imp-w-25{width:25%}.imp-w-28{width:28%}.imp-w-30{width:30%}.imp-w-35{width:35%}.imp-w-40{width:40%}.imp-w-45{width:45%}.imp-w-50{width:50%}.imp-w-55{width:55%}.imp-w-60{width:60%}.imp-w-65{width:65%}.imp-w-70{width:70%}.imp-w-75{width:75%}.imp-w-80{width:80%}.imp-w-90{width:90%}.imp-w-100{width:100%}

        @media (max-width: 640px) {
            .ct-row, .ct-row.four { grid-template-columns: 1fr 1fr; }
        }

        /* === Desktop: dock TOC left; print reverts to inline === */
        @media screen and (min-width: 1280px) {
            body { margin-left: 280px; margin-right: 24px; max-width: 960px; padding-left: 0; padding-right: 0; }
            .toc { position: fixed; top: 0; left: 0; width: 260px; height: 100vh; overflow-y: auto; margin: 0; padding: 24pt 18pt; border-radius: 0; border-right: 1px solid #e2e8f0; background: #f8fafc; font-size: 9pt; z-index: 50; }
            .toc h2 { font-size: 11pt; }
            .toc > ol > li { font-size: 9pt; }
            .toc .sub-items li { font-size: 8pt; }
            .toc + .page-break { display: none; }
        }
        @media print {
            .toc { position: static; width: auto; height: auto; border-right: none; background: #f8fafc; padding: 16pt 20pt; border-radius: 8pt; margin: 20pt 0; }
            body { margin-left: 0; margin-right: 0; }
        }

        /* Caption under a CSS mockup (mockups are not <figure>, so cannot use figcaption) */
        .cap { font-size: 9pt; color: #64748b; font-style: italic; margin: 4pt 0 14pt; text-align: center; }

        /* --- Faithful "Generate Design" panel (design wizard) --- */
        .gen { border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; margin: 14pt 0; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); }
        .gen-body { padding: 16px 18px; }
        .gen-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
        .gen-head .lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: #94a3b8; }
        .gen-row { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 20px; }
        .gen-sizes { display: flex; align-items: flex-start; gap: 14px; }
        .gen-field { display: flex; flex-direction: column; }
        .gen-field .fl { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 7px; display: inline-flex; align-items: center; gap: 5px; }
        .gen-field .fl .cho-info { font-weight: 400; }
        .gen-input { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; width: 130px; height: 46px; box-sizing: border-box; border: 1.5px solid #cbd5e1; border-radius: 9px; padding: 0 7px 0 14px; background: #fff; }
        .gen-input .num { font-size: 18px; font-weight: 600; color: #1e293b; line-height: 1; }
        .gen-input .step { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 28px; height: 34px; border-radius: 7px; background: #f1f5f9; color: #94a3b8; flex: none; }
        .gen-input .step i { display: block; font-size: 8px; line-height: 1; }
        .gen-method { display: flex; flex-direction: column; }
        .gen-method .fl { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 7px; }
        .gen-seg { display: inline-flex; align-self: flex-start; border: 1px solid #d1d9e0; border-radius: 8px; overflow: hidden; }
        .gen-seg span { padding: 9px 16px; font-size: 13px; color: #334155; background: #fff; }
        .gen-seg span + span { border-left: 1px solid #d1d9e0; }
        .gen-seg span.on { background: #0f766e; color: #fff; font-weight: 600; }
        .gen-foot { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid #eef1f4; background: #f8fafc; }
        .gen-btn { flex: 1; background: #159a86; color: #fff; font-weight: 700; font-size: 15px; border-radius: 8px; padding: 13px; text-align: center; }
        .gen-x { width: 46px; border: 1px solid #fca5a5; border-radius: 8px; color: #dc2626; display: flex; align-items: center; justify-content: center; font-size: 15px; }
        @media (max-width: 680px) { .gen-row { flex-direction: column; align-items: stretch; } .gen-seg { align-self: stretch; justify-content: center; } }

        /* --- Cross-tutorial manual links (methods table, market-sim list) --- */
        a[href^="/static/tutorials/"] { color: #0f766e; text-decoration: underline; text-underline-offset: 2px; }
        a[href^="/static/tutorials/"]:hover { color: #0c5d57; }
