@import url('https://fonts.googleapis.com/css2?family=Syne:wght@500;600;700;800&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ==========================================================================
   ClaimLens Insurtech Cockpit Design System
   Anti-Slop V6, Motion 4, Density 8
   Palette: Tinted Charcoal/Slate (#0B0F17, #111827, #1E293B, #243248)
   Accents: Calibrated Emerald (#10B981), Amber (#F59E0B), Ruby (#F43F5E)
   Typography: Syne, Space Grotesk & JetBrains Mono (tabular-nums)
   ========================================================================== */

:root {
    /* Base Neutral Charcoal/Slate Cockpit Foundations */
    --bg-base: #080C14;
    --bg-surface: #0E1524;
    --bg-surface-elevated: #152034;
    --bg-surface-hover: #1C2B44;
    --bg-surface-subtle: #0A0E18;
    --bg-glass: rgba(14, 21, 36, 0.88);

    /* 1px Structural Dividers & Crisp Borders */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.22);
    --border-focus: #10B981;

    /* High-Fidelity Typography & Text Hierarchy */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-tertiary: #8496AC;
    --text-dim: #64748B;
    --font-display: 'Syne', var(--font-sans);
    --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Calibrated Semantic Accents */
    --accent-primary: #10B981;
    --accent-primary-hover: #059669;
    --accent-subtle: rgba(16, 185, 129, 0.12);
    --accent-cyan: #06B6D4;
    --accent-cyan-subtle: rgba(6, 182, 212, 0.12);

    /* Status Tokens with Tier-1 Luminance */
    --status-emerald: #10B981;
    --status-emerald-bg: rgba(16, 185, 129, 0.12);
    --status-emerald-border: rgba(16, 185, 129, 0.36);

    --status-ruby: #F43F5E;
    --status-ruby-bg: rgba(244, 63, 94, 0.12);
    --status-ruby-border: rgba(244, 63, 94, 0.36);

    --status-amber: #F59E0B;
    --status-amber-bg: rgba(245, 158, 11, 0.12);
    --status-amber-border: rgba(245, 158, 11, 0.36);

    /* Geometry & Spacing (Density 8) */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    /* Cockpit Shadows (Subtle, High-Precision Inset Bevels) */
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --shadow-panel: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --shadow-modal: 0 24px 60px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.12);
    --shadow-glow-emerald: 0 0 20px -2px rgba(16, 185, 129, 0.35);
    --shadow-glow-ruby: 0 0 20px -2px rgba(244, 63, 94, 0.35);
    --shadow-glow-amber: 0 0 20px -2px rgba(245, 158, 11, 0.35);
}

/* Custom Cockpit Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.28);
}

/* ==========================================================================
   CSS Reset & Institutional Base
   ========================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body.cockpit-root {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Strict Tabular Numeral Utilities */
.font-mono {
    font-family: var(--font-mono);
}

.tabular-nums,
.kpi-value,
.gauge-value,
.slider-live-value,
.tab-meta-acv,
.itemized-table td:nth-child(1),
.itemized-table td:nth-child(5),
.itemized-table td:nth-child(6),
.report-financial-grid .rpt-metric-val,
.report-table td:nth-child(1),
.report-table td:nth-child(5),
.report-table td:nth-child(6) {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    letter-spacing: -0.01em;
}

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.empty-hint {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-tertiary);
    font-size: 0.83rem;
}

/* Accessible Focus-Visible Outlines for Interactive Elements */
.upload-dropzone:focus-visible,
.scenario-tab-btn:focus-visible,
.toggle-pill:focus-visible,
.chip-btn:focus-visible,
.btn-primary-action:focus-visible,
.btn-cockpit-action:focus-visible,
.btn-close-modal:focus-visible,
.btn-primary-small:focus-visible,
.btn-clear-preview:focus-visible,
.tab-btn:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.range-slider:focus-visible::-webkit-slider-thumb {
    outline: 2px solid var(--border-focus);
    outline-offset: 4px;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.8);
}

.range-slider:focus-visible::-moz-range-thumb {
    outline: 2px solid var(--border-focus);
    outline-offset: 4px;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.8);
}

/* Comprehensive Disabled States */
.btn-cockpit-action:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
    border-color: var(--border-subtle) !important;
    background: var(--bg-surface) !important;
    color: var(--text-tertiary) !important;
}

.chip-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    border-color: var(--border-subtle) !important;
    background: transparent !important;
}

.scenario-tab-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.toggle-pill:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@supports not ((-webkit-backdrop-filter: blur(16px)) or (backdrop-filter: blur(16px))) {
    .app-header {
        background-color: #0E1524;
    }
    .canvas-tooltip {
        background: #080C14;
    }
    .adjuster-modal-backdrop {
        background: rgba(4, 7, 13, 0.96);
    }
}

/* ==========================================================================
   App Header & Cockpit Telemetry
   ========================================================================== */

.app-header {
    background-color: rgba(14, 21, 36, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border-medium);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 11px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #152034 0%, #0E1524 100%);
    border: 1px solid rgba(16, 185, 129, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.2;
}

.version-tag {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    padding: 1px 7px;
    border-radius: var(--radius-xs);
    letter-spacing: 0.05em;
    box-shadow: 0 0 8px -2px rgba(6, 182, 212, 0.25);
}

.brand-subtitle {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    font-weight: 400;
}

.header-telemetry-cluster {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.regulatory-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid var(--status-emerald-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--status-emerald);
    letter-spacing: 0.01em;
    box-shadow: inset 0 1px 0 rgba(16, 185, 129, 0.15);
}

.badge-icon {
    flex-shrink: 0;
}

.currency-badge,
.latency-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

@keyframes pulse-emerald {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    50% { opacity: 0.85; transform: scale(1.15); box-shadow: 0 0 8px 2px rgba(16, 185, 129, 0.5); }
}

@keyframes pulse-cyan {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.6); }
    50% { opacity: 0.85; transform: scale(1.15); box-shadow: 0 0 8px 2px rgba(6, 182, 212, 0.5); }
}

.telemetry-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background-color: var(--accent-primary);
    animation: pulse-emerald 2.4s ease-in-out infinite;
}

.latency-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background-color: var(--accent-cyan);
    animation: pulse-cyan 2.8s ease-in-out infinite;
}

/* ==========================================================================
   Main Layout & Unified Cockpit Workspace
   ========================================================================== */

.main-container {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.cockpit-bar,
.cockpit-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-subtle);
}

/* ==========================================================================
   Scenario Quick-Launch Switcher Bar (Segmented Micro-Motion)
   ========================================================================== */

.scenario-bar-section {
    padding: 12px 16px;
}

.scenario-bar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.eyebrow-label {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.scenario-bar-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.scenario-segmented-control {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background-color: var(--bg-base);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.scenario-active-indicator {
    display: none; /* Managed via individual tab state transitions */
}

.scenario-tab-btn {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%), var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--text-primary);
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.scenario-tab-btn:active {
    transform: translateY(0);
}

.scenario-tab-btn.active-scenario {
    background-color: #152034;
    border-color: var(--border-focus);
    box-shadow: 0 0 16px -2px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(16, 185, 129, 0.4);
}

/* Case A: Asymmetrical geometry + smooth emerald fluid pulse & icon lift */
#btn-case-a {
    border-radius: 16px 4px 12px 4px;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.4s ease, background 0.3s ease;
}

#btn-case-a:hover {
    transform: translateY(-2px);
    border-color: rgba(16, 185, 129, 0.5);
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-surface-hover) 100%);
    box-shadow: 0 6px 18px -2px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(16, 185, 129, 0.4);
}

#btn-case-a:hover .tab-badge,
#btn-case-a:hover svg {
    transform: translateY(-2px) scale(1.06);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#btn-case-a.active-scenario {
    border-color: #10B981;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.16) 0%, #152034 100%);
    box-shadow: 0 0 20px -1px rgba(16, 185, 129, 0.4), inset 0 1px 0 rgba(16, 185, 129, 0.6);
    animation: emerald-fluid-pulse 3s ease-in-out infinite;
}

@keyframes emerald-fluid-pulse {
    0%, 100% { box-shadow: 0 0 18px -2px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(16, 185, 129, 0.5); }
    50% { box-shadow: 0 0 26px 2px rgba(16, 185, 129, 0.55), inset 0 1px 0 rgba(16, 185, 129, 0.7); }
}

/* Case B: Asymmetrical geometry + alert crimson boundary glow with diagonal stripe depth */
#btn-case-b {
    border-radius: 4px 16px 4px 12px;
    position: relative;
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.4s ease, background 0.3s ease;
}

#btn-case-b::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: repeating-linear-gradient(
        -45deg,
        rgba(244, 63, 94, 0.04),
        rgba(244, 63, 94, 0.04) 7px,
        transparent 7px,
        transparent 14px
    );
    pointer-events: none;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

#btn-case-b:hover::before,
#btn-case-b.active-scenario::before {
    opacity: 1;
}

#btn-case-b:hover {
    transform: translateY(-2px);
    border-color: rgba(244, 63, 94, 0.5);
    background: linear-gradient(180deg, rgba(244, 63, 94, 0.08) 0%, var(--bg-surface-hover) 100%);
    box-shadow: 0 6px 18px -2px rgba(244, 63, 94, 0.35), inset 0 1px 0 rgba(244, 63, 94, 0.4);
}

#btn-case-b.active-scenario {
    border-color: #F43F5E;
    background: linear-gradient(180deg, rgba(244, 63, 94, 0.16) 0%, #152034 100%);
    box-shadow: 0 0 22px -1px rgba(244, 63, 94, 0.45), inset 0 1px 0 rgba(244, 63, 94, 0.6);
}

/* Case C: Asymmetrical geometry + hazard amber crosshair focus with caution border shimmer */
#btn-case-c {
    border-radius: 12px 4px 16px 4px;
    position: relative;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.4s ease, background 0.3s ease;
}

#btn-case-c::before {
    content: "";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 14px;
    height: 14px;
    background:
        radial-gradient(circle at center, #F59E0B 1.5px, transparent 2px),
        linear-gradient(#F59E0B, #F59E0B) no-repeat center/1px 100%,
        linear-gradient(#F59E0B, #F59E0B) no-repeat center/100% 1px;
    pointer-events: none;
    opacity: 0.35;
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#btn-case-c:hover::before {
    opacity: 0.85;
    transform: scale(1.15) rotate(45deg);
}

#btn-case-c.active-scenario::before {
    opacity: 1;
    transform: scale(1.25) rotate(90deg);
}

#btn-case-c:hover {
    transform: translateY(-2px);
    border-color: rgba(245, 158, 11, 0.5);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-surface-hover) 100%);
    box-shadow: 0 6px 18px -2px rgba(245, 158, 11, 0.35), inset 0 1px 0 rgba(245, 158, 11, 0.4);
}

#btn-case-c.active-scenario {
    border-color: #F59E0B;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.14) 0%, #152034 100%);
    box-shadow: 0 0 20px -2px rgba(245, 158, 11, 0.4), inset 0 1px 0 rgba(245, 158, 11, 0.55);
    animation: caution-border-shimmer 2.4s ease-in-out infinite;
}

@keyframes caution-border-shimmer {
    0%, 100% { border-color: rgba(245, 158, 11, 0.5); box-shadow: 0 0 16px -2px rgba(245, 158, 11, 0.35), inset 0 1px 0 rgba(245, 158, 11, 0.5); }
    50% { border-color: rgba(245, 158, 11, 0.95); box-shadow: 0 0 24px 1px rgba(245, 158, 11, 0.55), inset 0 1px 0 rgba(245, 158, 11, 0.7); }
}

.tab-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tab-meta-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-kbd-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-tertiary);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xs);
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.scenario-tab-btn:hover .tab-kbd-hint {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
}

.pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
}

.pill-repair {
    background-color: var(--status-emerald-bg);
    color: #34D399;
    border: 1px solid var(--status-emerald-border);
}

.pill-loss {
    background-color: var(--status-ruby-bg);
    color: #FB7185;
    border: 1px solid var(--status-ruby-border);
}

.pill-abstain {
    background-color: var(--status-amber-bg);
    color: #FBBF24;
    border: 1px solid var(--status-amber-border);
}

.tab-meta-acv {
    font-size: 0.76rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.tab-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.tab-icon-wrap {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.tab-main-title {
    font-size: 0.93rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.tab-subtext {
    font-size: 0.76rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Collision Evidence & Valuation Console
   ========================================================================== */

.form-section {
    padding: 16px 20px;
}

.card-section-header {
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 10px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.11rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.83rem;
    color: var(--text-tertiary);
}

.console-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 20px;
    align-items: stretch;
}

/* Dropzone */
.dropzone-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-label {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.control-note {
    font-size: 0.74rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.upload-dropzone {
    background-color: var(--bg-surface-subtle);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.upload-dropzone::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.08) 0%, transparent 75%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.upload-dropzone:hover::before,
.upload-dropzone.drag-over::before {
    opacity: 1;
}

.upload-dropzone:hover,
.upload-dropzone.drag-over {
    border-color: var(--accent-primary);
    border-style: solid;
    box-shadow: 0 0 20px -4px rgba(16, 185, 129, 0.25), inset 0 0 16px rgba(16, 185, 129, 0.06);
}

.file-input-hidden {
    display: none;
}

.upload-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    margin: 0 auto 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.upload-dropzone:hover .upload-icon-circle {
    transform: translateY(-2px) scale(1.05);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

.dropzone-prompt {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.browse-link {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dropzone-hint {
    font-size: 0.74rem;
    color: var(--text-tertiary);
}

.dropzone-preview {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone-preview img {
    max-width: 100%;
    max-height: 180px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-medium);
    object-fit: contain;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.btn-clear-preview {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(14, 21, 36, 0.9);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.btn-clear-preview:hover {
    background: #F43F5E;
    border-color: #F43F5E;
    transform: scale(1.1);
}

.quality-gate-banner {
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
    margin-top: 6px;
    line-height: 1.45;
}

.quality-gate-banner.rejected {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #FDA4AF;
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.15);
}

/* Valuation Parameters */
.parameters-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-content: space-between;
}

.controls-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-subtext {
    font-size: 0.74rem;
    color: var(--text-tertiary);
}

.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-secondary);
    pointer-events: none;
    transition: transform 0.15s ease;
}

.form-control {
    width: 100%;
    background-color: var(--bg-surface-subtle);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: all 0.15s ease;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 1px var(--border-focus), 0 0 8px rgba(16, 185, 129, 0.2);
}

.input-currency-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.currency-prefix {
    position: absolute;
    left: 10px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-tertiary);
    pointer-events: none;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.input-currency-wrapper input {
    padding-left: 54px;
}

/* Range Slider & Quick Presets */
.slider-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-live-value {
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--accent-primary);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 1px 8px;
    border-radius: var(--radius-xs);
}

.slider-track-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.range-slider {
    width: 100%;
    height: 6px;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, #10B981 0%, #06B6D4 100%);
    border: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: #FFFFFF;
    border: 3px solid #10B981;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6), 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.9), 0 2px 6px rgba(0, 0, 0, 0.5);
}

.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: #FFFFFF;
    border: 3px solid #10B981;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6), 0 2px 4px rgba(0, 0, 0, 0.4);
}

.slider-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    color: var(--text-tertiary);
}

.tick-highlight {
    color: var(--accent-primary);
    font-weight: 700;
}

.quick-chips {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

.chip-btn {
    flex: 1;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    padding: 4px 0;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.chip-btn:hover {
    background: var(--bg-surface-hover);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.chip-btn.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.45);
    color: #34D399;
    font-weight: 700;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

/* Primary Execution Button */
.action-btn-row {
    margin-top: 4px;
}

.btn-primary-action {
    width: 100%;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #04140E;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    font-size: 0.94rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 20px -2px rgba(16, 185, 129, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary-action::after {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(60deg, transparent 40%, rgba(255, 255, 255, 0.15) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.7s ease-out;
}

.btn-primary-action:hover::after {
    transform: translateX(100%);
}

.btn-primary-action:hover {
    background: linear-gradient(135deg, #34D399 0%, #059669 100%);
    box-shadow: 0 0 28px -2px rgba(16, 185, 129, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.btn-primary-action:active {
    transform: translateY(1px);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn-primary-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(11, 15, 23, 0.3);
    border-top-color: #0B0F17;
    border-radius: var(--radius-full);
    animation: spin 0.75s linear infinite;
}

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

/* ==========================================================================
   Executive Triage Decision Banner & Telemetry Strip
   ========================================================================== */

.triage-section {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.triage-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 20px 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    background-color: var(--bg-surface-subtle);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.triage-banner.status-waiting {
    border-left: 5px solid var(--text-dim);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0%, rgba(10, 14, 24, 0.6) 100%);
}

.triage-banner.status-emerald {
    border-left: 5px solid var(--status-emerald);
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.12) 0%, rgba(14, 21, 36, 0.8) 100%);
    border-color: rgba(16, 185, 129, 0.32);
    box-shadow: 0 4px 24px -4px rgba(16, 185, 129, 0.2), inset 0 1px 0 rgba(16, 185, 129, 0.25);
}

.triage-banner.status-ruby {
    border-left: 5px solid var(--status-ruby);
    background: linear-gradient(90deg, rgba(244, 63, 94, 0.12) 0%, rgba(14, 21, 36, 0.8) 100%);
    border-color: rgba(244, 63, 94, 0.32);
    box-shadow: 0 4px 24px -4px rgba(244, 63, 94, 0.2), inset 0 1px 0 rgba(244, 63, 94, 0.25);
}

.triage-banner.status-amber {
    border-left: 5px solid var(--status-amber);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(14, 21, 36, 0.8) 100%);
    border-color: rgba(245, 158, 11, 0.32);
    box-shadow: 0 4px 24px -4px rgba(245, 158, 11, 0.2), inset 0 1px 0 rgba(245, 158, 11, 0.25);
}

.triage-banner-left {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex: 1;
}

.triage-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.status-emerald .triage-icon-badge {
    color: #34D399;
    border-color: var(--status-emerald-border);
    background-color: var(--status-emerald-bg);
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.3);
}

.status-ruby .triage-icon-badge {
    color: #FB7185;
    border-color: var(--status-ruby-border);
    background-color: var(--status-ruby-bg);
    box-shadow: 0 0 14px rgba(244, 63, 94, 0.3);
}

.status-amber .triage-icon-badge {
    color: #FBBF24;
    border-color: var(--status-amber-border);
    background-color: var(--status-amber-bg);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.3);
}

.triage-text-cluster {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.triage-status-headline {
    font-size: 1.28rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    line-height: 1.25;
}

.triage-summary {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.triage-action-box {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: fit-content;
}

.action-label {
    color: var(--accent-cyan);
    font-weight: 700;
    letter-spacing: 0.06em;
}

.action-text {
    color: var(--text-primary);
    font-weight: 500;
}

/* Gauge Ring (Loss Ratio) */
.triage-banner-right {
    flex-shrink: 0;
}

.gauge-ring-container {
    position: relative;
    width: 104px;
    height: 104px;
}

.gauge-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: var(--bg-surface-elevated);
    stroke-width: 8;
}

.gauge-bar {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 314.159;
    stroke-dashoffset: 314.159;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.3s ease;
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.5));
}

.status-ruby .gauge-bar {
    filter: drop-shadow(0 0 6px rgba(244, 63, 94, 0.5));
}

.status-amber .gauge-bar {
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
}

.gauge-center-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.gauge-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.gauge-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin-top: 3px;
}

/* KPI Telemetry Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.kpi-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%), var(--bg-surface-subtle);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    box-shadow: var(--shadow-subtle);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    border-color: rgba(255, 255, 255, 0.24);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.kpi-icon-svg {
    color: var(--text-tertiary);
}

.kpi-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
    letter-spacing: -0.02em;
}

.kpi-footer {
    font-size: 0.74rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ==========================================================================
   Interactive Split Studio (Visual Canvas & Analytical Console)
   ========================================================================== */

.studio-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 16px;
    align-items: stretch;
}

.studio-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.vision-card {
    border-radius: 18px 6px 14px 20px;
}

.tabs-card {
    border-radius: 8px 22px 20px 6px;
}

/* Forensic corner reticles on studio cards */
.studio-card::before {
    content: "";
    position: absolute;
    top: -1px;
    right: -1px;
    width: 14px;
    height: 14px;
    border-top: 2px solid rgba(56, 189, 248, 0.4);
    border-right: 2px solid rgba(56, 189, 248, 0.4);
    pointer-events: none;
    z-index: 5;
    border-top-right-radius: inherit;
    transition: border-color 0.25s ease;
}

.studio-card:hover::before {
    border-color: rgba(56, 189, 248, 0.85);
}

.vision-card::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: -1px;
    width: 14px;
    height: 14px;
    border-bottom: 2px solid rgba(16, 185, 129, 0.45);
    border-left: 2px solid rgba(16, 185, 129, 0.45);
    pointer-events: none;
    z-index: 5;
    border-bottom-left-radius: inherit;
    transition: border-color 0.25s ease;
}

.vision-card:hover::after {
    border-color: rgba(16, 185, 129, 0.85);
}

.studio-card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(17, 24, 39, 0.75);
}

.title-with-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon-svg {
    color: var(--accent-cyan);
}

.studio-pane-title {
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--text-primary);
}

.studio-badge {
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    padding: 1px 6px;
    border-radius: var(--radius-xs);
}

/* Layer Toggles */
.layer-toggles {
    display: flex;
    gap: 6px;
}

.toggle-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-full);
    padding: 4px 10px;
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.toggle-pill:hover {
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-pill.active {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.toggle-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.toggle-pill.active .toggle-dot {
    transform: scale(1.15);
}

.dot-parts { background-color: #0284C7; }
.toggle-pill.active .dot-parts { box-shadow: 0 0 8px #38BDF8; }

.dot-damages { background-color: #F43F5E; }
.toggle-pill.active .dot-damages { box-shadow: 0 0 8px #FB7185; }

.dot-labels { background-color: #10B981; }
.toggle-pill.active .dot-labels { box-shadow: 0 0 8px #34D399; }

/* Canvas Viewport & Coordinate Precision */
.canvas-viewport {
    position: relative;
    width: 100%;
    min-height: 440px;
    max-height: 580px;
    background-color: #070B12;
    background-image:
        radial-gradient(ellipse 70% 60% at 50% 50%, rgba(14, 165, 233, 0.03) 0%, transparent 80%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 28px 28px, 28px 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Tactical Corner Reticles */
.canvas-reticle {
    position: absolute;
    width: 14px;
    height: 14px;
    pointer-events: none;
    z-index: 10;
    border-color: rgba(56, 189, 248, 0.35);
    border-style: solid;
    transition: border-color 0.2s ease;
}

.canvas-viewport:hover .canvas-reticle {
    border-color: rgba(56, 189, 248, 0.7);
}

.reticle-tl { top: 12px; left: 12px; border-width: 2px 0 0 2px; }
.reticle-tr { top: 12px; right: 12px; border-width: 2px 2px 0 0; }
.reticle-bl { bottom: 12px; left: 12px; border-width: 0 0 2px 2px; }
.reticle-br { bottom: 12px; right: 12px; border-width: 0 2px 2px 0; }

.canvas-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 540px;
}

.canvas-base-img {
    display: block;
    max-width: 100%;
    max-height: 540px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.canvas-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

/* SVG Polygons & Vector Rendering */
.svg-polygon {
    vector-effect: non-scaling-stroke;
    stroke-linejoin: round;
    stroke-linecap: round;
    cursor: pointer;
    transition: stroke-width 0.12s ease, fill-opacity 0.12s ease, filter 0.12s ease;
}

.svg-part {
    fill: rgba(14, 165, 233, 0.15);
    stroke: #0284C7;
    stroke-width: 1.5px;
}

.svg-damage {
    fill: rgba(244, 63, 94, 0.28);
    stroke: #F43F5E;
    stroke-width: 2px;
}

.svg-structural {
    fill: rgba(245, 158, 11, 0.32);
    stroke: #F59E0B;
    stroke-width: 2.5px;
}

/* High-Contrast Hover & Dual-Stroke Outlines */
.svg-polygon.is-highlighted {
    stroke-width: 3px;
    stroke: #FFFFFF !important;
}

.svg-part.is-highlighted {
    fill: rgba(14, 165, 233, 0.45);
    filter: drop-shadow(0 0 8px rgba(14, 165, 233, 0.85));
}

.svg-damage.is-highlighted {
    fill: rgba(244, 63, 94, 0.55);
    filter: drop-shadow(0 0 10px rgba(244, 63, 94, 0.95));
}

.svg-structural.is-highlighted {
    fill: rgba(245, 158, 11, 0.6);
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.95));
}

/* Dynamic Tooltip HUD (Boundary-Clamped) */
.canvas-tooltip {
    position: absolute;
    z-index: 50;
    background: rgba(8, 12, 20, 0.92);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    pointer-events: none;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    min-width: 180px;
    max-width: 240px;
    transition: opacity 0.15s ease;
}

.tooltip-header {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-medium);
    padding-bottom: 5px;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.76rem;
    margin-bottom: 4px;
}

.tt-label {
    color: var(--text-tertiary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tt-val {
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* Canvas Placeholder */
.canvas-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    text-align: center;
    color: var(--text-tertiary);
}

.placeholder-icon-wrap {
    color: var(--text-dim);
    margin-bottom: 8px;
}

.placeholder-title {
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.placeholder-desc,
.placeholder-text {
    font-size: 0.82rem;
    max-width: 320px;
    line-height: 1.45;
    color: var(--text-tertiary);
}

/* Canvas Legend Footer */
.canvas-footer-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 10px 16px;
    background: var(--bg-surface-subtle);
    border-top: 1px solid var(--border-medium);
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}

.swatch-part { background-color: #0284C7; }
.swatch-damage { background-color: #F43F5E; }
.swatch-structural { background-color: #F59E0B; }

/* ==========================================================================
   Analytical Intelligence Tabs & Tables
   ========================================================================== */

.tabs-nav {
    display: flex;
    background: rgba(14, 21, 36, 0.85);
    border-bottom: 1px solid var(--border-medium);
    padding: 0 8px;
    gap: 4px;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-tertiary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.01em;
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
    transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.tab-btn:hover {
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: rgba(16, 185, 129, 0.05);
}

.tabs-content {
    padding: 14px 16px;
    flex: 1;
    overflow-y: auto;
    min-height: 380px;
}

.tab-pane {
    display: none;
    flex-direction: column;
    gap: 14px;
}

.tab-pane.active {
    display: flex;
}

/* Itemized Repair Table */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-surface-subtle);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.itemized-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
    text-align: left;
}

.itemized-table th {
    background-color: var(--bg-surface-elevated);
    padding: 9px 12px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-medium);
}

.itemized-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.itemized-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.015);
}

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

.table-row-item {
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.table-row-item:hover {
    background-color: rgba(56, 189, 248, 0.08) !important;
    color: var(--text-primary);
}

.table-row-item.is-highlighted {
    background-color: rgba(16, 185, 129, 0.14) !important;
    color: var(--text-primary) !important;
    box-shadow: inset 3px 0 0 var(--accent-primary);
}

.action-pill {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.action-repair {
    background: var(--status-emerald-bg);
    color: var(--status-emerald);
    border: 1px solid var(--status-emerald-border);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}

.action-replace {
    background: var(--status-ruby-bg);
    color: var(--status-ruby);
    border: 1px solid var(--status-ruby-border);
    box-shadow: 0 0 8px rgba(244, 63, 94, 0.15);
}

.empty-row td {
    text-align: center;
    padding: 24px;
    color: var(--text-tertiary);
}

/* Assumptions Box */
.assumptions-box {
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--accent-cyan);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-subtle);
}

.assumptions-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.assumptions-title {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-primary);
}

.assumptions-list {
    list-style: square inside;
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Policy Guidance Tab */
.policy-header-banner {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid var(--status-emerald-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.06);
}

.policy-pane-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--status-emerald);
}

.policy-pane-sub {
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.policy-clauses-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.policy-card {
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-subtle);
}

.policy-card:hover {
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.policy-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.policy-article-badge {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-cyan);
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.25);
    padding: 2px 7px;
    border-radius: var(--radius-xs);
    letter-spacing: 0.03em;
}

.policy-score {
    font-size: 0.74rem;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
}

.policy-title {
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.policy-summary {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.45;
}

.policy-legal-quote {
    font-size: 0.76rem;
    color: #CBD5E1;
    font-style: italic;
    background: var(--bg-surface-elevated);
    padding: 8px 12px;
    border-left: 2px solid var(--accent-primary);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    line-height: 1.45;
}

/* Defensibility / Unknowns Tab */
.unknowns-header-banner {
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid var(--status-amber-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.06);
}

.unknowns-pane-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--status-amber);
}

.unknowns-pane-sub {
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.unknowns-list {
    list-style: square inside;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

.export-row {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.btn-cockpit-action {
    flex: 1;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 100%), var(--bg-surface-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    color: var(--text-primary);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-cockpit-action:hover {
    background: var(--bg-surface-hover);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-cockpit-action:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   Loading Skeletons Pulse
   ========================================================================== */

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton {
    background: linear-gradient(90deg, #1E293B 25%, #2D3E56 50%, #1E293B 75%) !important;
    background-size: 200% 100% !important;
    animation: skeleton-pulse 1.4s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
    color: transparent !important;
    pointer-events: none !important;
    border-radius: var(--radius-xs) !important;
    user-select: none !important;
}

/* ==========================================================================
   Adjuster Appraisal Modal (On-Screen & PDF View)
   ========================================================================== */

.adjuster-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 7, 13, 0.84);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.adjuster-modal-dialog {
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 920px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px -10px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%), var(--bg-surface-elevated);
    font-family: var(--font-display);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.modal-subtitle {
    font-size: 0.76rem;
    color: var(--accent-primary);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary-small {
    background: linear-gradient(180deg, #34D399 0%, #059669 100%);
    color: #061A12;
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 0.83rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: all 0.15s ease;
}

.btn-primary-small:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-close-modal:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.modal-body {
    padding: 22px;
    overflow-y: auto;
    flex: 1;
}

/* Printable Appraisal Sheet Layout */
.printable-appraisal {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.report-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid var(--border-medium);
    padding-bottom: 12px;
}

.report-logo-text {
    font-size: 1.22rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.report-logo-text span {
    color: var(--accent-primary);
}

.report-regulatory-stamp {
    display: flex;
    flex-direction: column;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.report-claim-meta {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.report-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.report-section-title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 4px;
}

.report-financial-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.rpt-metric-box {
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xs);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rpt-metric-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-tertiary);
}

.rpt-metric-val {
    font-size: 1.06rem;
    font-weight: 700;
    color: var(--text-primary);
}

.report-verdict-statement {
    font-size: 0.85rem;
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    padding: 8px 12px;
    line-height: 1.45;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

.report-table th,
.report-table td {
    border: 1px solid var(--border-medium);
    padding: 6px 10px;
    text-align: left;
}

.report-table th {
    background: var(--bg-surface-elevated);
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.report-clause-box,
.report-caveat-box {
    background: var(--bg-surface-subtle);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xs);
    padding: 8px 12px;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.report-clause-box h4 {
    color: var(--accent-primary);
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.report-signatures {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-medium);
}

.sig-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sig-line {
    border-bottom: 1px solid var(--text-tertiary);
    height: 32px;
    margin-bottom: 6px;
}

.sig-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sig-note {
    font-size: 0.74rem;
    color: var(--text-tertiary);
}

/* ==========================================================================
   Cockpit Footer
   ========================================================================== */

.app-footer {
    border-top: 1px solid var(--border-medium);
    background-color: var(--bg-surface);
    padding: 12px 24px;
    margin-top: auto;
}

.footer-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-tertiary);
    flex-wrap: wrap;
    gap: 8px;
}

.footer-left,
.footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-brand {
    font-weight: 600;
    color: var(--text-secondary);
}

.footer-separator {
    color: var(--text-dim);
}

/* ==========================================================================
   Complete @media print Stylesheet (White-Paper Formal Document)
   ========================================================================== */

@media print {
    @page {
        margin: 15mm;
        size: A4 portrait;
    }

    body.cockpit-root {
        background-color: #FFFFFF !important;
        color: #0F172A !important;
        font-size: 10pt;
    }

    /* Hide on-screen UI components */
    .main-container,
    .app-header,
    .scenario-bar-section,
    .form-section,
    .studio-section,
    .app-footer,
    .modal-header,
    .btn-clear-preview,
    .quick-chips,
    .action-btn-row,
    .layer-toggles,
    .export-row {
        display: none !important;
    }

    /* Modal dialog unstyled for print */
    .adjuster-modal-backdrop {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        background: none !important;
        backdrop-filter: none !important;
        padding: 0 !important;
        display: block !important;
    }

    .adjuster-modal-dialog {
        background: #FFFFFF !important;
        border: none !important;
        box-shadow: none !important;
        max-width: 100% !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .modal-body {
        padding: 0 !important;
        overflow: visible !important;
    }

    .printable-appraisal {
        display: block !important;
        color: #0F172A !important;
    }

    .report-doc-header {
        border-bottom: 2pt solid #0F172A !important;
    }

    .report-logo-text {
        color: #0F172A !important;
    }

    .report-logo-text span {
        color: #047857 !important;
    }

    .report-claim-meta,
    .report-regulatory-stamp {
        color: #334155 !important;
    }

    .report-section {
        margin-top: 14pt !important;
        page-break-inside: avoid;
    }

    .report-section-title {
        color: #0F172A !important;
        border-bottom: 1pt solid #94A3B8 !important;
    }

    .rpt-metric-box {
        background: #F8FAFC !important;
        border: 1pt solid #CBD5E1 !important;
    }

    .rpt-metric-label {
        color: #475569 !important;
    }

    .rpt-metric-val {
        color: #0F172A !important;
    }

    .report-verdict-statement {
        background: #F8FAFC !important;
        border: 1pt solid #CBD5E1 !important;
        color: #0F172A !important;
    }

    .report-table th,
    .report-table td {
        border: 1pt solid #94A3B8 !important;
        color: #0F172A !important;
    }

    .report-table th {
        background: #F1F5F9 !important;
        color: #0F172A !important;
        font-weight: 700 !important;
    }

    .report-clause-box,
    .report-caveat-box {
        background: #F8FAFC !important;
        border: 1pt solid #CBD5E1 !important;
        color: #334155 !important;
    }

    .report-signatures {
        border-top: 1pt solid #64748B !important;
        page-break-inside: avoid;
    }

    .sig-line {
        border-bottom: 1pt solid #0F172A !important;
    }

    .sig-title {
        color: #0F172A !important;
    }

    .sig-note {
        color: #475569 !important;
    }
}

/* ==========================================================================
   Responsive Adaptations (375px to 1440px+)
   ========================================================================== */

@media (max-width: 1100px) {
    .console-grid {
        grid-template-columns: 1fr;
    }
    .studio-grid {
        grid-template-columns: 1fr;
    }
    .report-financial-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 10px 16px;
        gap: 8px;
    }
    .header-telemetry-cluster {
        display: none;
    }
    .brand-subtitle {
        display: none;
    }
    .tab-kbd-hint {
        display: none;
    }
    .scenario-segmented-control {
        grid-template-columns: 1fr;
    }
    .controls-row {
        grid-template-columns: 1fr;
    }
    .triage-banner {
        flex-direction: column;
        align-items: flex-start;
    }
    .triage-banner-right {
        align-self: center;
        margin-top: 10px;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .export-row {
        flex-direction: column;
    }
    .report-signatures {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 10px 12px 24px;
    }
    .scenario-bar-section {
        padding: 10px 10px;
    }
    .form-section {
        padding: 12px 12px;
    }
    .report-financial-grid {
        grid-template-columns: 1fr;
    }
    .footer-container {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    body:not(.has-analysis) .adjuster-modal-backdrop { display: none !important; }
}

.table-row-item:focus-visible { outline: 2px solid #38BDF8; outline-offset: -2px; }

/* ==========================================================================
   Landing sequence: preloader, pinned lens hero, project and motivation.
   Instrument light and tight display tracking referenced from
   chirudevareddy.com; beam field and spotlight surfaces adapted from
   KokonutUI patterns. Built on the cockpit tokens above.
   ========================================================================== */

:root {
    /* Instrument glow. Sits between the cockpit emerald and cyan, and is used
       only for the glass, never for interface controls. */
    --glow: #2DD4BF;
    --glow-soft: rgba(45, 212, 191, 0.5);
}

/* --- Preloader: a measuring scale, not a progress bar -------------------- */

.preloader {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    background-color: var(--bg-base);
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.preloader[data-done="true"] { opacity: 0; visibility: hidden; }

.preloader-inner {
    display: grid;
    gap: 18px;
    width: min(420px, 84vw);
}

.preloader-label {
    font-size: 0.74rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.preloader-scale {
    position: relative;
    height: 34px;
}

.preloader-ticks {
    position: absolute;
    inset: auto 0 0 0;
    height: 22px;
    background-repeat: repeat-x;
    background-position: left bottom, left bottom;
    /* Minor ticks every 9px, major every 45px. Vertical rules, so the
       gradient has to vary along X. */
    background-image:
        repeating-linear-gradient(to right, rgba(148, 163, 184, 0.34) 0 1px, transparent 1px 9px),
        repeating-linear-gradient(to right, rgba(148, 163, 184, 0.5) 0 1px, transparent 1px 45px);
    background-size: 100% 9px, 100% 20px;
}

/* Second copy of the same scale, clipped to progress. */
.preloader-ticks-lit {
    width: 0%;
    overflow: hidden;
    background-image:
        repeating-linear-gradient(to right, var(--glow) 0 1px, transparent 1px 9px),
        repeating-linear-gradient(to right, #5EF5E0 0 1px, transparent 1px 45px);
    transition: width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    filter: drop-shadow(0 0 5px var(--glow-soft));
}

.preloader-reticle {
    position: absolute;
    left: 0;
    bottom: 2px;
    color: var(--glow);
    transform: translate(-50%, 0);
    transition: left 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    filter: drop-shadow(0 0 6px var(--glow-soft));
}

.preloader-readout {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.preloader-pct {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* --- Hero stage --------------------------------------------------------- */

.hero {
    position: relative;
    z-index: 5;
    height: 100dvh;
    display: flex;
    align-items: center;
    /* The glass sits above the cover now, so the section does the clipping. */
    overflow: clip;
    background-color: transparent;
}

/* The opaque cover the aperture cuts through. It holds only flat decoration,
   so the mask animation repaints a cheap layer. */
.hero-curtain {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    isolation: isolate;
    contain: layout paint;
    background-color: var(--bg-base);
}

.hero-curtain.is-sequenced {
    --hole: 0px;
    mask-image: radial-gradient(circle at 50% 50%, transparent var(--hole), #000 calc(var(--hole) + 2px));
    -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent var(--hole), #000 calc(var(--hole) + 2px));
}

.hero-veil {
    position: absolute;
    inset: 0;
    background: url("../assets/case_b.jpg") center/cover no-repeat;
    filter: blur(11px) grayscale(0.9) brightness(0.42);
    opacity: 0.14;
    /* Promoted so the blur is rasterised once instead of with every repaint
       of the cover it sits in. */
    transform: scale(1.08) translateZ(0);
}

.hero-beams {
    position: absolute;
    inset: -20%;
    overflow: hidden;
    pointer-events: none;
    contain: paint;
}

/* Soft on both axes by gradient alone. A blur filter on the container would
   be recomputed across the whole viewport on every frame the beams move. */
.hero-beams i {
    position: absolute;
    top: -60%;
    height: 220%;
    width: clamp(220px, 26vw, 460px);
    will-change: transform;
    background:
        linear-gradient(to right,
            transparent 0%,
            color-mix(in srgb, var(--beam-color) 40%, transparent) 28%,
            var(--beam-color) 50%,
            color-mix(in srgb, var(--beam-color) 40%, transparent) 72%,
            transparent 100%),
        linear-gradient(to bottom,
            transparent 0%,
            rgba(0, 0, 0, 0) 14%,
            rgba(0, 0, 0, 0) 86%,
            transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 78%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 22%, #000 78%, transparent 100%);
    animation: beam-drift var(--beam-dur) linear infinite,
               beam-pulse calc(var(--beam-dur) / 3.7) ease-in-out infinite;
}

.hero-beams i:nth-child(1) { left: 4%;  --beam-color: rgba(45, 212, 191, 0.16); --beam-dur: 26s; animation-delay: 0s, -3s; }
.hero-beams i:nth-child(2) { left: 38%; --beam-color: rgba(16, 185, 129, 0.16); --beam-dur: 34s; animation-delay: -9s, -1s; }
.hero-beams i:nth-child(3) { left: 74%; --beam-color: rgba(45, 212, 191, 0.11); --beam-dur: 44s; animation-delay: -17s, -6s; }

@keyframes beam-drift {
    from { transform: rotate(-35deg) translateY(35%); }
    to   { transform: rotate(-35deg) translateY(-45%); }
}

@keyframes beam-pulse {
    0%, 100% { opacity: 0.72; }
    50%      { opacity: 1; }
}

.hero-rules {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, var(--border-subtle) 1px, transparent 1px),
        linear-gradient(to bottom, var(--border-subtle) 1px, transparent 1px);
    background-size: 104px 104px;
    mask-image: radial-gradient(ellipse 70% 66% at 62% 50%, #000 12%, transparent 76%);
    -webkit-mask-image: radial-gradient(ellipse 70% 66% at 62% 50%, #000 12%, transparent 76%);
    opacity: 0.75;
}

.hero-inner {
    position: relative;
    z-index: 2;
    align-self: center;
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: 0 clamp(24px, 4vw, 64px);
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
    align-items: center;
    gap: clamp(24px, 3vw, 56px);
}

/* --- Copy column -------------------------------------------------------- */

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 3.9vw, 3.5rem);
    line-height: 1.05;
    letter-spacing: -0.042em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.hero-line { display: block; overflow: hidden; }
.hero-line + .hero-line { color: var(--text-secondary); }
.hero-line > span { display: block; }

.hero-sub {
    font-size: clamp(0.96rem, 1.1vw, 1.08rem);
    line-height: 1.65;
    color: var(--text-secondary);
    max-width: 44ch;
    margin-bottom: 32px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    white-space: nowrap;
    padding: 13px 22px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.94rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.22s ease,
                border-color 0.22s ease,
                color 0.22s ease;
}

.hero-btn-primary {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #04140E;
    box-shadow: 0 0 20px -2px rgba(16, 185, 129, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.hero-btn-primary:hover {
    background: linear-gradient(135deg, #34D399 0%, #059669 100%);
    box-shadow: 0 0 28px -2px rgba(16, 185, 129, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
}

.hero-btn-primary svg { transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1); }
.hero-btn-primary:hover svg { transform: translateX(3px); }

.hero-btn-ghost {
    background-color: rgba(14, 21, 36, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: var(--border-medium);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hero-btn-ghost:hover {
    background-color: rgba(21, 32, 52, 0.95);
    border-color: rgba(16, 185, 129, 0.4);
    color: var(--accent-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px -2px rgba(16, 185, 129, 0.25);
    transform: translateY(-1px);
}

.hero-btn:active { transform: scale(0.98); }
.hero-btn:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 3px; }

/* --- The instrument ----------------------------------------------------- */

.hero-stage {
    display: flex;
    justify-content: center;
    align-items: center;
}

.lens {
    --lens-size: min(70vh, 40vw, 620px);
    --u: calc(var(--lens-size) / 100);   /* 1u = 1% of the lens, keeps the assembly proportional */
    position: relative;
    width: var(--lens-size);
    height: var(--lens-size);
    will-change: transform;
}

.lens-body { position: absolute; inset: 0; }

.lens-body::after {
    content: "";
    position: absolute;
    inset: -6%;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: 0 0 calc(22 * var(--u)) calc(2 * var(--u)) rgba(45, 212, 191, 0.14);
}

/* Machined ring: a conic metal gradient with its middle masked out. */
.lens-rim {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
    background: conic-gradient(from 200deg,
        #05080B 0deg, #58646F 22deg, #0A0E13 58deg, #1C232B 100deg,
        #93A0AC 148deg, #0F141A 192deg, #3B4650 240deg, #06090D 290deg,
        #6B7784 328deg, #05080B 360deg);
    z-index: 3;
    mask-image: radial-gradient(circle calc(50 * var(--u)) at 50% 50%,
        transparent calc(46.4 * var(--u)), #000 calc(46.4 * var(--u) + 1px));
    -webkit-mask-image: radial-gradient(circle calc(50 * var(--u)) at 50% 50%,
        transparent calc(46.4 * var(--u)), #000 calc(46.4 * var(--u) + 1px));
    box-shadow:
        0 calc(3 * var(--u)) calc(9 * var(--u)) rgba(0, 0, 0, 0.66),
        inset 0 0 calc(2 * var(--u)) rgba(255, 255, 255, 0.16);
}

.lens-rim::after {
    content: "";
    position: absolute;
    inset: calc(3.6 * var(--u));
    border-radius: 50%;
    pointer-events: none;
    box-shadow:
        inset 0 0 0 calc(0.5 * var(--u)) rgba(94, 245, 224, 0.92),
        inset 0 0 calc(7 * var(--u)) calc(0.6 * var(--u)) rgba(45, 212, 191, 0.45),
        0 0 calc(9 * var(--u)) calc(0.4 * var(--u)) rgba(45, 212, 191, 0.34);
}

.lens-glass {
    position: absolute;
    z-index: 1;
    inset: calc(3.6 * var(--u));
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--bg-base);
    box-shadow:
        0 0 0 calc(0.5 * var(--u)) rgba(45, 212, 191, 0.9),
        0 0 calc(6 * var(--u)) calc(0.6 * var(--u)) rgba(45, 212, 191, 0.42),
        inset 0 0 calc(14 * var(--u)) rgba(45, 212, 191, 0.24),
        inset 0 calc(2 * var(--u)) calc(10 * var(--u)) rgba(226, 232, 240, 0.12);
}

.lens-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 48% 46%;
    transform: scale(1.8);
    filter: saturate(0.32) contrast(1.34) brightness(0.36);
}

.lens-tint {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 42%, transparent 30%, rgba(2, 9, 11, 0.9) 100%),
        linear-gradient(150deg, rgba(45, 212, 191, 0.16), rgba(4, 32, 31, 0.5));
}

.lens-annotations { position: absolute; inset: 0; width: 100%; height: 100%; }

.lens-poly {
    fill: rgba(45, 212, 191, 0.2);
    stroke: #5EF5E0;
    stroke-width: 1.8;
    stroke-linejoin: round;
}

.lens-poly-mesh { fill: url(#lens-mesh); stroke: none; }

/* Cheap bloom: a wider soft stroke behind the hard one. An SVG blur filter
   here would re-rasterise on every frame of the exit zoom. */
.lens-poly-glow {
    fill: none;
    stroke: rgba(94, 245, 224, 0.28);
    stroke-width: 6;
    stroke-linejoin: round;
}

.lens-vertex rect {
    fill: rgba(4, 12, 14, 0.9);
    stroke: var(--glow);
    stroke-width: 1.2;
}

.lens-registration path {
    stroke: rgba(45, 212, 191, 0.55);
    stroke-width: 1.2;
    stroke-linecap: round;
    fill: none;
}

.lens-leader {
    fill: none;
    stroke: rgba(226, 232, 240, 0.55);
    stroke-width: 1;
}

.lens-callout rect {
    fill: rgba(2, 9, 11, 0.86);
    stroke: rgba(94, 245, 224, 0.7);
    stroke-width: 1;
}

.lens-callout text {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    fill: var(--text-primary);
}

.lens-callout-name { fill: var(--glow); }
.lens-callout-score { fill: var(--text-secondary); }

.lens-sweep {
    position: absolute;
    left: -20%;
    right: -20%;
    height: 24%;
    top: -30%;
    background: linear-gradient(to bottom,
        transparent,
        rgba(45, 212, 191, 0.1) 45%,
        rgba(45, 212, 191, 0.22) 50%,
        rgba(45, 212, 191, 0.1) 55%,
        transparent);
    animation: lens-sweep 4.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes lens-sweep {
    0%   { transform: translateY(0); opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { transform: translateY(520%); opacity: 0; }
}

/* Readout, bracketed like an instrument panel. */
.lens-hud {
    position: absolute;
    left: 13%;
    bottom: 18%;
    width: 47%;
    padding: calc(2.4 * var(--u)) calc(2.8 * var(--u));
    display: grid;
    gap: calc(0.9 * var(--u));
    background-color: rgba(3, 10, 12, 0.88);
    box-shadow:
        inset calc(0.4 * var(--u)) 0 0 rgba(45, 212, 191, 0.5),
        inset 0 calc(0.4 * var(--u)) 0 rgba(45, 212, 191, 0.5),
        inset calc(-0.4 * var(--u)) 0 0 rgba(45, 212, 191, 0.5),
        inset 0 calc(-0.4 * var(--u)) 0 rgba(45, 212, 191, 0.5);
}

.lens-hud-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: calc(2 * var(--u));
}

.lens-hud dt {
    font-size: max(9px, calc(2.1 * var(--u)));
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.lens-hud dd {
    white-space: nowrap;
    font-size: max(10px, calc(2.4 * var(--u)));
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.lens-hud-verdict dd {
    color: var(--status-ruby);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lens-hud-bar {
    margin-top: calc(1 * var(--u));
    height: calc(0.8 * var(--u));
    background-color: rgba(148, 163, 184, 0.2);
}

.lens-hud-bar span {
    display: block;
    width: 80.5%;
    height: 100%;
    background-color: var(--glow);
    box-shadow: 0 0 calc(1.6 * var(--u)) var(--glow-soft);
}

.lens-wordmark {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
    font-family: var(--font-display);
    font-size: calc(13 * var(--u));
    font-weight: 700;
    letter-spacing: -0.048em;
    color: var(--text-primary);
    text-shadow: 0 2px calc(4 * var(--u)) rgba(0, 0, 0, 0.9);
}

.lens-wordmark span {
    display: inline-block;
    will-change: transform, opacity, filter;
}

[data-sequence="on"] .lens-wordmark span {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(8px);
}

.lens-wordmark::before {
    content: "";
    position: absolute;
    inset: 30% 6%;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(3, 10, 12, 0.94) 0%, rgba(3, 10, 12, 0.7) 52%, transparent 78%);
}

.lens-shine {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(138deg, rgba(255, 255, 255, 0.26) 0%, rgba(255, 255, 255, 0.07) 22%, transparent 42%),
        radial-gradient(ellipse 130% 56% at 32% 2%, rgba(214, 255, 250, 0.2), transparent 62%);
    mix-blend-mode: screen;
}

/* Neck, collar and handle ride a single 42 degree axis from the lens centre. */
.lens-neck,
.lens-collar,
.lens-handle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: 0 0;
}

.lens-neck {
    width: calc(13 * var(--u));
    height: calc(12 * var(--u));
    transform: rotate(42deg) translate(calc(45 * var(--u)), calc(-6 * var(--u)));
    background: linear-gradient(180deg, #6C7885 0%, #2A323B 46%, #10151B 100%);
    border-radius: calc(1 * var(--u));
}

.lens-collar {
    display: grid;
    place-items: center;
    width: calc(12 * var(--u));
    height: calc(17 * var(--u));
    transform: rotate(42deg) translate(calc(56 * var(--u)), calc(-8.5 * var(--u)));
    border-radius: calc(1.5 * var(--u));
    background: linear-gradient(180deg, #7C8894 0%, #2B333C 44%, #0D1218 100%);
    box-shadow:
        inset 0 0 0 calc(0.35 * var(--u)) rgba(45, 212, 191, 0.75),
        0 0 calc(3 * var(--u)) rgba(45, 212, 191, 0.35);
    color: rgba(226, 232, 240, 0.5);
}

.lens-collar svg { width: calc(6 * var(--u)); height: calc(6 * var(--u)); }

.lens-handle {
    width: calc(42 * var(--u));
    height: calc(19 * var(--u));
    transform: rotate(42deg) translate(calc(68 * var(--u)), calc(-9.5 * var(--u)));
    border-radius: calc(2 * var(--u)) calc(8 * var(--u)) calc(8 * var(--u)) calc(2 * var(--u));
    background:
        linear-gradient(180deg, #59646F 0%, #2C343D 30%, #171D24 62%, #0A0E13 100%);
    box-shadow:
        inset 0 calc(0.4 * var(--u)) 0 rgba(226, 232, 240, 0.24),
        0 calc(2 * var(--u)) calc(7 * var(--u)) rgba(0, 0, 0, 0.6);
}

.lens-handle span {
    position: absolute;
    top: 12%;
    bottom: 12%;
    width: calc(0.5 * var(--u));
    background-color: rgba(0, 0, 0, 0.4);
    box-shadow: calc(0.5 * var(--u)) 0 0 rgba(226, 232, 240, 0.08);
}

.lens-handle span:nth-child(1) { left: 26%; }
.lens-handle span:nth-child(2) { left: 34%; }

/* While the glass zooms past the viewport its blurred shadows would be
   re-rasterised at up to eight times their size every frame. The hard rings
   carry the look on their own. */
.lens.is-exiting .lens-rim {
    box-shadow: none;
}

.lens.is-exiting .lens-rim::after {
    box-shadow: inset 0 0 0 calc(0.5 * var(--u)) rgba(94, 245, 224, 0.92);
}

.lens.is-exiting .lens-glass {
    /* Hard ring, no blur: keeps the lit edge through the zoom for free. */
    box-shadow: 0 0 0 calc(0.4 * var(--u)) rgba(94, 245, 224, 0.9);
    background-color: transparent;
}

.lens.is-exiting .lens-handle,
.lens.is-exiting .lens-collar {
    box-shadow: none;
}

.lens.is-exiting .lens-body::after,
.lens.is-exiting .lens-shine,
.lens.is-exiting .lens-tint {
    display: none;
}

/* --- Entrance: CSS only, so the hero survives a failed module load ------- */

.hero-line > span {
    opacity: 0;
    animation: hero-rise 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: calc(var(--i, 0) * 0.09s + 0.25s);
}

.hero-sub,
.hero-actions {
    opacity: 0;
    animation: hero-fade 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-sub     { animation-delay: 0.5s; }
.hero-actions { animation-delay: 0.62s; }

@keyframes hero-rise {
    from { opacity: 0; transform: translateY(105%); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes hero-fade {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

[data-motion="on"] .reveal-on-scroll,
[data-motion="on"] .reveal-group > * { opacity: 0; }

/* The header wordmark would give away the reveal, so it arrives after it. */
[data-sequence="on"] .app-header {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

[data-sequence="on"][data-revealed="true"] .app-header {
    opacity: 1;
    pointer-events: auto;
}

#project,
#motivation,
#cockpit {
    scroll-margin-top: 88px;
}

.hero-runway { display: none; }

/* The sequence scrolls the page behind the glass; this is the distance it
   travels between the hero and the first content section. */
[data-sequence="on"] .hero-runway {
    display: block;
    height: 90vh;
}

/* --- Story sections ----------------------------------------------------- */

.story {
    position: relative;
    z-index: 1;
    padding: clamp(72px, 11vh, 128px) 24px;
    background-color: var(--bg-base);
}

.story-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.story-heading {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3.4vw, 2.9rem);
    line-height: 1.1;
    letter-spacing: -0.035em;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 22ch;
}

.story-lede {
    margin-top: 18px;
    max-width: 62ch;
    font-size: clamp(1.02rem, 1.15vw, 1.16rem);
    line-height: 1.65;
    color: var(--text-secondary);
}

.stage-grid {
    list-style: none;
    margin-top: clamp(36px, 6vh, 64px);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.stage-cell {
    position: relative;
    overflow: hidden;
    padding: 24px;
    border: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.stage-cell-wide {
    grid-column: 1 / -1;
    background:
        radial-gradient(ellipse 60% 120% at 88% 10%, rgba(16, 185, 129, 0.14), transparent 62%),
        var(--bg-surface);
}

@media (min-width: 901px) {
    .stage-cell-wide {
        display: grid;
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
        align-items: center;
        column-gap: 32px;
    }

    .stage-cell-wide .stage-verb { grid-column: 1; }
    .stage-cell-wide h3 { grid-column: 1; }
    .stage-cell-wide > p:not(.stage-verb):not(.stage-metric) { grid-column: 1; }

    .stage-cell-wide .stage-metric {
        grid-column: 2;
        grid-row: 1 / -1;
        margin-top: 0;
        justify-self: end;
        text-align: right;
        font-size: 1.05rem;
    }
}

.stage-grid:has(.stage-cell:hover) .stage-cell { opacity: 0.62; }

/* Stage 01 (Gate): Asymmetric wide bento cell + mechanical radar/scanner sweep */
.stage-cell:nth-child(1) {
    border-radius: 24px 6px 18px 6px;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s ease, box-shadow 0.4s ease;
}
.stage-cell:nth-child(1):hover {
    opacity: 1;
    transform: translateY(-3px);
    border-color: rgba(16, 185, 129, 0.6);
    box-shadow: 0 10px 30px -4px rgba(0, 0, 0, 0.45), 0 0 16px -2px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.stage-cell:nth-child(1)::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(16, 185, 129, 0.08) 60%, rgba(6, 182, 212, 0.18) 85%, transparent 100%);
    border-right: 2px solid rgba(16, 185, 129, 0.65);
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.stage-cell:nth-child(1):hover::before {
    opacity: 1;
    animation: stage-radar-sweep 1.8s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
@keyframes stage-radar-sweep {
    0% { transform: translateX(0%); }
    100% { transform: translateX(380%); }
}

/* Stage 02 (Segment): Asymmetric geometry + spring lift with cyan/emerald dual-glow */
.stage-cell:nth-child(2) {
    border-radius: 8px 24px 6px 18px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.stage-cell:nth-child(2):hover {
    opacity: 1;
    transform: translateY(-5px) scale(1.01);
    border-color: rgba(6, 182, 212, 0.65);
    box-shadow: 0 12px 28px -6px rgba(6, 182, 212, 0.35), 0 0 20px -2px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Stage 03 (Associate): Asymmetric geometry + corner morph & leftward pivot */
.stage-cell:nth-child(3) {
    border-radius: 20px 6px 24px 8px;
    transition: transform 0.45s ease, border-radius 0.4s ease, border-color 0.4s ease, box-shadow 0.45s ease;
}
.stage-cell:nth-child(3):hover {
    opacity: 1;
    border-radius: 8px 24px 6px 28px;
    transform: translateY(-3px) perspective(600px) rotateY(-2.5deg);
    border-color: rgba(56, 189, 248, 0.6);
    box-shadow: -4px 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px -2px rgba(56, 189, 248, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Stage 04 (Price): Asymmetric geometry + 45° specular light blade flash */
.stage-cell:nth-child(4) {
    border-radius: 6px 20px 8px 24px;
    transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2), border-color 0.4s ease, box-shadow 0.4s ease;
}
.stage-cell:nth-child(4):hover {
    opacity: 1;
    transform: translateY(-4px) scale(1.008);
    border-color: rgba(245, 158, 11, 0.65);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 18px -2px rgba(245, 158, 11, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.stage-cell:nth-child(4)::before {
    content: "";
    position: absolute;
    top: -60%;
    left: -60%;
    width: 220%;
    height: 220%;
    background: linear-gradient(
        45deg,
        transparent 42%,
        rgba(255, 255, 255, 0.12) 48%,
        rgba(245, 158, 11, 0.28) 50%,
        rgba(255, 255, 255, 0.16) 52%,
        transparent 58%
    );
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    pointer-events: none;
    transition: transform 0.65s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.stage-cell:nth-child(4):hover::before {
    transform: translateX(100%) translateY(100%) rotate(45deg);
}

/* Stage 05 (Decide): Asymmetric geometry + judicial seal depression & radiant ruby/amber border pulse */
.stage-cell:nth-child(5) {
    border-radius: 22px 8px 6px 28px;
    transition: transform 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.35s ease, box-shadow 0.38s ease;
}
.stage-cell:nth-child(5):hover {
    opacity: 1;
    transform: translateY(1px) scale(0.992);
    border-color: rgba(244, 63, 94, 0.7);
    box-shadow: 0 0 26px -2px rgba(244, 63, 94, 0.45), 0 0 14px -1px rgba(245, 158, 11, 0.35), inset 0 2px 4px rgba(0, 0, 0, 0.4);
    animation: judicial-border-pulse 1.8s ease-in-out infinite;
}
@keyframes judicial-border-pulse {
    0%, 100% { border-color: rgba(244, 63, 94, 0.7); box-shadow: 0 0 26px -2px rgba(244, 63, 94, 0.45), 0 0 14px -1px rgba(245, 158, 11, 0.35); }
    50% { border-color: rgba(245, 158, 11, 0.85); box-shadow: 0 0 32px 0px rgba(244, 63, 94, 0.6), 0 0 20px 2px rgba(245, 158, 11, 0.5); }
}

.stage-verb {
    font-size: 0.74rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-primary);
    margin-bottom: 12px;
}

.stage-cell h3 {
    font-size: clamp(1.02rem, 1.4vw, 1.24rem);
    line-height: 1.25;
    letter-spacing: -0.02em;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.stage-cell p:not(.stage-verb):not(.stage-metric) {
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 52ch;
}

.stage-metric {
    margin-top: 18px;
    font-size: 0.88rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.stage-metric span:not([data-count-to]) { color: var(--text-dim); padding: 0 3px; }

.motivation-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
    gap: clamp(32px, 6vw, 80px);
    align-items: start;
}

.motivation-copy p {
    margin-top: 18px;
    max-width: 62ch;
    font-size: clamp(1.02rem, 1.15vw, 1.16rem);
    line-height: 1.7;
    color: var(--text-secondary);
}

.motivation-figure {
    padding: 28px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(16, 185, 129, 0.28);
    background:
        radial-gradient(ellipse 80% 100% at 20% 0%, rgba(16, 185, 129, 0.14), transparent 68%),
        var(--bg-surface);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.motivation-stat {
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 5vw, 3.6rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 24px rgba(16, 185, 129, 0.35);
}

.motivation-figure figcaption {
    margin-top: 14px;
    font-size: 0.94rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 1100px) {
    .motivation-inner { grid-template-columns: minmax(0, 1fr); }
}

/* Below this the hero stacks and the pinned sequence is off, so the section
   scrolls normally instead of clipping a fixed-height column. */
@media (max-width: 900px) {
    .hero {
        height: auto;
        min-height: 100dvh;
        align-items: flex-start;
        padding: clamp(84px, 14vw, 112px) 0 64px;
    }

    .hero-inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 36px;
        padding: 0 clamp(16px, 4vw, 32px);
    }

    .hero-title { font-size: clamp(2rem, 6.4vw, 2.9rem); }
    .hero-sub { max-width: 52ch; }

    .lens {
        --lens-size: min(62vw, 340px);
        margin-inline: auto;
    }

    /* No sequence here, so the glass keeps the detection view and the header
       carries the wordmark. */
    .lens-wordmark { display: none; }
    .lens-hud { width: 58%; left: 11%; }
    .lens-hud dt { white-space: nowrap; }

    .stage-grid { grid-template-columns: minmax(0, 1fr); }
    .stage-cell-wide { grid-column: auto; }
}

@media (max-width: 768px) {
    .hero-btn { flex: 1 1 auto; justify-content: center; }
    .lens { --lens-size: min(72vw, 320px); }
    .story { padding: 56px 16px; }
}

/* Short laptops: keep the whole hero inside the first screen. */
@media (min-width: 901px) and (max-height: 720px) {
    .lens { --lens-size: min(62vh, 34vw, 460px); }
    .hero-title { font-size: clamp(2rem, 3.2vw, 2.7rem); }
    .hero-sub { margin-bottom: 22px; }
}

/* --- 2K / Ultra-wide Resolution (1920px+ and 2560px+) ------------------- */

@media (min-width: 1920px) {
    .header-container,
    .main-container,
    #cockpit,
    .footer-container {
        max-width: clamp(1680px, 86vw, 1920px);
    }

    .hero-inner {
        max-width: clamp(1680px, 88vw, 2000px);
    }

    .story-inner {
        max-width: clamp(1400px, 80vw, 1680px);
    }

    .lens {
        --lens-size: min(72vh, 42vw, 760px);
    }

    .canvas-viewport {
        min-height: 560px;
        max-height: 720px;
    }

    .canvas-wrapper,
    .canvas-base-img {
        max-height: 680px;
    }

    .studio-grid {
        gap: 24px;
    }
}

@media (min-width: 2560px) {
    .header-container,
    .main-container,
    #cockpit,
    .footer-container {
        max-width: clamp(1920px, 85vw, 2200px);
    }

    .hero-inner {
        max-width: clamp(1920px, 86vw, 2300px);
    }

    .story-inner {
        max-width: clamp(1600px, 75vw, 1920px);
    }

    .lens {
        --lens-size: min(72vh, 42vw, 840px);
    }

    .hero-title {
        font-size: clamp(3.2rem, 4.2vw, 5.2rem);
    }

    .story-heading {
        font-size: clamp(2.4rem, 3vw, 3.6rem);
    }

    .motivation-stat {
        font-size: clamp(3.6rem, 5vw, 5.6rem);
    }

    .canvas-viewport {
        min-height: 640px;
        max-height: 840px;
    }

    .canvas-wrapper,
    .canvas-base-img {
        max-height: 800px;
    }

    .kpi-value {
        font-size: 2.2rem;
    }

    .stage-cell {
        padding: 32px;
    }

    .stage-verb {
        font-size: 0.85rem;
    }
}

/* --- Accessibility and print -------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .hero-beams i,
    .lens-sweep {
        animation: none !important;
    }

    .hero-line > span,
    .hero-sub,
    .hero-actions,
    .lens-hud,
    .lens-wordmark,
    .lens-wordmark span,
    .reveal-on-scroll,
    .reveal-group > * {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        filter: none !important;
    }

    .preloader-ticks-lit,
    .preloader-reticle { transition: none !important; }

    [data-sequence="on"] .app-header { opacity: 1; pointer-events: auto; }
}

@media print {
    .preloader,
    .hero,
    .story {
        display: none !important;
    }
}


/* ==========================================================================
   Aliveness layer
   Results arrive in sequence, detections trace themselves, and figures that
   are mid-flight sit on tabular numerals so nothing reflows while they move.
   ========================================================================== */

.enters {
    animation: enter-rise var(--dur-enter) var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * var(--stagger));
}

@keyframes enter-rise {
    from { opacity: 0; transform: translate3d(0, 10px, 0); }
    to   { opacity: 1; transform: none; }
}

/* Row entrances travel a shorter distance: there are more of them, and the
   eye is scanning down a column rather than reading a card. */
tr.table-row-item.enters {
    animation-name: enter-row;
    animation-duration: var(--dur-base);
    animation-delay: calc(var(--i, 0) * 32ms);
}

@keyframes enter-row {
    from { opacity: 0; transform: translate3d(-6px, 0, 0); }
    to   { opacity: 1; transform: none; }
}

.svg-polygon.traces {
    stroke-dasharray: var(--trace);
    animation: trace-outline 620ms var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 90ms);
}

@keyframes trace-outline {
    from { stroke-dashoffset: var(--trace); fill-opacity: 0; }
    to   { stroke-dashoffset: 0; fill-opacity: 1; }
}

/* A figure in flight must not resize its own box. */
.kpi-value,
#gauge-loss-ratio {
    font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
    .enters,
    tr.table-row-item.enters,
    .svg-polygon.traces {
        animation: none !important;
    }

    .svg-polygon.traces {
        stroke-dasharray: none !important;
        stroke-dashoffset: 0 !important;
    }
}
