/* ═══════════════════════════════════════════════════════════════
   Wooden CSR — Executive Intelligence Dashboard
   Design System: Luxury Premium + Wooden.sa Brand Merge
   Font: Noto Sans Arabic (optimized Arabic dashboard readability)
   Palette: Stone/Espresso + Gold accent (WCAG 4.5:1 verified)
   ═══════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────
   DESIGN TOKENS
   ────────────────────────────────────────────────────────── */
:root {
    --sidebar-w: 272px;
    --topbar-h: 68px;

    /* Brand constants */
    --w-espresso: #2c1a14;
    --w-brown: #4c2321;
    --w-gold: #a16207;
    --w-cream: #f1ede1;

    /* Semantic tokens — Light */
    --bg-page: #fafaf9;
    --bg-card: #ffffff;
    --bg-card-alt: #fafaf9;
    --bg-hover: #f5f5f4;
    --bg-muted: #f0ece6;
    --text-1: #1c1917;
    --text-2: #57534e;
    --text-3: #a8a29e;
    --accent: #a16207;
    --accent-hover: #854d0e;
    --accent-subtle: rgba(161, 98, 7, 0.08);
    --green: #16a34a;
    --green-bg: #f0fdf4;
    --gold: #a16207;
    --gold-bg: #fefce8;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --border: #e7e5e4;
    --border-light: #f5f5f4;
    --ring: rgba(161, 98, 7, 0.25);
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-s: 8px;
    --radius-xs: 6px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --grid-color: #f0ece6;
}

/* ── Dark Mode ─────────────────────────────────────────── */
[data-theme="dark"] {
    --bg-page: #0c0a09;
    --bg-card: #1c1917;
    --bg-card-alt: #1c1917;
    --bg-hover: #292524;
    --bg-muted: #292524;
    --text-1: #fafaf9;
    --text-2: #a8a29e;
    --text-3: #78716c;
    --accent: #ca8a04;
    --accent-hover: #a16207;
    --accent-subtle: rgba(202, 138, 4, 0.1);
    --green-bg: #0a1f0f;
    --gold-bg: #1a1505;
    --red-bg: #1f0a0a;
    --border: #292524;
    --border-light: #1c1917;
    --ring: rgba(202, 138, 4, 0.3);
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
    --grid-color: #292524;
}
[data-theme="dark"] .sidebar { background: #0c0a09; }
[data-theme="dark"] .topbar { background: #1c1917; border-bottom-color: #292524; }

/* ──────────────────────────────────────────────────────────
   RESET & BASE
   ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

body {
    font-family: 'Noto Sans Arabic', system-ui, sans-serif;
    background: var(--bg-page);
    color: var(--text-1);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ──────────────────────────────────────────────────────────
   SIDEBAR
   ────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--w-espresso);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0; top: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.25s var(--ease);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-logo-wrap {
    width: 100%;
    max-width: 160px;
    background: var(--w-cream);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 18px;
}
.brand-logo {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(250,250,249,0.45);
    text-decoration: none;
    border-radius: var(--radius-s);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
    cursor: pointer;
}
.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}
.nav-item:hover {
    color: var(--w-cream);
    background: rgba(255,255,255,0.06);
}
.nav-item.active {
    color: #fff;
    background: var(--w-gold);
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-version {
    color: rgba(250,250,249,0.25);
    font-size: 12px;
}

/* ──────────────────────────────────────────────────────────
   MAIN CONTENT
   ────────────────────────────────────────────────────────── */
.main-content {
    margin-right: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    transition: margin-right 0.25s var(--ease);
}

/* ── Top Bar ───────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-2);
    cursor: pointer;
    padding: 8px;
}
.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-1);
}
.topbar-controls {
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    width: 36px; height: 36px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s var(--ease);
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.period-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}
.period-selector label {
    font-size: 13px;
    color: var(--text-3);
    font-weight: 500;
}
.period-selector select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text-1);
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s;
}
.period-selector select:hover,
.period-selector select:focus { border-color: var(--accent); outline: none; }

/* ── Pages ─────────────────────────────────────────────── */
.page-container { padding: 24px 28px 40px; }
.page { display: none; }
.page.active {
    display: block;
    animation: pageIn 0.3s var(--ease);
}
@keyframes pageIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────────────────────
   KPI CARDS
   ────────────────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-grid.small {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s var(--ease);
}
.kpi-card:hover {
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-s);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}
.icon-terracotta { background: #92400e; }
.icon-green      { background: #166534; }
.icon-gold       { background: var(--w-gold); }
.icon-emerald    { background: #047857; }
.icon-red        { background: #b91c1c; }
.icon-brown      { background: #44403c; }

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-1);
    line-height: 1.15;
    letter-spacing: -0.3px;
}
.kpi-label {
    font-size: 13px;
    color: var(--text-3);
    font-weight: 500;
    margin-top: 2px;
}

/* ──────────────────────────────────────────────────────────
   CHART CARDS
   ────────────────────────────────────────────────────────── */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 0;
}
.chart-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
}
.chart-sub {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 400;
    margin-top: 2px;
    line-height: 1.5;
}

.chart-badge {
    font-size: 12px;
    padding: 3px 10px;
    background: var(--bg-muted);
    color: var(--text-3);
    border-radius: 20px;
    font-weight: 600;
}
.chart-badge i { margin-left: 4px; font-size: 10px; }

.chart-body {
    padding: 16px 20px 22px;
    position: relative;
    height: 340px;
}
.chart-body-tall {
    height: 420px;
}

.chart-full { grid-column: 1 / -1; }

/* ──────────────────────────────────────────────────────────
   INTELLIGENCE HUB
   ────────────────────────────────────────────────────────── */

@keyframes ixReveal {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
#page-intelligence.active .ix-panel,
#page-intelligence.active .ix-status-bar,
#page-intelligence.active .ix-dow-card {
    animation: ixReveal 0.4s var(--ease) both;
    animation-delay: var(--ix-delay, 0s);
}

/* Status Bar */
.ix-status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    background: var(--w-espresso);
    color: var(--w-cream);
    --ix-delay: 0s;
}
[data-theme="dark"] .ix-status-bar { background: #0c0a09; border: 1px solid #292524; }

.ix-status-pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
    animation: pulse-glow 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

.ix-status-text {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.6;
    flex: 1;
}
.ix-status-bar .risk-summary {
    display: flex; gap: 8px; align-items: center;
}
.risk-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
}
.risk-badge i { font-size: 10px; }
.risk-badge.critical { background: #dc2626; color: #fff; }
.risk-badge.high     { background: #ea580c; color: #fff; }
.risk-badge.warning  { background: #ca8a04; color: #fff; }
.risk-badge.clear    { background: #16a34a; color: #fff; }

/* Columns */
.ix-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* Panel */
.ix-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.ix-radar::before,
.ix-briefing::before,
.ix-heatmap-panel::before {
    content: '';
    position: absolute;
    top: 0; right: 0; left: 0;
    height: 2px;
}
.ix-radar::before         { background: linear-gradient(90deg, #dc2626, #ea580c, transparent 70%); }
.ix-briefing::before      { background: linear-gradient(90deg, var(--w-gold), #ca8a04, transparent 70%); }
.ix-heatmap-panel::before { background: linear-gradient(90deg, #ea580c, #dc2626, transparent 70%); }

.ix-panel-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.ix-panel-head h2 { font-size: 17px; font-weight: 700; line-height: 1.3; }
.ix-panel-head h3 { font-size: 15px; font-weight: 700; }
.ix-panel-head p  { font-size: 13px; color: var(--text-3); font-weight: 400; margin-top: 1px; }
.ix-panel-head-compact { margin-bottom: 14px; }

/* Panel Icons */
.ix-panel-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-s);
    display: flex; align-items: center; justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
    position: relative;
}
.ix-icon-radar    { background: rgba(220,38,38,0.08); color: #dc2626; overflow: hidden; }
.ix-icon-briefing { background: var(--accent-subtle); color: var(--accent); }
.ix-icon-heatmap  { background: rgba(234,88,12,0.08); color: #ea580c; }
.ix-icon-dow      { background: rgba(22,163,74,0.08); color: #16a34a; }
.ix-icon-low      { background: rgba(220,38,38,0.06); color: #dc2626; }

[data-theme="dark"] .ix-icon-radar    { background: rgba(220,38,38,0.15); }
[data-theme="dark"] .ix-icon-briefing { background: rgba(202,138,4,0.15); }
[data-theme="dark"] .ix-icon-heatmap  { background: rgba(234,88,12,0.15); }

.radar-sweep {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(220,38,38,0.2) 60deg, transparent 120deg);
    animation: radarSpin 3s linear infinite;
}
@keyframes radarSpin { to { transform: rotate(360deg); } }
.ix-icon-radar > i { position: relative; z-index: 1; }

/* ── Risk Alerts ───────────────────────────────────────── */
.risk-alerts { display: flex; flex-direction: column; gap: 8px; }

.alert-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: all 0.2s var(--ease);
    animation: ixReveal 0.3s var(--ease) both;
}
.alert-card:nth-child(1) { animation-delay: 0.1s; }
.alert-card:nth-child(2) { animation-delay: 0.18s; }
.alert-card:nth-child(3) { animation-delay: 0.26s; }
.alert-card:nth-child(4) { animation-delay: 0.34s; }
.alert-card:nth-child(5) { animation-delay: 0.42s; }
.alert-card:nth-child(6) { animation-delay: 0.50s; }

.alert-card:hover { box-shadow: var(--shadow-sm); }

.alert-card.critical { border-right: 3px solid #dc2626; }
.alert-card.high     { border-right: 3px solid #ea580c; }
.alert-card.warning  { border-right: 3px solid #ca8a04; }

.alert-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-s);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 1px;
}
.alert-card.critical .alert-icon { background: #dc2626; color: #fff; }
.alert-card.high .alert-icon     { background: #ea580c; color: #fff; }
.alert-card.warning .alert-icon  { background: #ca8a04; color: #fff; }

.alert-body { flex: 1; min-width: 0; }
.alert-branch { font-size: 14px; font-weight: 700; }
.alert-detail { font-size: 13px; color: var(--text-2); font-weight: 400; margin-top: 1px; }
.alert-rx {
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-xs);
    background: var(--accent-subtle);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    line-height: 1.7;
    border-right: 2px solid var(--accent);
}
.alert-rx i { color: var(--accent); margin-left: 5px; }

.alert-metric {
    font-size: 14px; font-weight: 700;
    white-space: nowrap; flex-shrink: 0;
    padding: 3px 10px;
    border-radius: var(--radius-xs);
    background: var(--bg-muted);
    margin-top: 1px;
}
.alert-card.critical .alert-metric { color: #dc2626; }
.alert-card.high .alert-metric     { color: #ea580c; }
.alert-card.warning .alert-metric  { color: #92400e; }

/* ── CEO Briefing ──────────────────────────────────────── */
.briefing-list { display: flex; flex-direction: column; gap: 6px; }

.briefing-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.8;
    transition: all 0.2s var(--ease);
    animation: ixReveal 0.3s var(--ease) both;
}
.briefing-item:nth-child(1) { animation-delay: 0.15s; }
.briefing-item:nth-child(2) { animation-delay: 0.22s; }
.briefing-item:nth-child(3) { animation-delay: 0.29s; }
.briefing-item:nth-child(4) { animation-delay: 0.36s; }
.briefing-item:nth-child(5) { animation-delay: 0.43s; }
.briefing-item:nth-child(6) { animation-delay: 0.50s; }
.briefing-item:nth-child(7) { animation-delay: 0.57s; }
.briefing-item:nth-child(8) { animation-delay: 0.64s; }

.briefing-item:hover { box-shadow: var(--shadow-sm); }

.briefing-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius-xs);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 3px;
}
.briefing-item.positive .briefing-icon { background: var(--green-bg); color: var(--green); }
.briefing-item.negative .briefing-icon { background: var(--red-bg); color: var(--red); }
.briefing-item.warning .briefing-icon  { background: var(--gold-bg); color: #92400e; }
.briefing-item.neutral .briefing-icon  { background: var(--bg-muted); color: var(--text-3); }

.briefing-item.positive { border-right: 2px solid var(--green); }
.briefing-item.negative { border-right: 2px solid var(--red); }
.briefing-item.warning  { border-right: 2px solid var(--gold); }

/* ── Heatmap ───────────────────────────────────────────── */
.ix-heatmap-panel { margin-bottom: 16px; }
.heatmap-wrapper { overflow-x: auto; }
.heatmap-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 2px;
    font-size: 13px;
}
.heatmap-table th {
    padding: 8px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-3);
    text-align: center;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.heatmap-table th:first-child { text-align: right; min-width: 120px; }
.heatmap-table td {
    padding: 0;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
}
.heatmap-table td:first-child {
    text-align: right;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-1);
    white-space: nowrap;
    padding: 6px 8px;
}
.heatmap-table tbody tr:hover td:first-child { color: var(--accent); }

.heatmap-cell {
    border-radius: var(--radius-xs);
    display: block;
    padding: 8px 4px;
    min-width: 40px;
    transition: transform 0.15s;
}
.heatmap-cell:hover {
    transform: scale(1.1);
    z-index: 2;
    position: relative;
}

/* DOW Row */
.ix-dow-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.ix-chart-body {
    height: 300px;
    padding: 8px 4px 4px;
}

.intel-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-3);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.8;
}

/* ──────────────────────────────────────────────────────────
   DATA TABLE
   ────────────────────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.section-header h2 {
    font-size: 20px;
    font-weight: 700;
}
.section-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    width: 240px;
    background: var(--bg-card);
    color: var(--text-1);
    transition: all 0.2s;
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}

.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table thead {
    background: var(--bg-muted);
}
.data-table th {
    padding: 12px 16px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: color 0.15s;
}
.data-table th:hover { color: var(--accent); }
.data-table th i { margin-right: 4px; font-size: 10px; }

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-1);
}
.data-table tbody tr {
    transition: background 0.1s;
}
.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.rating-bar-cell { width: 140px; }
.rating-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--bg-muted);
    overflow: hidden;
}
.rating-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s var(--ease);
}
.rating-good { background: #16a34a; }
.rating-ok   { background: #ca8a04; }
.rating-bad  { background: #dc2626; }

/* ──────────────────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-s);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    text-decoration: none;
}
.btn i { font-size: 13px; }
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
}
.btn-outline {
    background: var(--bg-card);
    color: var(--text-1);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-danger {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid #fecaca;
}
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
}

/* ──────────────────────────────────────────────────────────
   UPLOAD
   ────────────────────────────────────────────────────────── */
.upload-section, .uploaded-data {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 28px;
    margin-bottom: 20px;
}
.upload-section h2, .uploaded-data h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}
.upload-desc {
    color: var(--text-2);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.7;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}
.upload-icon {
    font-size: 44px;
    color: var(--accent);
    margin-bottom: 12px;
}
.upload-text {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-1);
}
.upload-sub {
    font-size: 13px;
    color: var(--text-3);
    margin-top: 4px;
}

.upload-progress { margin-top: 20px; }
.progress-bar {
    height: 6px;
    background: var(--bg-muted);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
    width: 0;
}
.progress-text {
    font-size: 13px;
    color: var(--text-2);
    margin-top: 8px;
    text-align: center;
    font-weight: 500;
}

.upload-result {
    margin-top: 20px;
    padding: 16px 20px;
    border-radius: var(--radius-s);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.7;
}
.upload-result.success { background: var(--green-bg); color: #166534; border: 1px solid #bbf7d0; }
.upload-result.error   { background: var(--red-bg); color: #991b1b; border: 1px solid #fecaca; }
[data-theme="dark"] .upload-result.success { color: #4ade80; }
[data-theme="dark"] .upload-result.error   { color: #f87171; }

.months-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.month-card {
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.15s;
    background: var(--bg-card);
}
.month-card:hover { border-color: var(--accent); }
.month-card-info h4 {
    font-size: 15px;
    font-weight: 600;
}
.month-card-info p {
    font-size: 13px;
    color: var(--text-3);
    margin-top: 2px;
}

/* ──────────────────────────────────────────────────────────
   QUARTERLY REPORT
   ────────────────────────────────────────────────────────── */
.report-controls {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 28px;
    margin-bottom: 24px;
}
.report-controls h2 {
    font-size: 20px;
    font-weight: 700;
}
.report-desc {
    color: var(--text-2);
    font-size: 14px;
    margin: 8px 0 20px;
    line-height: 1.7;
}
.report-form {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.report-form select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    background: var(--bg-card);
    color: var(--text-1);
}

.report-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 28px;
    margin-bottom: 20px;
}
.report-section h2 {
    font-size: 17px;
    font-weight: 700;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.report-section h2 i { color: var(--accent); font-size: 16px; }

.report-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.report-kpi {
    text-align: center;
    padding: 20px 12px;
    background: var(--bg-muted);
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
}
.report-kpi .val {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-1);
}
.report-kpi .lbl {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 500;
    margin-top: 4px;
}

.report-chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.report-chart-row canvas { max-height: 300px; }

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}
.report-table th {
    background: var(--bg-muted);
    padding: 10px 14px;
    text-align: right;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.report-table td {
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid var(--border-light);
}
.report-table tbody tr:hover { background: var(--bg-hover); }

.trend-up { color: var(--green); }
.trend-down { color: var(--red); }
.trend-arrow { font-size: 11px; margin-right: 4px; }

/* ── Spinner ───────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ──────────────────────────────────────────────────────────
   RESPONSIVE
   ────────────────────────────────────────────────────────── */
@media (max-width: 1280px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    .chart-row { grid-template-columns: 1fr; }
    .ix-columns { grid-template-columns: 1fr; }
    .ix-dow-row { grid-template-columns: 1fr; }
    .report-chart-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-right: 0; }
    .menu-toggle { display: block; }
    .page-container { padding: 16px; }
    .topbar { padding: 0 16px; }
    .kpi-grid { grid-template-columns: 1fr; }
    .topbar-title { font-size: 16px; }
}

/* ── Print ─────────────────────────────────────────────── */
@media print {
    body { background: #fff; color: #000; }
    .sidebar, .topbar, .report-controls, .menu-toggle { display: none !important; }
    .main-content { margin-right: 0 !important; }
    .page-container { padding: 0; }
    .page { display: none !important; }
    #page-report { display: block !important; }
    .report-section { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
    .report-output { display: block !important; }
    .chart-card, .kpi-card { break-inside: avoid; }
    @page { margin: 1.5cm; size: A4; }
}
.print-only { display: none; }
