/* ═══════════════════════════════════════════════
   RESULTS — Optimize (parameter tuning)
   ═══════════════════════════════════════════════ */

/* ═══ ASYNC LOADER (sensitivity) ═══ */
.opt-async-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 16px;
    color: var(--ink-3);
    font-size: 13px;
    font-weight: 500;
}
.opt-async-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0,191,179,0.2);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: opt-spin 0.8s linear infinite;
}
@keyframes opt-spin {
    to { transform: rotate(360deg); }
}

/* ═══ PROGRESS INLINE (replaces button during optimization) ═══ */
.opt-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: opt-progress-in 0.3s var(--ease);
}
@keyframes opt-progress-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.opt-progress-bar-wrap {
    width: 260px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}
.opt-progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--teal);
    width: 0%;
    transition: width 0.8s var(--ease, ease);
}
.opt-progress-label {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.55);
    letter-spacing: -0.01em;
}
.opt-progress-time {
    font-family: var(--sans);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    font-weight: 400;
    color: rgba(255,255,255,0.3);
    min-height: 16px;
    transition: color 0.3s var(--ease);
}
.opt-progress-time.overtime {
    color: rgba(0,191,179,0.6);
}

/* ═══ HERO — CTA ═══ */
.opt-hero {
    justify-content: center;
}
.opt-hero-ambient {
    position: absolute;
    top: 28%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 900px;
    height: 900px;
    background: radial-gradient(circle, rgba(0,191,179,0.06) 0%, rgba(0,191,179,0.02) 25%, transparent 60%);
    pointer-events: none;
}

/* ═══ GOAL & METRIC PICKERS ═══ */
.opt-picker-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.25);
    margin-bottom: 10px;
    text-align: center;
}
.opt-goal-picker {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 24px;
}
.opt-obj-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: all 0.25s var(--ease);
    user-select: none;
}
.opt-obj-pill input { display: none; }
.opt-obj-pill:hover {
    color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.08);
}
.opt-obj-pill.active {
    color: #fff;
    background: rgba(0,191,179,0.15);
    border-color: var(--teal);
}

/* ── Metric sub-row (Balanced only) ── */
.opt-metric-row {
    overflow: hidden;
    max-height: 120px;
    opacity: 1;
    transition: max-height 0.4s var(--ease), opacity 0.3s var(--ease), margin 0.4s var(--ease);
    margin-bottom: 28px;
    text-align: center;
}
.opt-metric-row .opt-picker-label {
    margin-bottom: 10px;
}
.opt-metric-row.hidden {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    pointer-events: none;
}
.opt-metric-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.opt-metric-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    transition: all 0.25s var(--ease);
    user-select: none;
    position: relative;
}
.opt-metric-pill input { display: none; }
.opt-metric-pill:hover {
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.06);
}
.opt-metric-pill.active {
    color: #fff;
    background: rgba(0,191,179,0.10);
    border-color: rgba(0,191,179,0.5);
}

/* Tooltip on info icon */
.opt-metric-pill-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: rgba(255,255,255,0.25);
    cursor: help;
}
.opt-metric-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(5,28,44,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.75);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
    z-index: 10;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    pointer-events: none;
}
.opt-metric-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(5,28,44,0.95);
}
.opt-metric-pill-info:hover .opt-metric-tooltip,
.opt-metric-tooltip.show {
    display: block;
    pointer-events: auto;
}

/* ═══ RUN BUTTON ═══ */
.opt-run-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--teal) 0%, #00a89d 100%);
    border: none;
    cursor: pointer;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
    box-shadow: 0 4px 24px rgba(0,191,179,0.25);
}
.opt-run-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,191,179,0.35);
}
.opt-run-btn:active { transform: translateY(0); }
.opt-run-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.opt-run-btn.is-loading { pointer-events: none; }
.opt-run-btn.is-loading svg {
    animation: opt-spin 1.2s linear infinite;
}
@keyframes opt-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ═══ HERO SAFEGUARDS ═══ */
.opt-hero-safeguards {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 28px;
}
.opt-safeguard {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.02em;
}
.opt-safeguard svg { color: rgba(0,191,179,0.5); }

/* ═══ ANSWER HERO — uses .hero from hero.css ═══ */
/* Callout inside params panel */
.opt-hero-callout {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    background: var(--warm);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0;
}
/* ═══ RERUN BUTTON ═══ */
.opt-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
}
.opt-title-row .hero-title { margin-bottom: 12px; }
.opt-rerun-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    border: none;
    cursor: pointer;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}
.opt-rerun-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.opt-rerun-btn:active { transform: translateY(0); }

/* ═══ PNL DISTRIBUTION (What to Expect) ═══ */
.opt-pnl-layout {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 24px;
    align-items: start;
}
.opt-pnl-chart-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 24px 16px;
}
.opt-pnl-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.opt-pnl-chart-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
}
.opt-pnl-chart-legend {
    display: flex;
    gap: 16px;
}
.opt-pnl-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-4);
}
.opt-pnl-legend-swatch {
    width: 14px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}
.opt-pnl-chart { height: 280px; position: relative; }

/* Scenario toggle buttons */
.opt-pnl-scenario-btns {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}
.opt-pnl-scenario-btn {
    padding: 7px 16px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}
.opt-pnl-scenario-btn:hover {
    color: var(--navy);
    border-color: var(--teal);
}
.opt-pnl-scenario-btn.active {
    color: var(--teal);
    background: rgba(0,191,179,0.08);
    border-color: var(--teal);
}

/* RIGHT: Before/After comparison table */
.opt-pnl-table-side {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}
.opt-pnl-table-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
}
.opt-pnl-table-cols {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 0.8fr;
    padding: 10px 20px 8px;
    border-bottom: 1px solid var(--border);
    background: var(--warm);
}
.opt-pnl-table-col {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-4);
    text-align: right;
}
.opt-pnl-table-col:first-child { text-align: left; }
.opt-pnl-table-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 0.8fr;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s var(--ease);
}
.opt-pnl-table-row:last-child { border-bottom: none; }
.opt-pnl-table-row:hover { background: rgba(0,191,179,0.02); }
.opt-pnl-table-metric {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
}
.opt-pnl-table-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-3);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.opt-pnl-table-val.rec {
    font-weight: 800;
    color: var(--navy);
}
.opt-pnl-table-delta {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 100px;
    margin-left: 4px;
    vertical-align: middle;
}
.opt-pnl-table-delta.up { background: var(--green-soft); color: var(--green); }
.opt-pnl-table-delta.down { background: var(--red-soft); color: var(--red); }

/* Insight box */
.opt-pnl-insight {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 18px;
    margin: 0;
    border-top: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-3);
}
.opt-pnl-insight svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--teal);
}
.opt-pnl-insight strong { color: var(--navy); }

/* Equal height for chart + table */
.opt-pnl-layout { align-items: stretch; }
.opt-pnl-chart-card { height: 100%; display: flex; flex-direction: column; }
.opt-pnl-chart { flex: 1; min-height: 240px; }
.opt-pnl-table-side { display: flex; flex-direction: column; }
.opt-pnl-layout {
    margin-top: 24px;
}

/* Cross-objective grid: highlight target column */
.opt-cross-target { background: rgba(0,191,179,0.03); }
.opt-cross-target .bench-metric-name { color: var(--teal); }

/* Equal-width metrics strip for optimizer */
.opt-metrics-strip-equal { display: grid; grid-template-columns: 1fr 1fr; }
.opt-metrics-strip-equal .metric-cell { text-align: center; }

.opt-hero-callout-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(0,191,179,0.10);
    color: var(--teal);
}

/* ═══ OLD ANSWER HERO (kept for backwards compat, will be cleaned) ═══ */
.opt-answer-hero {
    background: var(--warm);
    padding: 80px 0 60px;
}
.opt-answer-inner {
    max-width: var(--content-max-w);
    margin: 0 auto;
    padding: 0 var(--section-px);
    text-align: center;
}
.opt-answer-title {
    font-family: var(--serif);
    font-size: 32px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 32px;
    letter-spacing: -0.02em;
}
.opt-answer-title em { font-style: italic; color: var(--teal); }

/* Single consolidated card */
.opt-answer-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    padding: 32px 36px;
    text-align: left;
    margin: 0 auto 0;
}

/* Callout (first thing in card) */
.opt-answer-callout {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background: var(--warm);
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink-2);
    margin-bottom: 28px;
}
.opt-answer-callout-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(0,191,179,0.10);
    color: var(--teal);
}

/* Section labels inside card */
.opt-answer-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-4);
    margin-bottom: 14px;
}

/* What changed row */
.opt-answer-changes-row {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}
.opt-answer-changes-row .opt-param-changes { margin-top: 0; }
.opt-answer-changes-row .opt-changes-grid {
    margin-bottom: 0;
    justify-content: flex-start;
}
.opt-answer-changes-row .opt-change-pill {
    flex: 0 0 auto;
}

/* KPI row: improvement + overfitting side by side */
.opt-answer-kpi-row {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}
.opt-answer-kpi {
    flex: 1;
    text-align: center;
    padding: 16px 20px;
}
.opt-answer-kpi-divider {
    width: 1px;
    height: 80px;
    background: var(--border);
    flex-shrink: 0;
}
.opt-answer-kpi-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-4);
    margin-bottom: 8px;
}
.opt-answer-kpi-value {
    font-size: 40px;
    font-weight: 900;
    color: var(--navy);
    letter-spacing: -0.03em;
    line-height: 1;
}
.opt-answer-kpi-value.positive { color: var(--green); }
.opt-answer-kpi-value.negative { color: var(--red); }
.opt-answer-kpi-verdict {
    font-size: 12px;
    font-weight: 700;
    color: var(--teal);
    margin-top: 8px;
    padding: 3px 12px;
    border-radius: 100px;
    background: rgba(0,191,179,0.08);
    display: inline-block;
}
.opt-answer-kpi-sub {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-4);
    margin-top: 6px;
}
.opt-answer-risk-bar {
    width: 100%;
    max-width: 140px;
    height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 100px;
    margin: 10px auto 0;
    overflow: hidden;
}
.opt-answer-risk-bar-fill {
    height: 100%;
    border-radius: 100px;
    background: var(--green);
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    width: 0;
}

/* Bench-grid style comparison */
.opt-answer-bench-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}
.opt-answer-bench-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border-top: 2px solid var(--ink);
}
.opt-answer-bench-grid .bench-bars-wrap { height: 100px; }
.opt-bench-delta {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--navy);
}

/* ═══ COMPARISON GRID — matches hero.css pattern ═══ */
/* ═══ COMPARISON — Radar + pills + metric detail ═══ */

/* Radar chart */
.opt-radar-wrap {
    max-width: 420px;
    margin: 0 auto 40px;
}

/* Parameter change pills */
.opt-changes-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-4);
    margin-bottom: 16px;
}
.opt-changes-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 40px;
}
.opt-change-pill {
    background: var(--warm);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 20px;
    min-width: 160px;
    flex: 1 1 160px;
    max-width: 260px;
    transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.opt-change-pill:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--teal);
}
.opt-change-pill-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-4);
    margin-bottom: 8px;
}
.opt-change-pill-values {
    display: flex;
    align-items: center;
    gap: 10px;
}
.opt-change-from {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink-3);
    opacity: 0.6;
}
.opt-change-arrow { color: var(--teal); flex-shrink: 0; }
.opt-change-to {
    font-size: 16px;
    font-weight: 800;
    color: var(--teal);
}
.opt-no-changes {
    text-align: center;
    color: var(--ink-3);
    font-size: 14px;
    padding: 20px 0;
}

/* Metric detail cards */
.opt-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.opt-detail-card {
    background: var(--warm);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 18px;
    text-align: center;
}
.opt-detail-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-4);
    margin-bottom: 10px;
}
.opt-detail-values {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
}
.opt-detail-orig {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-3);
    opacity: 0.5;
}
.opt-detail-rec {
    font-size: 17px;
    font-weight: 800;
    color: var(--navy);
}
.opt-detail-better { color: var(--green) !important; }
.opt-detail-worse { color: var(--red) !important; }
.opt-detail-delta {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 100px;
}
.opt-detail-delta.up { background: var(--green-soft); color: var(--green); }
.opt-detail-delta.down { background: var(--red-soft); color: var(--red); }

/* Delta badge (shared) */
.opt-delta {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 100px;
    margin-left: 0;
    vertical-align: middle;
}
.opt-delta.up { background: var(--green-soft); color: var(--green); }
.opt-delta.down { background: var(--red-soft); color: var(--red); }

/* ═══ SENSITIVITY SECTION — matches spag-section pattern ═══ */
.opt-sensitivity-section {
    padding: 100px 0 80px;
    background: var(--warm);
}
.opt-sensitivity-header {
    max-width: var(--content-max-w);
    margin: 0 auto;
    padding: 0 var(--section-px);
    margin-bottom: 40px;
}
.opt-sensitivity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 20px;
    max-width: var(--content-max-w);
    margin: 0 auto;
    padding: 0 var(--section-px);
}
.opt-sensitivity-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 24px 16px;
    transition: box-shadow 0.3s var(--ease);
}
.opt-sensitivity-card:hover { box-shadow: var(--shadow-sm); }
.opt-sensitivity-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.opt-sensitivity-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.01em;
}
.opt-sensitivity-best {
    font-size: 11px;
    font-weight: 700;
    color: var(--teal);
    background: rgba(0,191,179,0.06);
    padding: 3px 10px;
    border-radius: 100px;
}
.opt-sensitivity-chart {
    height: 240px;
    position: relative;
}

/* ═══ WALK-FORWARD SECTION — matches bench-evo-section ═══ */
.opt-wf-section {
    padding: 100px var(--section-px) 80px;
    background: var(--white);
    max-width: 100%;
}
.opt-wf-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    max-width: var(--content-max-w);
    margin: 0 auto 0;
    gap: 32px;
}
.opt-wf-legend {
    display: flex;
    gap: 20px;
    flex-shrink: 0;
    padding-top: 8px;
}
.opt-wf-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-3);
    white-space: nowrap;
}
.opt-wf-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}
.opt-wf-dot.train { background: var(--navy); }
.opt-wf-dot.val { background: var(--teal); }

.opt-wf-stats {
    display: flex;
    gap: 40px;
    max-width: var(--content-max-w);
    margin: 28px auto 0;
    padding: 20px 28px;
    background: var(--warm);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.opt-wf-stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-4);
    margin-bottom: 4px;
}
.opt-wf-stat-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.02em;
}

.opt-wf-chart {
    max-width: var(--content-max-w);
    margin: 28px auto 0;
    height: 360px;
    position: relative;
}

/* ═══ COMBOS TABLE — matches trade-log pattern ═══ */
.opt-table-wrap {
    overflow-x: auto;
    margin-top: 28px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--white);
}
.opt-combos-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.opt-combos-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-4);
    background: var(--warm);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}
.opt-combos-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--ink-2);
}
.opt-combos-table tr:last-child td { border-bottom: none; }
.opt-combos-table tr:hover td { background: rgba(0,191,179,0.02); }
.opt-combos-table tr.opt-row-recommended td {
    background: rgba(0,191,179,0.04);
    color: var(--navy);
    font-weight: 600;
}
.opt-combos-table .opt-rank-cell {
    font-weight: 800;
    color: var(--navy);
    width: 44px;
    text-align: center;
}
.opt-combos-table .opt-rank-star {
    color: var(--teal);
    font-size: 16px;
}
.opt-combos-table .opt-params-cell {
    font-size: 12px;
    color: var(--ink-3);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Overfitting pills */
.opt-of-pill {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.opt-of-pill.of-low { background: var(--green-soft); color: var(--green); }
.opt-of-pill.of-medium { background: rgba(245,158,11,0.08); color: var(--amber); }
.opt-of-pill.of-high { background: var(--red-soft); color: var(--red); }

/* Score cells coloring */
.opt-score-good { color: var(--green); font-weight: 700; }
.opt-score-ok { color: var(--navy); }
.opt-score-bad { color: var(--red); }

/* ═══ APPLY CTA — matches rob-mini-verdict ═══ */
.opt-apply-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px 32px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s var(--ease);
}
.opt-apply-card:hover { box-shadow: var(--shadow-md); }
.opt-apply-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.opt-apply-card-content { flex: 1; }
.opt-apply-card-title {
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 4px;
}
.opt-apply-card-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink-3);
}
.opt-apply-card-cta { flex-shrink: 0; }
.opt-apply-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
    border: none;
    cursor: pointer;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
    box-shadow: var(--shadow-md);
    white-space: nowrap;
}
.opt-apply-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.opt-apply-btn:active { transform: translateY(0); }
.opt-apply-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ═══ CALIBRATION SECTION ═══ */
/* Train vs Val Summary Card */
.opt-wfe-card {
    background: var(--warm);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px 28px;
    margin-top: 28px;
    margin-bottom: 28px;
}
.opt-wfe-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.opt-wfe-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
}
.opt-wfe-scores {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--ink-3);
}
.opt-wfe-scores strong { color: var(--navy); font-weight: 700; }
.opt-wfe-bar-wrap {
    height: 10px;
    background: rgba(0,0,0,0.06);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 12px;
}
.opt-wfe-bar-fill {
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--teal), #059669);
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    width: 0;
}
.opt-wfe-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.opt-wfe-pct {
    font-size: 32px;
    font-weight: 900;
    color: var(--navy);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.opt-wfe-label {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 100px;
}
.opt-wfe-label.wfe-good { background: var(--green-soft); color: var(--green); }
.opt-wfe-label.wfe-fair { background: rgba(245,158,11,0.10); color: var(--amber); }
.opt-wfe-label.wfe-poor { background: var(--red-soft); color: var(--red); }

/* Scatter in calibration section */
.opt-calib-scatter {
    margin-bottom: 20px;
}
.opt-scatter-desc {
    font-size: 13px;
    color: var(--ink-4);
    line-height: 1.5;
    margin: -8px 0 16px;
}
.opt-calib-scatter .opt-scatter-card {
    max-width: 100%;
}

/* Methodology strip */
.opt-method-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-4);
    letter-spacing: 0.01em;
}
.opt-method-strip span { white-space: nowrap; }
.opt-method-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--ink-4);
    opacity: 0.4;
    flex-shrink: 0;
}

/* ═══ DIAGNOSTIC SECTION — Scatter + Distribution ═══ */
.opt-diagnostic-section {
    padding: 100px 0 80px;
    background: var(--warm);
}
.opt-diagnostic-header {
    max-width: var(--content-max-w);
    margin: 0 auto 40px;
    padding: 0 var(--section-px);
}
.opt-diagnostic-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    max-width: var(--content-max-w);
    margin: 0 auto;
    padding: 0 var(--section-px);
}
.opt-scatter-card,
.opt-distrib-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 24px 16px;
    transition: box-shadow 0.3s var(--ease);
}
.opt-scatter-card:hover,
.opt-distrib-card:hover { box-shadow: var(--shadow-sm); }
.opt-scatter-card-header,
.opt-distrib-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.opt-scatter-card-title,
.opt-distrib-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.01em;
}
.opt-distrib-card-sub {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-4);
    background: var(--warm);
    padding: 3px 10px;
    border-radius: 100px;
}
.opt-scatter-card-legend {
    display: flex;
    gap: 14px;
    align-items: center;
}
.opt-scatter-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-4);
}
.opt-scatter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.opt-scatter-dot.dot-trial { background: rgba(5,28,44,0.35); }
.opt-scatter-dot.dot-rec { background: var(--teal); }
.opt-scatter-line {
    width: 18px;
    height: 2px;
    background: rgba(0,0,0,0.12);
    border-radius: 1px;
}
.opt-scatter-chart { height: 320px; position: relative; }
.opt-distrib-chart { height: 320px; position: relative; }

/* ═══ EMBARGO STRIP ═══ */
.opt-embargo-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: var(--content-max-w);
    margin: 20px auto 0;
    padding: 14px 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 13px;
    color: var(--ink-3);
    line-height: 1.5;
}
.opt-embargo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0,191,179,0.08);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.opt-embargo-text strong { color: var(--navy); font-weight: 700; }

/* ═══ PARAMETER IMPORTANCE ═══ */
.opt-importance-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 28px;
}
.opt-importance-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--warm);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.opt-importance-row:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--teal);
}
.opt-importance-rank {
    font-size: 13px;
    font-weight: 800;
    color: var(--teal);
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}
.opt-importance-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
    min-width: 140px;
    flex-shrink: 0;
}
.opt-importance-bar-wrap {
    flex: 1;
    height: 8px;
    background: rgba(0,0,0,0.04);
    border-radius: 100px;
    overflow: hidden;
}
.opt-importance-bar-fill {
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--teal), #059669);
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    width: 0;
}
.opt-importance-score {
    font-size: 13px;
    font-weight: 800;
    color: var(--navy);
    min-width: 44px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.opt-importance-label {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    min-width: 56px;
    text-align: center;
    flex-shrink: 0;
}
.opt-importance-label.impact-high { background: rgba(0,191,179,0.10); color: var(--teal); }
.opt-importance-label.impact-medium { background: rgba(245,158,11,0.08); color: var(--amber); }
.opt-importance-label.impact-low { background: rgba(0,0,0,0.04); color: var(--ink-4); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
    .opt-detail-grid { grid-template-columns: repeat(2, 1fr); }
    .opt-radar-wrap { max-width: 340px; }
    .opt-change-pill { max-width: none; }
    .opt-goal-picker { gap: 8px; }
    .opt-obj-pill { padding: 8px 14px; font-size: 12px; }
    .opt-metric-picker { gap: 6px; }
    .opt-metric-pill { padding: 6px 12px; font-size: 11px; }
    .opt-sensitivity-grid { grid-template-columns: 1fr; padding: 0 20px; }
    .opt-sensitivity-header { padding: 0 20px; }
    .opt-wf-header { flex-direction: column; gap: 16px; padding: 0 20px; }
    .opt-wf-section { padding-left: 20px; padding-right: 20px; }
    .opt-wf-stats { flex-direction: column; gap: 16px; }
    .opt-wf-chart { height: 280px; }
    .opt-apply-card { flex-direction: column; text-align: center; gap: 16px; }
    .opt-hero-safeguards { flex-direction: column; gap: 10px; align-items: center; }
    .rob-glass-grid[style*="repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
    .opt-answer-card { padding: 24px 20px; }
    .opt-answer-kpi-row { flex-direction: column; }
    .opt-answer-kpi-divider { width: 100%; height: 1px; }
    .opt-answer-kpi-value { font-size: 32px; }
    .opt-answer-title { font-size: 24px; }
    .opt-answer-bench-grid { grid-template-columns: repeat(2, 1fr); }
    .opt-answer-bench-legend { justify-content: center; }
    .opt-pnl-layout { grid-template-columns: 1fr; }
    .opt-pnl-chart { height: 220px; }
    .opt-pnl-chart-header { flex-direction: column; gap: 8px; align-items: flex-start; }
    .opt-pnl-scenario-btns { flex-wrap: wrap; }
    .opt-title-row { flex-direction: column; gap: 12px; }
    .opt-diagnostic-grid { grid-template-columns: 1fr; }
    .opt-diagnostic-header { padding: 0 20px; }
    .opt-diagnostic-grid { padding: 0 20px; }
    .opt-scatter-chart, .opt-distrib-chart { height: 260px; }
    .opt-scatter-card-header { flex-direction: column; gap: 8px; align-items: flex-start; }
    .opt-importance-name { min-width: 100px; }
    .opt-embargo-strip { margin-left: 20px; margin-right: 20px; }
}

/* ── Accessibility: reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
@media (max-width: 480px) {
    .opt-detail-grid { grid-template-columns: 1fr 1fr; }
    .opt-radar-wrap { max-width: 280px; }
    .opt-changes-grid { gap: 8px; }
    .opt-change-pill { min-width: 140px; padding: 10px 14px; }
    .opt-run-btn { padding: 14px 28px; font-size: 14px; }
    .opt-apply-btn { padding: 12px 20px; font-size: 13px; }
    .opt-sensitivity-grid { grid-template-columns: 1fr; }
    .rob-glass-grid[style*="repeat(4"] { grid-template-columns: 1fr !important; }
}
