/**
 * Model Drift Lab — Custom Styles
 *
 * Extends shared/css/main.css with drift-specific components:
 *   - Health gauge (SVG arc)
 *   - Timeline scrubber & playback controls
 *   - Act-section progressive disclosure
 *   - Results panels (performance chart, distributions, heatmap, report card)
 *   - Retrain history & alert threshold controls
 *
 * Dr. Baker's Marketing Analytics Tools
 * Created: 2026-03-12
 */


/* ═══════════════════════════════════════════════════════════════════════════════
   1. HEALTH GAUGE
   ═══════════════════════════════════════════════════════════════════════════════ */

.health-gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    min-height: 200px;
}

.health-gauge-svg {
    width: 220px;
    height: 130px;
}

.health-gauge-label {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
    transition: color 0.4s ease;
}

.health-gauge-sublabel {
    font-size: 0.9rem;
    color: var(--app-muted);
    margin-top: 0.25rem;
}

.gauge-arc-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 16;
    stroke-linecap: round;
}

.gauge-arc-fill {
    fill: none;
    stroke-width: 16;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease, stroke 0.4s ease;
}

.gauge-needle {
    fill: var(--app-text);
    transition: transform 0.6s ease;
    transform-origin: 110px 110px;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   2. TIMELINE SCRUBBER & PLAYBACK
   ═══════════════════════════════════════════════════════════════════════════════ */

.timeline-controls {
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.timeline-month-badge {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--app-text);
    background: var(--app-bg);
    padding: 0.4rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--app-border);
    min-width: 180px;
    text-align: center;
}

.playback-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-playback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--app-accent);
    background: white;
    color: var(--app-accent);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-playback:hover {
    background: var(--app-accent);
    color: white;
}

.btn-playback.playing {
    background: var(--app-accent);
    color: white;
}

.speed-controls {
    display: flex;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

.btn-speed {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    background: white;
    color: var(--app-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-speed:hover {
    border-color: var(--app-accent);
    color: var(--app-accent);
}

.btn-speed.active {
    background: var(--app-accent);
    color: white;
    border-color: var(--app-accent);
}

.timeline-slider-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.timeline-slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #e5e7eb;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--app-accent);
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: grab;
}

.timeline-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--app-accent);
    border: 3px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: grab;
}

.timeline-endpoint {
    font-size: 0.85rem;
    color: var(--app-muted);
    white-space: nowrap;
    min-width: 40px;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   3. ACT SECTIONS
   ═══════════════════════════════════════════════════════════════════════════════ */

.act-section {
    margin-bottom: 2rem;
}

.act-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.act-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.9rem;
    background: var(--app-accent);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.act-narrative {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--app-muted);
    margin-bottom: 1.25rem;
    max-width: 800px;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   4. RESULTS PANELS
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Two-column layout for top-level panels */
.results-duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .results-duo {
        grid-template-columns: 1fr;
    }
}

/* Three-column for feature drift heatmap + report */
.results-trio {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .results-trio {
        grid-template-columns: 1fr;
    }
}

/* Chart containers */
.chart-full-width {
    width: 100%;
    min-height: 350px;
}

.chart-half-width {
    width: 100%;
    min-height: 300px;
}

.chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border: 2px dashed var(--app-border);
    border-radius: 8px;
    color: var(--app-muted);
    font-size: 0.95rem;
    min-height: 300px;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   5. DRIFT REPORT CARD
   ═══════════════════════════════════════════════════════════════════════════════ */

.drift-report-card {
    background: var(--app-card-bg);
    border-radius: 12px;
    border: 1px solid var(--app-border);
    padding: 1.25rem;
}

.report-health-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--app-border);
}

.report-health-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.report-health-text {
    font-size: 1.1rem;
    font-weight: 700;
}

.report-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.report-metric {
    text-align: center;
    padding: 0.6rem;
    background: var(--app-bg);
    border-radius: 8px;
}

.report-metric-value {
    font-size: 1.3rem;
    font-weight: 700;
    display: block;
}

.report-metric-label {
    font-size: 0.75rem;
    color: var(--app-muted);
    display: block;
    margin-top: 0.2rem;
}

.report-recommendation {
    background: #f0f9ff;
    border-left: 3px solid var(--app-accent);
    padding: 0.75rem 1rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.report-recommendation.warning {
    background: #fef3c7;
    border-left-color: var(--app-warning);
}

.report-recommendation.danger {
    background: #fee2e2;
    border-left-color: var(--app-danger);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   6. FEATURE DRIFT TABLE
   ═══════════════════════════════════════════════════════════════════════════════ */

.drift-feature-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.drift-feature-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--app-border);
    font-weight: 600;
    color: var(--app-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.drift-feature-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

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

.psi-bar-cell {
    position: relative;
    min-width: 100px;
}

.psi-bar-bg {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    transform: translateY(-50%);
    height: 10px;
    border-radius: 5px;
    background: #e5e7eb;
    width: calc(100% - 1.5rem);
}

.psi-bar-fill {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    transform: translateY(-50%);
    height: 10px;
    border-radius: 5px;
    transition: width 0.4s ease, background 0.4s ease;
}

.psi-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.psi-badge.green  { background: #16a34a; }
.psi-badge.yellow { background: #f59e0b; }
.psi-badge.red    { background: #dc2626; }


/* ═══════════════════════════════════════════════════════════════════════════════
   7. RETRAIN BUTTON & HISTORY
   ═══════════════════════════════════════════════════════════════════════════════ */

.retrain-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-retrain {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--app-success);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-retrain:hover:not(:disabled) {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

.btn-retrain:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.retrain-count {
    font-size: 0.9rem;
    color: var(--app-muted);
}

.retrain-history-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0 0;
}

.retrain-history-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    color: var(--app-text);
}

.retrain-history-item .retrain-icon {
    font-size: 1.1rem;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   8. ALERT THRESHOLD CONTROLS (Act 5)
   ═══════════════════════════════════════════════════════════════════════════════ */

.alert-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.alert-slider-group {
    flex: 1;
    min-width: 250px;
}

.alert-slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.alert-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #16a34a, #f59e0b, #dc2626);
    border-radius: 3px;
    outline: none;
}

.alert-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--app-accent);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    cursor: pointer;
}

.alert-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--app-accent);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    cursor: pointer;
}

.alert-cost-card {
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.alert-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .alert-summary-grid {
        grid-template-columns: 1fr;
    }
}

.alert-stat {
    text-align: center;
    padding: 0.75rem;
    border-radius: 8px;
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
}

.alert-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.alert-stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--app-muted);
    margin-top: 0.25rem;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   9. WINDOW COMPARISON MODE (Act 3)
   ═══════════════════════════════════════════════════════════════════════════════ */

.window-selector {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.window-group {
    flex: 1;
    min-width: 200px;
}

.window-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.window-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--app-border);
    border-radius: 6px;
    font-size: 0.9rem;
}

.comparison-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .comparison-charts-grid {
        grid-template-columns: 1fr;
    }
}

.comparison-chart-card {
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 0.75rem;
}

.comparison-chart-card h4 {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--app-text);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   9b. DRIFT CONCEPTS SECTION (pre-scenario visual guide)
   ═══════════════════════════════════════════════════════════════════════════════ */

.drift-concepts-section {
    margin-bottom: 2rem;
}

/* ── Drift Type Cards Grid ── */
.drift-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0 2rem;
}

.drift-type-card {
    border: 1px solid var(--app-border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    background: var(--app-card-bg);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.drift-type-card h4 {
    margin: 0;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.drift-type-alias {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--app-muted);
}

.drift-type-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.drift-type-data {
    border-left: 4px solid #3b82f6;
}

.drift-type-concept {
    border-left: 4px solid #f59e0b;
}

.drift-type-desc {
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0;
    color: var(--app-text);
}

.drift-type-visual {
    display: flex;
    justify-content: center;
    padding: 0.6rem 0;
}

.drift-mini-svg {
    width: 100%;
    max-width: 280px;
    height: auto;
}

.drift-type-example {
    font-size: 0.85rem;
    line-height: 1.5;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 6px;
    padding: 0.65rem 0.8rem;
    color: var(--app-muted);
}

.drift-type-concept .drift-type-example {
    background: rgba(245, 158, 11, 0.05);
}

.drift-type-detect {
    font-size: 0.85rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.drift-type-scope-note {
    font-size: 0.8rem;
    color: var(--app-muted);
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--app-border, #e2e8f0);
    font-style: italic;
}

.detect-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    white-space: nowrap;
}

.detect-leading {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}

.detect-lagging {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

/* ── Leading vs Lagging Callout ── */
.leading-lagging-callout {
    border: 2px solid #f59e0b;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    background: rgba(245, 158, 11, 0.04);
    margin-top: 0.5rem;
}

.leading-lagging-title {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
    color: var(--app-text);
}

.leading-lagging-diagram {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.leading-lagging-svg {
    width: 100%;
    max-width: 540px;
    height: auto;
}

.leading-lagging-text {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.indicator-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.indicator-chip {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.indicator-leading {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}

.indicator-lagging {
    background: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
}

.indicator-label {
    font-size: 0.9rem;
    line-height: 1.5;
}

.leading-lagging-bottom {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--app-text);
}

/* ── Chart Indicator Tags (LEADING / LAGGING) ── */
.chart-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 0.4rem;
}

.chart-tag-lagging {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.chart-tag-leading {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

/* ── Zone Labels (inline colored text) ── */
.zone-label {
    font-weight: 600;
    padding: 0 0.15rem;
}

.zone-green  { color: #16a34a; }
.zone-yellow { color: #d97706; }
.zone-red    { color: #dc2626; }
.zone-grey   { color: #94a3b8; }
.zone-blue   { color: #3b82f6; }

/* ── Inline Insight Callout (between charts) ── */
.inline-insight-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    margin: 1rem 0;
}

.insight-icon {
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.insight-text {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--app-text);
}

/* ── PSI "What It Means Here" Scenario Callout ── */
.psi-means-here {
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    background: rgba(59, 130, 246, 0.03);
}

.psi-means-here h5 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    color: var(--app-text);
}

.psi-means-here > p {
    font-size: 0.88rem;
    line-height: 1.55;
    margin: 0 0 0.6rem;
    color: var(--app-text);
}

.psi-means-here ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.psi-means-here li {
    font-size: 0.85rem;
    line-height: 1.55;
    margin-bottom: 0.6rem;
    color: var(--app-muted);
}

.psi-means-here li strong {
    color: var(--app-text);
}

.psi-means-bottom {
    margin-top: 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(59, 130, 246, 0.12);
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--app-text);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   10. SCENARIO SECTION OVERRIDES
   ═══════════════════════════════════════════════════════════════════════════════ */

.scenario-costs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.scenario-variables {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.scenario-variables th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--app-border);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--app-muted);
}

.scenario-variables td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   11. MODE TOGGLE (Explore vs Compare)
   ═══════════════════════════════════════════════════════════════════════════════ */

.mode-toggle-group {
    display: inline-flex;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.mode-button {
    padding: 0.5rem 1.25rem;
    border: none;
    background: white;
    color: var(--app-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}

.mode-button:not(:last-child) {
    border-right: 1px solid var(--app-border);
}

.mode-button.active {
    background: var(--app-accent);
    color: white;
}

.mode-button:hover:not(.active) {
    background: #f0f4ff;
    color: var(--app-accent);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   12. MISC / UTILITY
   ═══════════════════════════════════════════════════════════════════════════════ */

.no-data-card {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--app-muted);
    font-size: 1.1rem;
}

.hidden {
    display: none !important;
}

.sawtooth-diagram {
    text-align: center;
    margin: 1.5rem 0;
}

.sawtooth-diagram svg {
    max-width: 100%;
}

.callout-box {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin: 1rem 0;
    line-height: 1.6;
}

.callout-blue {
    background: #f0f9ff;
    border-left: 4px solid #3b82f6;
}

.callout-amber {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
}

.callout-green {
    background: #dcfce7;
    border-left: 4px solid #22c55e;
}

.callout-red {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

/* Concept grid from Threshold Lab */
.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.guide-section {
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    padding: 1rem;
}

.guide-section h5 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.guide-section p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--app-muted);
    line-height: 1.5;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   NEW: TIMELINE EVENT LOG
   ═══════════════════════════════════════════════════════════════════════════════ */

.event-log {
    background: var(--app-card-bg);
    border: 1px solid var(--app-border);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.event-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-bg);
}

.event-log-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--app-text);
}

.event-log-clear {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--app-muted);
    background: none;
    border: 1px solid var(--app-border);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
}

.event-log-clear:hover {
    color: var(--app-accent);
    border-color: var(--app-accent);
}

.event-log-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 180px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.event-log-placeholder {
    padding: 1rem 1.25rem;
    color: var(--app-muted);
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
}

.event-log-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 0.82rem;
    line-height: 1.45;
    animation: event-flash 1.2s ease-out;
}

.event-log-item:last-child {
    border-bottom: none;
}

.event-log-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
    min-width: 50px;
    text-align: center;
}

.event-log-badge.month-badge {
    background: #e5e7eb;
    color: #374151;
}

.event-log-text {
    color: var(--app-text);
}

.event-log-item.severity-info {
    border-left: 3px solid #3b82f6;
}

.event-log-item.severity-warning {
    border-left: 3px solid #f59e0b;
    background: rgba(245, 158, 11, 0.04);
}

.event-log-item.severity-danger {
    border-left: 3px solid #dc2626;
    background: rgba(220, 38, 38, 0.04);
}

.event-log-item.severity-success {
    border-left: 3px solid #16a34a;
    background: rgba(22, 163, 74, 0.04);
}

@keyframes event-flash {
    0%   { background-color: rgba(59, 130, 246, 0.12); }
    100% { background-color: transparent; }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   NEW: BUSINESS IMPACT COUNTER
   ═══════════════════════════════════════════════════════════════════════════════ */

.impact-counter {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--app-bg);
    border: 1px solid var(--app-border);
    border-radius: 8px;
    text-align: center;
}

.impact-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.impact-icon {
    font-size: 1.3rem;
}

.impact-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.impact-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--app-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.impact-cost {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--app-text);
    transition: color 0.3s ease;
    font-variant-numeric: tabular-nums;
}

.impact-cost.cost-warning {
    color: #f59e0b;
}

.impact-cost.cost-danger {
    color: #dc2626;
}

.impact-detail {
    font-size: 0.78rem;
    color: var(--app-muted);
    margin-top: 0.25rem;
    line-height: 1.4;
}

.impact-cumulative {
    font-size: 0.78rem;
    color: var(--app-muted);
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--app-border);
}

.impact-cumulative strong {
    color: var(--app-text);
    font-variant-numeric: tabular-nums;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   NEW: TIMELINE BADGE HEALTH COLORING
   ═══════════════════════════════════════════════════════════════════════════════ */

.timeline-month-badge.health-green {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.timeline-month-badge.health-yellow {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
    animation: badge-pulse-yellow 1.5s ease-in-out 1;
}

.timeline-month-badge.health-red {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
    animation: badge-pulse-red 1.5s ease-in-out 1;
}

@keyframes badge-pulse-yellow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
    50%      { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.2); }
}

@keyframes badge-pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
    50%      { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.2); }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   NEW: RETRAIN BUTTON PULSE WHEN ACTIVE
   ═══════════════════════════════════════════════════════════════════════════════ */

.btn-retrain:not(:disabled) {
    animation: retrain-glow 2s ease-in-out infinite;
}

@keyframes retrain-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
    50%      { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0.15); }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   NEW: COMPARISON PLACEHOLDER
   ═══════════════════════════════════════════════════════════════════════════════ */

.comparison-placeholder {
    text-align: center;
    color: var(--app-muted);
    font-size: 0.9rem;
    padding: 2rem 1rem;
    margin: 0;
}

/* Reference-line label colours in chart explainer */
.ref-line-f1     { color: #f59e0b; }
.ref-line-acc    { color: #94a3b8; }
.ref-line-never  { color: #ef4444; }
.ref-line-always { color: #22c55e; }

/* Red callout box (for accuracy paradox & warnings) */
.callout-box.callout-red {
    background: rgba(239, 68, 68, 0.08);
    border-left: 4px solid #ef4444;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}

/* Accuracy paradox callout */
.accuracy-paradox {
    animation: paradoxPulse 0.6s ease;
}
.accuracy-paradox.hidden {
    display: none;
}
@keyframes paradoxPulse {
    0%   { opacity: 0; transform: translateY(-4px); }
    100% { opacity: 1; transform: translateY(0); }
}
