/* ============================================================
   DESIGN SYSTEM — Unified Indigo-Violet Dark Theme
   Arctic Design Studio
   ============================================================ */
:root {
    --bg: #030712;
    --surface: rgba(17, 24, 39, 0.75);
    --surface-hover: rgba(31, 41, 55, 0.85);
    --border: rgba(99, 102, 241, 0.12);
    --border-active: rgba(99, 102, 241, 0.4);
    --text: #f8fafc;
    --dim: #94a3b8;
    --accent: #818cf8;
    --accent-vibrant: #a78bfa;
    --accent-glow: rgba(129, 140, 248, 0.2);
    --blue: #60a5fa;
    --green: #34d399;
    --red: #f87171;
    --yellow: #fbbf24;
    --cyan: #22d3ee;
    --orange: #fb923c;
    --radius: 12px;
    --glass: blur(14px) saturate(1.8);
    --grad-primary: linear-gradient(135deg, #6366f1, #a78bfa);
    --grad-surface: linear-gradient(135deg, rgba(17, 24, 39, 0.8), rgba(30, 41, 59, 0.8));
}

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

@keyframes spin {
    from {
        transform: rotate(0deg)
    }

    to {
        transform: rotate(360deg)
    }
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
}

/* ---- HEADER ---- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 52px;
    background: var(--surface);
    backdrop-filter: var(--glass);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

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

/* ---- TAB NAV ---- */
.tab-nav {
    display: flex;
    gap: 2px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    padding: 3px;
}

.tab-btn {
    padding: 6px 18px;
    border: none;
    background: transparent;
    color: var(--dim);
    font: 500 13px/1 'Inter', sans-serif;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(99, 102, 241, 0.08);
}

.tab-btn.active {
    color: #fff;
    background: var(--accent);
}

/* ---- STATUS PILLS ---- */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-pill.connected {
    background: rgba(52, 211, 153, 0.15);
    color: var(--green);
}

.status-pill.connected::before {
    background: var(--green);
}

.status-pill.disconnected {
    background: rgba(248, 113, 113, 0.15);
    color: var(--red);
}

.status-pill.disconnected::before {
    background: var(--red);
}

/* ---- TAB PANELS ---- */
.tab-content {
    height: calc(100vh - 52px);
    position: relative;
}

.tab-panel {
    display: none;
    height: 100%;
    position: absolute;
    inset: 0;
}

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

/* ---- STUDIO TAB ---- */
#studioPanel {
    flex-direction: row;
}

.design-browser {
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.browser-search {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.browser-search input {
    width: 100%;
    padding: 7px 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font: 13px 'Inter', sans-serif;
    outline: none;
}

.browser-search input:focus {
    border-color: var(--accent);
}

.browser-sort {
    display: flex;
    gap: 2px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

.sort-btn {
    flex: 1;
    padding: 4px 0;
    border: none;
    background: transparent;
    color: var(--dim);
    font: 500 10px/1 'Inter', sans-serif;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.sort-btn:hover {
    color: var(--text);
}

.sort-btn.active {
    color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.design-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.2) transparent;
}

.design-item {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.06);
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.design-item:hover {
    background: var(--surface-hover);
}

.design-item.selected {
    background: rgba(99, 102, 241, 0.12);
    border-left: 3px solid var(--accent);
}

.design-item .rank {
    font-size: 10px;
    color: var(--dim);
    font-weight: 600;
}

.design-item .metrics {
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
}

.design-item .tags {
    font-size: 10px;
    color: var(--dim);
    margin-top: 3px;
}

.design-item .champion-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 14px;
}

/* ---- 3D VIEWER ---- */
.viewer-area {
    flex: 1;
    position: relative;
}

#viewer3d {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#viewer3d:active {
    cursor: grabbing;
}

.render-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: var(--glass);
    z-index: 10;
}

.render-badge.stl {
    background: rgba(52, 211, 153, 0.2);
    color: var(--green);
}

.render-badge.loading {
    background: rgba(96, 165, 250, 0.2);
    color: var(--blue);
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

.render-badge.parametric {
    background: rgba(251, 191, 36, 0.2);
    color: var(--yellow);
}

/* ---- CONTROLS PANEL (left overlay) ---- */
.controls-panel {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: var(--surface);
    backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    width: 220px;
    z-index: 10;
    max-height: calc(100% - 80px);
    overflow-y: auto;
}

.ctrl-section {
    margin-bottom: 12px;
}

.ctrl-section:last-child {
    margin-bottom: 0;
}

.ctrl-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent);
    margin-bottom: 6px;
}

.ctrl-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.ctrl-row label {
    font-size: 11px;
    color: var(--dim);
}

.ctrl-row span {
    font-size: 11px;
    font-weight: 500;
    min-width: 36px;
    text-align: right;
}

.ctrl-row input[type="range"] {
    width: 80px;
    accent-color: var(--accent);
}

.ctrl-row input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ---- SPECS PANEL (right) ---- */
.specs-panel {
    width: 280px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.2) transparent;
}

.spec-section {
    border-bottom: 1px solid var(--border);
}

.spec-header {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.spec-header:hover {
    background: rgba(99, 102, 241, 0.05);
}

.spec-header .chevron {
    transition: transform 0.2s;
    font-size: 10px;
}

.spec-header.collapsed .chevron {
    transform: rotate(-90deg);
}

.spec-body {
    padding: 0 14px 10px;
}

.spec-body.hidden {
    display: none;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 12px;
}

.spec-label {
    color: var(--dim);
}

.spec-val {
    font-weight: 500;
    text-align: right;
}

.spec-val.green {
    color: var(--green);
}

.spec-val.red {
    color: var(--red);
}

.spec-val.accent {
    color: var(--accent);
}

.diag-item {
    font-size: 11px;
    padding: 3px 0;
    border-left: 2px solid;
    padding-left: 8px;
    margin: 3px 0;
}

.diag-item.ok {
    border-color: var(--green);
    color: var(--green);
}

.diag-item.warn {
    border-color: var(--yellow);
    color: var(--yellow);
}

/* ---- DASHBOARD TAB ---- */
#dashboardPanel {
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
    gap: 16px;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    backdrop-filter: var(--glass);
    transition: border-color 0.2s;
}

.kpi-card:hover {
    border-color: var(--border-active);
}

.kpi-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--dim);
    font-weight: 600;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
}

.kpi-sub {
    font-size: 11px;
    color: var(--dim);
    margin-top: 2px;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    backdrop-filter: var(--glass);
}

.chart-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.dash-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

.panel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    backdrop-filter: var(--glass);
}

.panel-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin-bottom: 12px;
}

/* Pareto table */
.pareto-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.pareto-table th {
    text-align: left;
    padding: 6px 8px;
    color: var(--dim);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    font-size: 10px;
    text-transform: uppercase;
}

.pareto-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.06);
}

.pareto-table tr {
    cursor: pointer;
    transition: background 0.15s;
}

.pareto-table tr:hover {
    background: rgba(99, 102, 241, 0.08);
}

.badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
}

.badge-pass {
    background: rgba(52, 211, 153, 0.15);
    color: var(--green);
}

.badge-fail {
    background: rgba(248, 113, 113, 0.15);
    color: var(--red);
}

/* Gemini log */
.audit-entry {
    padding: 8px 0;
    border-bottom: 1px solid rgba(99, 102, 241, 0.06);
    font-size: 11px;
}

.audit-entry .decision {
    font-weight: 600;
}

.audit-entry .decision.approve {
    color: var(--green);
}

.audit-entry .decision.reject {
    color: var(--red);
}

.audit-entry .decision.escalate {
    color: var(--yellow);
}

/* Mission readiness */
.readiness-item {
    margin-bottom: 8px;
}

.readiness-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 3px;
}

.readiness-bar {
    height: 4px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.readiness-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

/* Steering modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    backdrop-filter: var(--glass);
}

.modal h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.modal-field {
    margin-bottom: 12px;
}

.modal-field label {
    font-size: 11px;
    color: var(--dim);
    display: block;
    margin-bottom: 4px;
}

.modal-field input,
.modal-field select {
    width: 100%;
    padding: 8px 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font: 13px 'Inter', sans-serif;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font: 500 12px/1 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: #6366f1;
}

.btn-ghost {
    background: transparent;
    color: var(--dim);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--border-active);
}

/* ---- COMPARE TAB ---- */
#comparePanel {
    flex-direction: column;
}

.compare-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.compare-select {
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font: 12px 'Inter', sans-serif;
    min-width: 260px;
}

.compare-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--dim);
}

.compare-body {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.compare-viewport {
    position: relative;
    border-right: 1px solid var(--border);
}

.compare-viewport:last-child {
    border-right: none;
}

.compare-viewport canvas {
    width: 100%;
    height: 100%;
}

.compare-viewport .viewport-label {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--surface);
    backdrop-filter: var(--glass);
    border: 1px solid var(--border);
}

/* ---- GENOME EDITOR TAB ---- */
#genomePanel {
    flex-direction: row;
}

.genome-sidebar {
    width: 360px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.genome-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.genome-title {
    font-size: 13px;
    font-weight: 700;
}

.genome-gene-count {
    font-size: 10px;
    color: var(--dim);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
}

.genome-sliders {
    flex: 1;
    overflow-y: auto;
    padding: 8px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.2) transparent;
}

.gene-group {
    margin-bottom: 12px;
}

.gene-group-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent);
    margin-bottom: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.gene-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.gene-slider-row label {
    font-size: 10px;
    color: var(--dim);
    width: 100px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gene-slider-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent);
    height: 4px;
}

.gene-slider-row .gene-val {
    font-size: 10px;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
    color: var(--text);
}

.genome-actions {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
}

.genome-results {
    width: 300px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.2) transparent;
}

.genome-result-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
}

.genome-result-card .result-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent);
    margin-bottom: 8px;
}

/* ---- CEM WATERFALL CHART ---- */
.waterfall-container {
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 8px;
}

.waterfall-bar {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    font-size: 11px;
}

.waterfall-bar .bar-label {
    width: 100px;
    color: var(--dim);
    flex-shrink: 0;
}

.waterfall-bar .bar-track {
    flex: 1;
    height: 16px;
    background: rgba(99, 102, 241, 0.06);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.waterfall-bar .bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.waterfall-bar .bar-value {
    min-width: 50px;
    text-align: right;
    font-weight: 600;
    margin-left: 8px;
}

/* ---- CROSS-COUPLING DISPLAY ---- */
.coupling-section {
    padding: 10px;
    border-top: 1px solid var(--border);
}

.coupling-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--cyan);
    margin-bottom: 6px;
}

.coupling-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
    font-size: 11px;
}

.coupling-row .coupling-label {
    color: var(--dim);
}

.coupling-row .coupling-value {
    font-weight: 500;
    color: var(--text);
}

.coupling-arrow {
    color: var(--accent);
    font-size: 10px;
    margin: 0 4px;
}

/* ═══════════════════════════════════════════════════════════════
   PREMIUM ANIMATIONS & MICRO-INTERACTIONS
   ═══════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(129, 140, 248, 0);
    }

    50% {
        box-shadow: 0 0 20px 4px rgba(129, 140, 248, 0.15);
    }
}

@keyframes progress-grow {
    from {
        width: 0;
    }
}

@keyframes count-up {
    from {
        opacity: 0.5;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Entry animation for panels */
.tab-panel.active {
    animation: fadeIn 0.3s ease-out;
}

/* Card hover lift */
.kpi-card,
.panel-card,
.chart-card,
.genome-result-card {
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.kpi-card:hover,
.panel-card:hover,
.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: var(--border-active);
}

/* Design item hover glow */
.design-item:hover {
    background: var(--surface-hover);
    box-shadow: inset 3px 0 0 var(--accent);
}

/* KPI value animated counter */
.kpi-value[data-updated] {
    animation: count-up 0.3s ease-out;
}

/* ---- HERO KPI CARDS (gradient accent) ---- */
.kpi-card.hero {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(14, 165, 233, 0.08) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    position: relative;
    overflow: hidden;
}

.kpi-card.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.04), transparent);
    animation: shimmer 4s ease-in-out infinite;
}

/* ---- ANIMATED READINESS BARS ---- */
.readiness-fill {
    animation: progress-grow 0.8s ease-out;
}

.readiness-bar {
    position: relative;
}

.readiness-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.05) 50%, transparent 100%);
    animation: shimmer 3s ease-in-out infinite;
    pointer-events: none;
}

/* ---- CFD CALIBRATION PANEL ---- */
.cfd-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    backdrop-filter: var(--glass);
    animation: slideUp 0.4s ease-out;
}

.cfd-grade-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cfd-grade-badge.excellent {
    background: rgba(52, 211, 153, 0.15);
    color: var(--green);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.cfd-grade-badge.good {
    background: rgba(96, 165, 250, 0.15);
    color: var(--blue);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.cfd-grade-badge.acceptable {
    background: rgba(251, 191, 36, 0.15);
    color: var(--yellow);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.cfd-grade-badge.poor {
    background: rgba(248, 113, 113, 0.15);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.correction-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 12px;
}

.correction-row .correction-label {
    color: var(--dim);
}

.correction-row .correction-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.correction-row .correction-value.over {
    color: var(--red);
}

.correction-row .correction-value.under {
    color: var(--yellow);
}

.correction-row .correction-value.neutral {
    color: var(--green);
}

/* ---- SURROGATE HEALTH PANEL ---- */
.surrogate-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    backdrop-filter: var(--glass);
    animation: slideUp 0.5s ease-out;
}

.surrogate-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(129, 140, 248, 0.12);
    color: var(--accent);
    border: 1px solid rgba(129, 140, 248, 0.25);
}

.surrogate-metric {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 11px;
}

.surrogate-metric .metric-label {
    color: var(--dim);
}

.surrogate-metric .metric-value {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ---- SENSITIVITY HEATMAP ---- */
.heatmap-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    backdrop-filter: var(--glass);
    animation: slideUp 0.6s ease-out;
}

.heatmap-canvas {
    width: 100%;
    border-radius: 6px;
    image-rendering: pixelated;
}

/* ---- LIVE PULSE INDICATOR ---- */
.live-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
    animation: pulse-glow 2s infinite;
}

/* ---- WS INDICATOR PULSE (connected state) ---- */
@keyframes ws-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4);
    }

    50% {
        box-shadow: 0 0 6px 3px rgba(52, 211, 153, 0.15);
    }
}

#wsIndicator[style*="--green"] {
    animation: ws-pulse 2s ease-in-out infinite;
}

/* ---- ACTIVE TAB GLOW ---- */
.tab-btn.active {
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
}

/* ---- HERO KPI ANIMATED BORDER ---- */
@keyframes border-glow {

    0%,
    100% {
        border-color: rgba(99, 102, 241, 0.25);
    }

    50% {
        border-color: rgba(129, 140, 248, 0.45);
    }
}

.kpi-card.hero {
    animation: border-glow 3s ease-in-out infinite;
}

/* ---- SCROLLBAR GLOBAL ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.35);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1200px) {
    .chart-grid {
        grid-template-columns: 1fr 1fr;
    }

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

@media (max-width: 900px) {
    .design-browser {
        width: 200px;
    }

    .specs-panel {
        width: 220px;
    }

    .genome-sidebar {
        width: 280px;
    }
}