/* css/dsa.css - Styles for Debt Sustainability Analysis Module */

/* ═══════════════════════════════════════════════════════════════════════════
   DSA PANEL CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-panel {
    padding: 0;
    background: var(--bg-primary, #f8fafc);
    min-height: 100vh;
}

.dsa-wrapper {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color, #e2e8f0);
}

.dsa-title h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}

.dsa-subtitle {
    font-size: var(--font-sm);
    /* 12px */
    color: var(--text-secondary, #64748b);
    margin-left: 0.5rem;
}

.dsa-actions {
    display: flex;
    gap: 0.75rem;
}

.dsa-actions .btn {
    font-size: var(--font-sm);
    /* 12px */
    padding: 6px 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTROLS
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-controls {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    padding: 1.25rem;
    background: var(--bg-secondary, #ffffff);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.dsa-controls .control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dsa-controls label {
    font-size: var(--font-sm);
    /* 12px */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #64748b);
}

.dsa-controls select {
    min-width: 250px;
    padding: 8px 12px;
    font-size: var(--font-base);
    /* 14px */
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dsa-controls select:focus {
    outline: none;
    border-color: var(--primary-color, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#dsa-run-btn {
    padding: 6px 12px;
    font-size: var(--font-sm);
    /* 12px */
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 32px;
    /* Fixed height to match inputs */
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    background: var(--bg-secondary, #ffffff);
    border-radius: 12px;
}

.dsa-loading .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color, #e2e8f0);
    border-top-color: var(--primary-color, #3b82f6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.dsa-loading p {
    margin-top: 1rem;
    color: var(--text-secondary, #64748b);
    font-size: 0.9375rem;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   DATA STATUS BANNER
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-data-status {
    margin-bottom: 1.5rem;
}

.data-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
}

.data-status.good {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.data-status.moderate {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.data-status.limited {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-label {
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

.source-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 400;
}

.source-badge.available {
    background: rgba(16, 185, 129, 0.2);
    color: #059669;
}

.source-badge.unavailable {
    background: rgba(156, 163, 175, 0.2);
    color: #6b7280;
    text-decoration: line-through;
}

.last-data {
    margin-left: auto;
    color: var(--text-secondary, #64748b);
}

/* Results Container */
.dsa-results {
    display: block;
    margin-top: 1.5rem;
}

.dsa-results.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN GRID LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .dsa-grid {
        grid-template-columns: 1fr;
    }
}

.dsa-charts-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dsa-sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-card {
    background: var(--bg-secondary, #ffffff);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.dsa-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-tertiary, #f8fafc);
}

.dsa-card .card-header h3 {
    margin: 0;
    font-size: var(--font-base);
    /* 14px */
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

.dsa-card .card-body {
    padding: 1.25rem;
    min-height: 50px;
}

/* Chart container wrapper - MUST have explicit height for Chart.js */
/* Override the !important from components.css */
.dsa-wrapper .chart-container {
    position: relative !important;
    width: 100% !important;
    height: 300px !important;
    min-height: 200px !important;
}

/* Specific heights for different chart types */
.dsa-wrapper .dsa-card[data-section="debt-trajectory"] .chart-container {
    height: 320px !important;
    min-height: 320px !important;
}

.dsa-wrapper .dsa-card[data-section="decomposition"] .chart-container {
    height: 280px !important;
    min-height: 280px !important;
}

.dsa-wrapper .composition-chart .chart-container {
    width: 160px !important;
    height: 160px !important;
    min-height: unset !important;
}

/* Ensure canvas fills container for bar/line charts */
.dsa-wrapper .chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Composition pie canvases must stay fixed-size — override the rule above */
.dsa-composition-grid .chart-container canvas {
    width: 160px !important;
    height: 160px !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   COLLAPSIBLE SECTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-section-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: flex-end;
}

.dsa-section-controls .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.dsa-collapsible .card-header.clickable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.dsa-collapsible .card-header.clickable:hover {
    background: var(--bg-hover, #f1f5f9);
}

.dsa-collapsible .card-header .header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dsa-collapsible .collapse-icon {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    transition: transform 0.3s ease;
    width: 1rem;
    text-align: center;
}

.dsa-collapsible.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

/* Collapsible content - visible by default */
.dsa-collapsible .collapsible-content {
    overflow: visible;
    opacity: 1;
    max-height: none;
}

/* Only hide when collapsed class is present */
.dsa-collapsible.collapsed .collapsible-content {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Card Toggle Buttons */
.card-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-primary, #e2e8f0);
    padding: 0.25rem;
    border-radius: 6px;
}

.toggle-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 400;
    border: none;
    background: transparent;
    color: var(--text-secondary, #64748b);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover {
    color: var(--text-primary, #1e293b);
}

.toggle-btn.active {
    background: white;
    color: var(--primary-color, #3b82f6);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   COMPOSITION CHARTS
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-composition-grid {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 1.5rem;
    flex-wrap: nowrap;
}

@media (max-width: 768px) {
    .dsa-composition-grid {
        flex-direction: column;
        align-items: center;
    }
}

.composition-chart {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

.composition-chart .chart-container {
    width: 160px !important;
    height: 160px !important;
    position: relative;
}

.composition-chart canvas {
    display: block !important;
}

.composition-chart h4 {
    margin: 0 0 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comp-legend {
    margin-top: 6px;
    font-size: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
}

.comp-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ASSUMPTIONS PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.assumptions-display {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.assumption-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #f1f5f9);
}

.assumption-row:last-child {
    border-bottom: none;
}

.assumption-icon {
    font-size: 1.25rem;
}

.assumption-label {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-secondary, #64748b);
}

.assumption-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RISK HEATMAP
   ═══════════════════════════════════════════════════════════════════════════ */

.heatmap-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.heatmap-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem;
    background: var(--bg-tertiary, #f8fafc);
    border-radius: 6px;
}

.heatmap-icon {
    font-size: 1.125rem;
}

.heatmap-label {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-primary, #1e293b);
}

.heatmap-indicator {
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    border-radius: 4px;
    text-transform: uppercase;
}

.heatmap-detail {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    padding: 0 0.625rem 0.5rem;
    margin-bottom: 0.5rem;
}

/* Overall Risk Box */
.overall-risk-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    border-radius: 8px;
    margin-top: 1rem;
    color: white;
}

.overall-label {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.overall-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REALISM CHECK
   ═══════════════════════════════════════════════════════════════════════════ */

.realism-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.realism-item.realistic {
    background: rgba(16, 185, 129, 0.1);
}

.realism-item.optimistic {
    background: rgba(245, 158, 11, 0.1);
}

.realism-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.realism-content {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary, #1e293b);
}

.realism-detail {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    margin-top: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   KEY METRICS
   ═══════════════════════════════════════════════════════════════════════════ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--bg-tertiary, #f8fafc);
    border-radius: 8px;
}

.metric-icon {
    font-size: 1.5rem;
}

.metric-content {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
}

.metric-sublabel {
    font-size: 0.6875rem;
    color: var(--text-tertiary, #94a3b8);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background: var(--bg-tertiary, #e2e8f0);
    color: var(--text-primary, #1e293b);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color, #cbd5e1);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Removed btn-lg to standardize sizes */
.btn-lg {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn .icon {
    font-size: 1em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════════════ */

.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK THEME SUPPORT
   ═══════════════════════════════════════════════════════════════════════════ */

[data-theme="dark"] .dsa-panel {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border-color: #334155;
}

[data-theme="dark"] .dsa-controls select {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .toggle-btn.active {
    background: var(--bg-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .dsa-wrapper {
        padding: 1rem;
    }

    .dsa-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .dsa-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .dsa-controls select {
        min-width: 100%;
    }

    .dsa-controls .control-group {
        width: 100%;
    }

    #dsa-run-btn {
        width: 100%;
        justify-content: center;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {

    .dsa-controls,
    .dsa-actions,
    .card-toggle,
    #dsa-edit-assumptions {
        display: none !important;
    }

    .dsa-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .dsa-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   STRESS TEST RESULTS
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-stress-results {
    margin-top: 1rem;
}

.stress-tests-card {
    background: var(--card-bg, white);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.stress-tests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.stress-test-item {
    padding: 1rem;
    border-radius: 8px;
    background: var(--bg-secondary, #f8fafc);
    border-left: 4px solid #e2e8f0;
    transition: all 0.2s ease;
}

.stress-test-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stress-test-item.mild {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.stress-test-item.moderate {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

.stress-test-item.severe {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.stress-test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.stress-test-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.stress-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary, #1e293b);
}

.stress-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
}

.stress-test-values {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.end-debt {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}

.vs-baseline {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
}
/* ═══════════════════════════════════════════════════════════════════════════
   HEADER REDESIGN — SVG icons, title icon, label icons
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dsa-title-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dsa-title-icon svg {
    width: 22px;
    height: 22px;
    stroke: white;
}

.btn-svg-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.control-label-icon {
    width: 12px;
    height: 12px;
    vertical-align: middle;
    margin-right: 4px;
    opacity: 0.6;
}

.btn-run-dsa {
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARD HEADER ICONS (colored icon badges)
   ═══════════════════════════════════════════════════════════════════════════ */

.card-header-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-header-icon svg {
    width: 15px;
    height: 15px;
}

.card-icon-blue   { background: rgba(59,130,246,0.12);  color: #3b82f6; }
.card-icon-violet { background: rgba(139,92,246,0.12);  color: #8b5cf6; }
.card-icon-teal   { background: rgba(20,184,166,0.12);  color: #14b8a6; }
.card-icon-orange { background: rgba(249,115,22,0.12);  color: #f97316; }
.card-icon-indigo { background: rgba(99,102,241,0.12);  color: #6366f1; }
.card-icon-slate  { background: rgba(100,116,139,0.12); color: #64748b; }

.card-header-badge {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #64748b;
    background: rgba(100,116,139,0.1);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DSA CHEVRON COLLAPSE ICON (SVG-based)
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-chevron {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease;
    color: #94a3b8;
    flex-shrink: 0;
}

.dsa-chevron svg {
    width: 14px;
    height: 14px;
}

.dsa-collapsible.collapsed .dsa-chevron {
    transform: rotate(-90deg);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEATMAP CARDS (redesigned from heatmap-row)
   ═══════════════════════════════════════════════════════════════════════════ */

.heatmap-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.heatmap-card {
    border-left: 3px solid #e2e8f0;
    border-radius: 0 8px 8px 0;
    background: var(--bg-secondary, #ffffff);
    padding: 0.625rem 0.75rem;
    border-top: 1px solid var(--border-color, #f1f5f9);
    border-right: 1px solid var(--border-color, #f1f5f9);
    border-bottom: 1px solid var(--border-color, #f1f5f9);
    transition: box-shadow 0.15s;
}

.heatmap-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.heatmap-card-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.heatmap-card-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.heatmap-card-icon svg {
    width: 13px;
    height: 13px;
}

.heatmap-card-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    flex: 1;
}

.heatmap-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid;
    letter-spacing: 0.02em;
}

.heatmap-bar-track {
    height: 4px;
    background: var(--border-color, #e2e8f0);
    border-radius: 2px;
    margin-bottom: 0.3rem;
    overflow: hidden;
}

.heatmap-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.heatmap-card-detail {
    font-size: 0.7rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════════════════
   OVERALL RISK PANEL (redesigned)
   ═══════════════════════════════════════════════════════════════════════════ */

.overall-risk-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 2px solid;
    background: var(--bg-secondary, #ffffff);
}

.overall-risk-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.overall-risk-orb {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.overall-risk-orb svg {
    width: 18px;
    height: 18px;
}

.overall-risk-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, #64748b);
}

.overall-risk-value {
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.overall-risk-tally {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;
}

.tally-chip {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

.tally-high { background: rgba(239,68,68,0.1);  color: #ef4444; }
.tally-mod  { background: rgba(245,158,11,0.1); color: #f59e0b; }

/* ═══════════════════════════════════════════════════════════════════════════
   SRDSF 2022 REDESIGN — gauge, zone strip, signal list
   ═══════════════════════════════════════════════════════════════════════════ */

.dsa-srdsf .card-body { padding: 0.75rem 1rem; }

.srdsf-section {
    background: var(--bg-secondary, #f8fafc);
    border-radius: 10px;
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color, #e2e8f0);
}

.srdsf-section-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.srdsf-section-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.srdsf-section-icon svg {
    width: 16px;
    height: 16px;
}

.srdsf-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    line-height: 1.2;
}

.srdsf-section-horizon {
    font-size: 0.6875rem;
    color: var(--text-secondary, #94a3b8);
}

.srdsf-chip {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid;
    flex-shrink: 0;
}

/* Gauge */
.srdsf-gauge-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.srdsf-gauge-svg {
    width: 112px;
    min-width: 112px;
    height: 65px;
}

.srdsf-gauge-legend {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.srdsf-gauge-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.6875rem;
    color: var(--text-secondary, #64748b);
}

.srdsf-gauge-legend-item span {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}

.srdsf-gauge-coverage {
    font-size: 0.65rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 0.25rem;
    font-style: italic;
}

/* Breakdown dropdown */
.srdsf-breakdown {
    margin-top: 0.6rem;
}

.srdsf-breakdown summary {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.srdsf-breakdown summary svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.srdsf-breakdown[open] summary svg {
    transform: rotate(180deg);
}

.srdsf-factor-grid {
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.srdsf-factor-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    color: var(--text-secondary, #64748b);
    font-family: var(--font-mono, monospace);
}

.srdsf-factor-row svg {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
}

/* Zone strip */
.srdsf-zone-strip {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.6rem;
    gap: 2px;
}

.srdsf-zone-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    text-align: center;
    font-size: 0.7rem;
    border-radius: 6px;
}

.srdsf-zone-step strong {
    font-size: 0.75rem;
    display: block;
    margin-bottom: 1px;
}

.srdsf-zone-step span {
    font-size: 0.6rem;
    opacity: 0.85;
}

.srdsf-zone-step.active {
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35);
}

.srdsf-zone-desc {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: center;
}

.srdsf-signal-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.srdsf-signal-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.4;
}

.srdsf-signal-list li svg {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    margin-top: 3px;
}

.srdsf-methodology-note {
    font-size: 0.67rem;
    color: var(--text-muted, #94a3b8);
    border-top: 1px solid var(--border-color, #e2e8f0);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    font-style: italic;
    text-align: center;
}

.srdsf-empty {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    text-align: center;
    padding: 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   METRICS V2 (SVG icon cards)
   ═══════════════════════════════════════════════════════════════════════════ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
}

.metric-card-v2 {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem;
    background: var(--bg-secondary, #ffffff);
    border-radius: 10px;
    border: 1px solid var(--border-color, #f1f5f9);
    transition: box-shadow 0.15s;
}

.metric-card-v2:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,0.07);
}

.metric-icon-v2 {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon-v2 svg {
    width: 17px;
    height: 17px;
}

.metric-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.metric-value-v2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary, #1e293b);
    line-height: 1.1;
}

.metric-label-v2 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

.metric-sublabel-v2 {
    font-size: 0.68rem;
    color: var(--text-secondary, #94a3b8);
}

/* ═══════════════════════════════════════════════════════════════════════════
   REALISM CHECK V2 (SVG-based cards)
   ═══════════════════════════════════════════════════════════════════════════ */

.realism-card {
    border-left: 3px solid;
    border-radius: 0 8px 8px 0;
    padding: 0.625rem 0.75rem;
    margin-bottom: 0.5rem;
    border-top: 1px solid var(--border-color, #f1f5f9);
    border-right: 1px solid var(--border-color, #f1f5f9);
    border-bottom: 1px solid var(--border-color, #f1f5f9);
}

.realism-card-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
}

.realism-card-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.realism-card-icon svg {
    width: 13px;
    height: 13px;
}

.realism-card-label {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    flex: 1;
}

.realism-card-check {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.realism-card-check svg {
    width: 18px;
    height: 18px;
}

.realism-card-comment {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    margin-bottom: 0.3rem;
    line-height: 1.4;
}

.realism-card-values {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.realism-val {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--text-secondary, #64748b);
}

.realism-val-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.realism-empty {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    text-align: center;
    padding: 1rem;
}
