/* ════════════════════════════════════════════════════════════════
   🔬 FINANCIAL DEEP DIVE STYLES
   Aligned with Drive design system — No animations
════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   📥 IMPORT BASE STYLES
═══════════════════════════════════════════════════════════════ */
@import url('financial-summary.css');

/* ═══════════════════════════════════════════════════════════════
   🎨 CSS VARIABLE BRIDGE — Maps Drive vars to component vars
═══════════════════════════════════════════════════════════════ */
body.avd-page {
    --text-primary:   var(--avd-text,       #1e293b);
    --text-secondary: var(--avd-text-muted, #475569);
    --text-tertiary:  var(--avd-text-dim,   #94a3b8);
    --card-bg:        var(--avd-card,       #ffffff);
    --border-color:   var(--avd-border,     rgba(0,0,0,0.08));
    --primary:        var(--avd-primary,    #667eea);
}

/* ═══════════════════════════════════════════════════════════════
   📐 LAYOUT OVERRIDES — Drive integration
═══════════════════════════════════════════════════════════════ */
#avDriveContent.fdd-content {
    padding: 26px 28px;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--avd-bg);
}

/* ═══════════════════════════════════════════════════════════════
   ⏳ LOADING SPINNER (static ring — no animation)
═══════════════════════════════════════════════════════════════ */
#loadingState {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.fdd-spinner {
    width: 56px;
    height: 56px;
    border: 3px solid var(--avd-border, rgba(0,0,0,0.08));
    border-top-color: var(--avd-primary, #667eea);
    border-radius: 50%;
    margin-bottom: 24px;
}

#loadingStatus {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   📊 FINANCIAL TABS CONTAINER
═══════════════════════════════════════════════════════════════ */
.financial-tabs-container {
    width: 100%;
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg, 16px);
    box-shadow: var(--avd-shadow, 0 4px 24px rgba(0,0,0,0.06));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}

/* ── Tabs Header ── */
.tabs-header {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    background: var(--avd-input-bg, rgba(0,0,0,0.03));
    border-bottom: 1px solid var(--avd-border);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(102,126,234,0.3) transparent;
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 2px;
    padding: 8px 8px 0;
}

.tabs-header::-webkit-scrollbar { height: 3px; }
.tabs-header::-webkit-scrollbar-track { background: transparent; }
.tabs-header::-webkit-scrollbar-thumb {
    background: rgba(102,126,234,0.3);
    border-radius: 999px;
}

/* ── Tab Buttons ── */
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 10px 18px;
    border: none;
    border-radius: 10px 10px 0 0;
    background: transparent;
    color: var(--avd-text-muted, #64748b);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    border-bottom: 3px solid transparent;
    font-family: 'Inter', -apple-system, sans-serif;
}

.tab-btn i { font-size: 0.95rem; flex-shrink: 0; }
.tab-btn span { display: inline; white-space: nowrap; }

.tab-btn:hover {
    background: rgba(102,126,234,0.06);
    color: var(--avd-primary, #667eea);
}

.tab-btn.active {
    background: var(--avd-card, #ffffff);
    color: var(--avd-primary, #667eea);
    border-bottom: 3px solid var(--avd-primary, #667eea);
}

.tab-btn.active i { color: var(--avd-primary, #667eea); }

/* ── Tabs Content ── */
.tabs-content { flex: 1; min-height: 0; position: relative; }

.tab-panel {
    display: none;
    padding: 28px;
    overflow-y: visible;
    overflow-x: hidden;
    max-height: none;
}

.tab-panel.active { display: block; }

/* Dark mode tabs */
body.avd-page:not(.light-mode) .tabs-header {
    background: rgba(15,23,42,0.6);
    border-bottom-color: rgba(255,255,255,0.07);
}
body.avd-page:not(.light-mode) .tab-btn { color: #94a3b8; }
body.avd-page:not(.light-mode) .tab-btn:hover {
    background: rgba(102,126,234,0.12);
    color: #a5b4fc;
}
body.avd-page:not(.light-mode) .tab-btn.active {
    background: rgba(15,23,42,0.95);
    color: #a5b4fc;
    border-bottom-color: #818cf8;
}

/* ═══════════════════════════════════════════════════════════════
   📋 FINANCIAL STATEMENT TABLES
═══════════════════════════════════════════════════════════════ */
.financial-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 32px;
}

.financial-table thead th {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 16px 20px;
    text-align: left;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.financial-table thead th:last-child { border-right: none; }

.financial-table tbody tr:nth-child(even) {
    background: rgba(241,245,249,0.5);
}

body.avd-page:not(.light-mode) .financial-table tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.03);
}

.financial-table tbody td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--avd-border);
    font-weight: 600;
    color: var(--text-primary);
}

.financial-table tbody td:first-child {
    font-weight: 700;
    color: var(--text-primary);
}

.financial-table tbody td:not(:first-child) {
    text-align: right;
    font-family: 'Courier New', monospace;
}

/* ═══════════════════════════════════════════════════════════════
   🏷 LINE ITEM CATEGORIES
═══════════════════════════════════════════════════════════════ */
.category-header {
    background: linear-gradient(135deg,
        rgba(102,126,234,0.12),
        rgba(118,75,162,0.08)) !important;
    font-weight: 900 !important;
    font-size: 1.05rem !important;
    color: #667eea !important;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.subtotal-row {
    background: rgba(102,126,234,0.07) !important;
    font-weight: 800 !important;
    border-top: 2px solid #667eea !important;
    border-bottom: 2px solid #667eea !important;
}

.total-row {
    background: linear-gradient(135deg,
        rgba(16,185,129,0.12),
        rgba(5,150,105,0.08)) !important;
    font-weight: 900 !important;
    font-size: 1.1rem !important;
    color: #10b981 !important;
    border-top: 3px solid #10b981 !important;
    border-bottom: 3px solid #10b981 !important;
}

/* ═══════════════════════════════════════════════════════════════
   📊 YOY COMPARISON
═══════════════════════════════════════════════════════════════ */
.yoy-comparison-card {
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg, 16px);
    padding: 28px;
    box-shadow: var(--avd-shadow, 0 4px 16px rgba(0,0,0,0.06));
    margin-bottom: 24px;
    border-left: 4px solid #667eea;
}

.yoy-metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--avd-border);
}

.yoy-metric:last-child { border-bottom: none; }

.yoy-label {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.yoy-value {
    display: flex;
    align-items: center;
    gap: 12px;
}

.yoy-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.9rem;
}

.yoy-change.positive {
    background: rgba(16,185,129,0.1);
    color: #10b981;
}

.yoy-change.negative {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}

.yoy-change.neutral {
    background: rgba(100,116,139,0.1);
    color: #64748b;
}

/* ═══════════════════════════════════════════════════════════════
   🎯 YEAR SELECTOR
═══════════════════════════════════════════════════════════════ */
.year-selector-container {
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg, 16px);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--avd-shadow, 0 4px 16px rgba(0,0,0,0.05));
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.year-selector-label {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.year-selector-label i { color: #667eea; font-size: 1.2rem; }

#yearSelect {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--avd-border);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--avd-card, #ffffff);
    cursor: pointer;
    min-width: 200px;
    font-family: 'Inter', -apple-system, sans-serif;
}

#yearSelect:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

body.avd-page:not(.light-mode) #yearSelect {
    background: rgba(30,41,59,0.95);
    border-color: rgba(255,255,255,0.1);
    color: #e2e8f0;
}

/* ═══════════════════════════════════════════════════════════════
   📊 DUPONT ANALYSIS
═══════════════════════════════════════════════════════════════ */
.dupont-container {
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg, 16px);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--avd-shadow, 0 4px 24px rgba(0,0,0,0.06));
}

body.avd-page:not(.light-mode) .dupont-container {
    background: rgba(15,23,42,0.95);
}

.dupont-formula {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 28px;
    background: rgba(102,126,234,0.04);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg, 16px);
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.dupont-component {
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    padding: 18px 24px;
    border-radius: 14px;
    text-align: center;
    min-width: 140px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

body.avd-page:not(.light-mode) .dupont-component {
    background: rgba(30,41,59,0.95);
    border-color: rgba(255,255,255,0.08);
}

.dupont-component-label {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.dupont-component-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #667eea;
}

.dupont-operator {
    font-size: 2rem;
    font-weight: 900;
    color: var(--avd-text-dim, #94a3b8);
}

/* ═══════════════════════════════════════════════════════════════
   💧 WORKING CAPITAL WATERFALL
═══════════════════════════════════════════════════════════════ */
.waterfall-container {
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    border-radius: var(--avd-radius-lg, 16px);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--avd-shadow, 0 4px 24px rgba(0,0,0,0.06));
}

body.avd-page:not(.light-mode) .waterfall-container {
    background: rgba(15,23,42,0.95);
}

/* ═══════════════════════════════════════════════════════════════
   📈 RATIO GRID
═══════════════════════════════════════════════════════════════ */
.ratio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.ratio-card {
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    border-left: 4px solid var(--ratio-color, #667eea);
    padding: 24px;
    border-radius: var(--avd-radius-lg, 16px);
    box-shadow: var(--avd-shadow, 0 2px 12px rgba(0,0,0,0.05));
}

body.avd-page:not(.light-mode) .ratio-card {
    background: rgba(15,23,42,0.95);
}

.ratio-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.ratio-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg,
        var(--ratio-color, #667eea),
        var(--ratio-color-dark, #5568d3));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ratio-icon i { color: white; font-size: 1.2rem; }

.ratio-name {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ratio-value {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1;
}

.ratio-interpretation {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   📊 MULTI-YEAR EVOLUTION CHARTS
═══════════════════════════════════════════════════════════════ */
.evolution-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.evolution-chart-card {
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    padding: 28px;
    border-radius: var(--avd-radius-lg, 16px);
    box-shadow: var(--avd-shadow, 0 2px 12px rgba(0,0,0,0.05));
}

body.avd-page:not(.light-mode) .evolution-chart-card {
    background: rgba(15,23,42,0.95);
}

/* ═══════════════════════════════════════════════════════════════
   🎯 QUALITY OF EARNINGS
═══════════════════════════════════════════════════════════════ */
.quality-score-container {
    background: rgba(16,185,129,0.06);
    border: 1px solid rgba(16,185,129,0.2);
    padding: 32px;
    border-radius: var(--avd-radius-lg, 16px);
    margin-bottom: 24px;
}

.quality-score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.quality-metric {
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    padding: 20px;
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}

body.avd-page:not(.light-mode) .quality-metric {
    background: rgba(15,23,42,0.95);
}

.quality-metric-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.quality-metric-value {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 8px;
}

.quality-metric-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.85rem;
}

.quality-metric-status.high  { background: rgba(16,185,129,0.1);  color: #10b981; }
.quality-metric-status.medium { background: rgba(245,158,11,0.1); color: #f59e0b; }
.quality-metric-status.low   { background: rgba(239,68,68,0.1);   color: #ef4444; }

/* ═══════════════════════════════════════════════════════════════
   📊 ADVANCED METRICS GRID
═══════════════════════════════════════════════════════════════ */
.advanced-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.advanced-metric-card {
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    border-left: 5px solid var(--metric-color, #667eea);
    padding: 24px;
    border-radius: var(--avd-radius-lg, 16px);
    box-shadow: var(--avd-shadow, 0 2px 12px rgba(0,0,0,0.05));
}

body.avd-page:not(.light-mode) .advanced-metric-card {
    background: rgba(15,23,42,0.95);
}

.advanced-metric-card .metric-icon {
    width: 56px;
    height: 56px;
    background: var(--metric-color, #667eea);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: white;
    margin-bottom: 14px;
}

.advanced-metric-card .metric-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.advanced-metric-card .metric-value {
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--metric-color, #667eea);
    line-height: 1.2;
    margin-bottom: 6px;
}

.advanced-metric-card .metric-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   📊 COMPETITOR COMPARISON
═══════════════════════════════════════════════════════════════ */
#competitorProfitabilityChart,
#competitorLeverageChart {
    min-height: 350px !important;
    width: 100% !important;
}

#competitorComparison .highcharts-container { width: 100% !important; }

/* ═══════════════════════════════════════════════════════════════
   🎨 TABLE SCROLL WRAPPER
═══════════════════════════════════════════════════════════════ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--avd-border) transparent;
}

.table-wrapper::-webkit-scrollbar { height: 6px; }
.table-wrapper::-webkit-scrollbar-track { background: transparent; }
.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--avd-border);
    border-radius: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   ℹ KPI INFO BUTTON
═══════════════════════════════════════════════════════════════ */
.kpi-info-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    background: rgba(0,0,0,0.65) !important;
    border: none !important;
    color: white !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 0 0 5px !important;
    cursor: pointer !important;
    outline: none !important;
    box-sizing: border-box !important;
    text-decoration: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   🪟 KPI MODAL
═══════════════════════════════════════════════════════════════ */
.kpi-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
}

.kpi-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.kpi-modal-box {
    background: var(--avd-card, #ffffff);
    border: 1px solid var(--avd-border);
    border-radius: 20px;
    width: 100%;
    max-width: 680px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--avd-shadow-lg, 0 20px 60px rgba(0,0,0,0.2));
}

body.avd-page:not(.light-mode) .kpi-modal-box {
    background: #1a2235;
}

.kpi-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--avd-border);
    position: sticky;
    top: 0;
    background: var(--avd-card, #ffffff);
    z-index: 1;
    border-radius: 20px 20px 0 0;
}

body.avd-page:not(.light-mode) .kpi-modal-header {
    background: #1a2235;
}

.kpi-modal-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-modal-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.kpi-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--avd-input-bg);
    border: 1px solid var(--avd-border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.kpi-modal-body { padding: 20px 28px 28px; }

.kpi-modal-section { margin-bottom: 20px; }

.kpi-modal-section-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.kpi-modal-section-content {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.kpi-modal-formula {
    background: var(--avd-input-bg, rgba(0,0,0,0.03));
    border: 1px solid var(--avd-border);
    border-radius: 10px;
    padding: 14px 18px;
    font-family: 'Courier New', monospace;
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

.kpi-modal-benchmarks { display: flex; flex-direction: column; gap: 8px; }

.kpi-benchmark-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: var(--avd-input-bg, rgba(0,0,0,0.03));
    border-radius: 8px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.kpi-benchmark-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   📋 EARNINGS HISTORY TABLE
═══════════════════════════════════════════════════════════════ */
.earnings-badge {
    font-size: 0.75rem !important;
    padding: 3px 8px !important;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   📱 RESPONSIVE — TABLET (≤ 1200px)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .evolution-charts-grid {
        grid-template-columns: 1fr;
    }

    #competitorComparison [style*="grid-template-columns: repeat(auto-fit, minmax(400px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   📱 RESPONSIVE — MOBILE (≤ 768px)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    #avDriveContent.fdd-content { padding: 14px 16px; }

    /* Tab buttons — icon only */
    .tab-btn { padding: 8px 12px; font-size: 0.8rem; gap: 5px; }
    .tab-btn span { display: none; }
    .tab-panel { padding: 16px; }

    /* Year selector */
    .year-selector-container {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    #yearSelect { width: 100% !important; min-width: auto !important; }

    /* DuPont */
    .dupont-formula {
        display: grid !important;
        grid-template-columns: repeat(5, auto) !important;
        justify-content: center !important;
        gap: 6px !important;
        padding: 20px !important;
    }

    .dupont-component:nth-child(1),
    .dupont-component:nth-child(3),
    .dupont-component:nth-child(5) {
        grid-row: 1 !important;
        min-width: 80px !important;
        max-width: 90px !important;
        padding: 10px 12px !important;
    }

    .dupont-operator:nth-child(2),
    .dupont-operator:nth-child(4) { grid-row: 1 !important; font-size: 1.3rem !important; }
    .dupont-operator:nth-child(6)  { display: none !important; }

    .dupont-component:nth-child(7) {
        grid-column: 1 / -1 !important;
        grid-row: 2 !important;
        max-width: 180px !important;
        margin: 14px auto 0 !important;
    }

    .dupont-component-label { font-size: 0.7rem !important; }
    .dupont-component-value { font-size: 1.3rem !important; }

    /* Ratio grid — 2 columns */
    .ratio-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    .ratio-card { padding: 14px !important; }
    .ratio-icon { width: 38px !important; height: 38px !important; }
    .ratio-value { font-size: 1.6rem !important; }
    .ratio-interpretation { font-size: 0.78rem !important; }

    /* Quality metrics — 2 columns */
    .quality-score-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .quality-metric { padding: 14px !important; }
    .quality-metric-value { font-size: 1.5rem !important; }

    /* Advanced metrics — 2 columns */
    .advanced-metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    .advanced-metric-card { padding: 16px !important; }
    .advanced-metric-card .metric-icon {
        width: 44px !important; height: 44px !important;
        font-size: 1.3rem !important; margin-bottom: 10px !important;
    }
    .advanced-metric-card .metric-value { font-size: 1.6rem !important; }
    .advanced-metric-card .metric-label { font-size: 0.7rem !important; }

    /* Financial tables */
    .financial-table { font-size: 0.82rem; }
    .financial-table thead th,
    .financial-table tbody td { padding: 10px 12px; }

    /* Evolution charts */
    .evolution-charts-grid { grid-template-columns: 1fr !important; }
    .evolution-chart-card  { padding: 18px !important; }

    /* Containers */
    .dupont-container,
    .quality-score-container,
    .waterfall-container { padding: 20px 16px !important; }

    /* KPI modal — bottom sheet */
    .kpi-modal-overlay { align-items: flex-end; padding: 0; }
    .kpi-modal-box {
        max-width: 100%;
        max-height: 88vh;
        border-radius: 20px 20px 0 0;
    }
    .kpi-modal-header { padding: 16px 18px 12px; }
    .kpi-modal-title  { font-size: 1.1rem !important; }
    .kpi-modal-body   { padding: 14px 18px 32px; }

    /* Earnings table */
    .earnings-history-table thead { display: none; }
    .earnings-history-table .earnings-interp-row { display: none; }
    .earnings-history-table td { padding: 8px 6px; font-size: 0.76rem; }
}

/* ═══════════════════════════════════════════════════════════════
   📱 RESPONSIVE — SMALL MOBILE (≤ 480px)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

    .tab-btn { padding: 8px 10px; }

    .dupont-formula { gap: 5px !important; padding: 16px !important; }

    .dupont-component:nth-child(1),
    .dupont-component:nth-child(3),
    .dupont-component:nth-child(5) {
        min-width: 65px !important;
        max-width: 78px !important;
        padding: 8px 10px !important;
    }

    .dupont-component-label { font-size: 0.62rem !important; }
    .dupont-component-value { font-size: 1.1rem !important; }

    .ratio-grid { gap: 8px !important; }
    .ratio-card { padding: 12px !important; }
    .ratio-value { font-size: 1.4rem !important; }

    .quality-metric { padding: 10px !important; }
    .quality-metric-value { font-size: 1.3rem !important; }

    .advanced-metrics-grid { gap: 8px !important; }
    .advanced-metric-card { padding: 12px !important; }
    .advanced-metric-card .metric-value { font-size: 1.4rem !important; }
    .advanced-metric-card .metric-description { display: none !important; }

    #competitorProfitabilityChart,
    #competitorLeverageChart { min-height: 240px !important; }

    .financial-table thead th,
    .financial-table tbody td { padding: 8px 10px; font-size: 0.78rem; }
}