/* =============================================
   EXECUTIVE HR DASHBOARD — DESIGN SYSTEM
   Codename: CON | Version: 4.0
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── TOKENS ─────────────────────────────────── */
:root {
    /* Canvas */
    --bg-void: #070B14;
    --bg-surface: #0D1320;
    --bg-panel: #111827;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-medium: rgba(255, 255, 255, 0.12);
    --border-glow-red: rgba(255, 59, 48, 0.4);
    --border-glow-green: rgba(52, 199, 89, 0.4);

    /* Text */
    --text-primary: rgba(255, 255, 255, 0.92);
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-tertiary: rgba(255, 255, 255, 0.30);
    --text-label: rgba(255, 255, 255, 0.40);

    /* Semantic Colors */
    --red: #FF3B30;
    --red-glow: rgba(255, 59, 48, 0.25);
    --red-muted: rgba(255, 59, 48, 0.12);
    --orange: #FF9F0A;
    --orange-muted: rgba(255, 159, 10, 0.12);
    --green: #34C759;
    --green-glow: rgba(52, 199, 89, 0.25);
    --green-muted: rgba(52, 199, 89, 0.12);
    --blue: #0A84FF;
    --blue-muted: rgba(10, 132, 255, 0.12);

    /* Effects */
    --blur-glass: blur(20px) saturate(1.5);
    --radius-card: 16px;
    --radius-sm: 8px;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow-red: 0 0 20px rgba(255, 59, 48, 0.15), 0 0 60px rgba(255, 59, 48, 0.05);
    --shadow-glow-green: 0 0 20px rgba(52, 199, 89, 0.15), 0 0 60px rgba(52, 199, 89, 0.05);
}

/* ── LAYOUT ──────────────────────────────────── */
body.light-theme {
    /* Canvas */
    --bg-void: #f4f5f7;
    --bg-surface: #ffffff;
    --bg-panel: #ffffff;
    --bg-card: rgba(0, 0, 0, 0.02);
    --bg-card-hover: rgba(0, 0, 0, 0.05);

    /* Borders */
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-medium: rgba(0, 0, 0, 0.15);

    /* Text */
    --text-primary: rgba(13, 20, 38, 0.95);
    --text-secondary: rgba(13, 20, 38, 0.65);
    --text-tertiary: rgba(13, 20, 38, 0.45);
    --text-label: rgba(13, 20, 38, 0.55);

    /* Hide heavy FX in light mode */
    --atm-display: none;

    background: var(--bg-void);
    color: var(--text-primary);
}

/* Base Light Theme overrides */
body.light-theme .app-header {
    background: rgba(255, 255, 255, 0.95);
}

body.light-theme .atm-layer,
body.light-theme #digital-rain {
    display: none;
}

body.light-theme .nav-btn {
    color: var(--text-secondary);
}

body.light-theme .nav-btn.active {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

body.light-theme .app-footer {
    background: rgba(240, 240, 245, 0.9);
}

body.light-theme .card {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.light-theme .stealth-btn {
    color: var(--text-secondary);
    border-color: rgba(0, 0, 0, 0.15);
}

body.light-theme .stealth-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.3);
}

body.light-theme .stealth-btn.highlight-btn {
    color: var(--blue);
    border-color: rgba(10, 132, 255, 0.3);
    background: rgba(10, 132, 255, 0.05);
}

body.light-theme .card::before {
    background: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(0, 0, 0, 0.05) 0%, transparent 70%);
}

body.light-theme .data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light-theme .data-table thead th {
    border-bottom: 1px solid var(--border-medium);
}

body.light-theme .view-nav {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .nav-sidebar {
    background: #eaecef;
}

body.light-theme .kpi-cards .card-label .dot,
body.light-theme .hero-card .card-label .dot {
    box-shadow: none !important;
}

body.light-theme .footer-item {
    color: rgba(0, 0, 0, 0.5);
}

body.light-theme .footer-item .accent {
    color: var(--blue);
}

body.light-theme .app-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .card:hover {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

body.light-theme .card.risk-border {
    border-color: rgba(255, 59, 48, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.light-theme .card.success-border {
    border-color: rgba(52, 199, 89, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.light-theme .hero-hero-value {
    text-shadow: none;
}

body.light-theme .risk-bar-track {
    background: rgba(0, 0, 0, 0.08);
}

body.light-theme .chart-tooltip-external {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 245, 250, 0.98) 100%);
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body.light-theme .tooltip-title {
    color: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-theme .tooltip-row {
    color: #000;
}

body.light-theme .tooltip-value {
    text-shadow: none;
}

body.light-theme .view-nav {
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ── RESET ───────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    background: var(--bg-void);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── LAYOUT ──────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 600px;
    position: relative;
    overflow: hidden;
}

/* ── ATMOSPHERIC FX (subtle — not overbearing) ─ */
.atm-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.atm-noise {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    background-size: 150px 150px;
    opacity: 0.04;
}

.atm-vignette {
    background: radial-gradient(ellipse 80% 80% at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.7) 100%);
}

.atm-glow {
    background: radial-gradient(ellipse 60% 40% at 50% -10%, rgba(10, 132, 255, 0.08) 0%, transparent 60%);
}

/* ── HEADER ──────────────────────────────────── */
.app-header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 32px;
    height: 56px;
    background: rgba(13, 19, 32, 0.95);
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: var(--blur-glass);
    flex-shrink: 0;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}

.header-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 8px var(--green);
    }

    50% {
        opacity: 0.5;
        box-shadow: 0 0 3px var(--green);
    }
}

.header-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-primary);
    text-transform: uppercase;
}

.header-title span {
    color: var(--blue);
    margin-left: 6px;
}

/* ── NAV TABS ────────────────────────────────── */
.view-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 7px 18px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.04em;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.nav-btn.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.header-data-controls {
    margin-left: auto;
    display: flex;
    gap: 12px;
    align-items: center;
}

.stealth-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
    font-family: 'Space Mono', monospace, sans-serif;
    font-size: 10px;
    letter-spacing: 0.1em;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.stealth-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.stealth-btn.highlight-btn {
    color: var(--blue);
    border-color: rgba(10, 132, 255, 0.3);
    background: rgba(10, 132, 255, 0.05);
}

.stealth-btn.highlight-btn:hover {
    background: rgba(10, 132, 255, 0.15);
    border-color: var(--blue);
    color: #fff;
    box-shadow: 0 0 10px rgba(10, 132, 255, 0.3);
}

/* ── MAIN CONTENT ────────────────────────────── */
.app-content {
    position: relative;
    z-index: 2;
    flex: 1;
    overflow: hidden;
    display: grid;
}

.view-page {
    display: none;
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 24px 32px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.view-page.active {
    display: block;
    opacity: 1;
}

/* ── CONSOLIDATED VIEW LAYOUT ─────────────────── */
.con-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 16px;
    height: 100%;
}

/* Hero big card takes first 2 cols */
.hero-card {
    grid-column: 1 / 3;
    grid-row: 1 / 2;
}

/* KPIs on right */
.kpi-cards {
    grid-column: 3 / 5;
    grid-row: 1 / 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Large chart spanning full wdth */
.trend-row {
    grid-column: 1 / 5;
    grid-row: 2 / 3;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
}

/* Alert/risk row */
.risk-row {
    grid-column: 1 / 5;
    grid-row: 3 / 4;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 16px;
}

/* ── TALENT VIEW LAYOUT ─────────────────────── */
.talent-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
}

.talent-main-chart {
    grid-column: 1 / 3;
}

/* ── OPERATIONAL VIEW LAYOUT ─────────────────── */
.ops-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 16px;
}

.ops-enps-chart {
    grid-column: 1 / 2;
}

/* ── CARD COMPONENT ──────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease;
    box-shadow: var(--shadow-card);
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(255, 255, 255, 0.04) 0%, transparent 70%);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card), 0 8px 32px rgba(0, 0, 0, 0.4);
}

.card:hover::before {
    opacity: 1;
}

.card:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

/* Show crosshair over chart canvas areas */
.sparkline-wrapper canvas,
.chart-wrapper-full canvas,
.chart-wrapper-md canvas,
[style*="height"] canvas {
    cursor: crosshair;
    position: relative;
    z-index: 100;
    pointer-events: auto;
}

.card.risk-border {
    border-color: rgba(255, 59, 48, 0.25);
    box-shadow: var(--shadow-card), var(--shadow-glow-red);
}

.card.success-border {
    border-color: rgba(52, 199, 89, 0.25);
    box-shadow: var(--shadow-card), var(--shadow-glow-green);
}

/* Card Label */
.card-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-label);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    /* Allow hover to pass through to chart */
}

.card-label .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Card Value */
.card-value {
    display: flex;
    align-items: baseline;
    gap: 5px;
    line-height: 1;
    margin-bottom: 4px;
    pointer-events: none;
    /* Allow hover to pass through to chart */
}

.currency {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    align-self: flex-start;
    margin-top: 3px;
}

.value-main {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.value-main.red {
    color: var(--red);
}

.value-main.green {
    color: var(--green);
}

.value-main.orange {
    color: var(--orange);
}

.value-unit {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 2px;
}

/* Card sub-label */
.card-sublabel {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* KPI Rate Sublabel */
.kpi-rate-sublabel {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 2px 0 6px;
    letter-spacing: 0.02em;
}

.kpi-rate-sublabel strong {
    font-weight: 700;
    color: var(--text-primary);
}

@media print {
    .kpi-rate-sublabel {
        font-size: 10px;
        color: #555;
        margin: 1px 0 4px;
    }
    .kpi-rate-sublabel strong {
        color: #111;
    }
}

/* Trend badge */
.trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    margin-top: 8px;
    letter-spacing: 0.06em;
}

.trend-badge.up {
    background: var(--red-muted);
    color: var(--red);
}

.trend-badge.down {
    background: var(--green-muted);
    color: var(--green);
}

.trend-badge.stable {
    background: var(--orange-muted);
    color: var(--orange);
}

/* ── HERO BIG CARD ────────────────────────────── */
.hero-hero-value {
    font-size: 64px;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--red);
    line-height: 1;
    text-shadow: var(--shadow-glow-red);
    font-variant-numeric: tabular-nums;
    animation: glow-pulse 4s ease-in-out infinite;
}

@keyframes glow-pulse {

    0%,
    100% {
        text-shadow: 0 0 20px rgba(255, 59, 48, 0.2);
    }

    50% {
        text-shadow: 0 0 40px rgba(255, 59, 48, 0.4), 0 0 80px rgba(255, 59, 48, 0.1);
    }
}

.hero-currency {
    font-size: 24px;
    font-weight: 400;
    color: var(--text-secondary);
}

.hero-value-wrapper {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 8px 0 4px;
}

.hero-desc {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── SPARKLINE CANVAS WRAPPER ─────────────────── */
.sparkline-wrapper {
    width: 100%;
    height: 44px;
    margin-top: 12px;
}

.chart-wrapper-full {
    width: 100%;
    height: 160px;
    margin-top: 16px;
}

.chart-wrapper-md {
    width: 100%;
    height: 120px;
    margin-top: 14px;
}

/* ── RISK BAR ─────────────────────────────────── */
.risk-bar-track {
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    margin-top: 14px;
    overflow: hidden;
}

.risk-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 2s ease-out;
}

.risk-bar-fill.red {
    background: linear-gradient(90deg, var(--red), #ff6b6b);
}

.risk-bar-fill.orange {
    background: linear-gradient(90deg, #cc7a00, var(--orange));
}

.risk-bar-fill.green {
    background: linear-gradient(90deg, #1a8a38, var(--green));
}

/* ── TABLE ────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table thead th {
    text-align: left;
    color: var(--text-label);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0 0 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.2s ease;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-table td {
    padding: 10px 0;
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table td:first-child {
    color: var(--text-primary);
    font-weight: 500;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.tag.red {
    background: var(--red-muted);
    color: var(--red);
}

.tag.green {
    background: var(--green-muted);
    color: var(--green);
}

.tag.orange {
    background: var(--orange-muted);
    color: var(--orange);
}

/* ── DIVIDER ─────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 16px 0;
}

/* ── SECTION HEADER ──────────────────────────── */
.section-header {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-label);
    margin-bottom: 16px;
}

/* ── GRID INSIDE CARD ─────────────────────────── */
.card-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.card-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-label {
    font-size: 10px;
    color: var(--text-label);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.metric-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.metric-value.red {
    color: var(--red);
}

.metric-value.green {
    color: var(--green);
}

.metric-value.orange {
    color: var(--orange);
}

/* ── FOOTER ──────────────────────────────────── */
.app-footer {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    padding: 0 32px;
    height: 32px;
    background: rgba(7, 11, 20, 0.9);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
    gap: 24px;
}

.footer-item {
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.08em;
    font-family: 'SF Mono', 'Fira Code', monospace;
    white-space: nowrap;
}

.footer-item .accent {
    color: var(--blue);
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.blink {
    animation: blink-anim 1s infinite step-end;
}

@keyframes blink-anim {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.footer-right {
    margin-left: auto;
}

/* ── DIGITAL RAIN BG ─────────────────────────── */
.digital-rain-container {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.03;
}

.data-column {
    position: absolute;
    top: -100%;
    width: 14px;
    font-size: 10px;
    color: #00ff88;
    font-family: monospace;
    line-height: 1.6;
    white-space: pre;
    animation: drop linear infinite;
    word-break: break-all;
}

@keyframes drop {
    to {
        top: 110%;
    }
}

/* Card Click Ripple */
@keyframes ripple-expand {
    to {
        transform: scale(1);
        opacity: 0;
    }
}

/* ── EXTERNAL FLOATING TOOLTIP (PREMIUM) ────────────────── */
.chart-tooltip-external {
    position: fixed;
    background: linear-gradient(135deg, rgba(13, 22, 45, 0.96) 0%, rgba(8, 12, 28, 0.98) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 12px 16px;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.1s ease, transform 0.1s ease;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    min-width: 160px;
    font-family: 'Inter', sans-serif;
}

.tooltip-title {
    font-size: 10px;
    font-weight: 800;
    color: #8e9aaf;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 6px;
}

.tooltip-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tooltip-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.tooltip-marker {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.tooltip-label {
    opacity: 0.5;
    font-weight: 500;
    font-size: 12px;
}

.tooltip-value {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* ── PHASE 4: MULTI-FORMAT EXPORT ────────────────────── */

/* === DEFAULT PRINT: 16:9 SLIDE EXPORT (Cmd+P) === */
@media print {
    @page {
        size: landscape;
        margin: 0;
    }

    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* De-confine layout for print */
    html,
    body,
    .app-shell,
    .app-content {
        height: auto !important;
        overflow: visible !important;
        min-height: auto !important;
    }

    /* Hide non-essential UI */
    .atm-layer,
    #digital-rain,
    .chart-tooltip-external,
    .app-footer,
    #sys-notification,
    .header-data-controls {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: none;
        padding: 20px;
        height: auto;
        overflow: visible;
    }

    .view-page {
        gap: 16px;
        display: none;
    }

    .view-page.active {
        display: grid;
    }

    .card {
        box-shadow: none !important;
        break-inside: avoid;
    }

    canvas {
        filter: contrast(1.1) brightness(1.05);
    }
}

/* === A4 PORTRAIT EXPORT — handled via html2canvas + jsPDF (no @media print needed) === */

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

/* ── INTERACTIVE EFFECTS ────────────────────────────── */
@keyframes glitch-skew {
    0% {
        transform: skew(0deg);
        filter: blur(0);
    }

    20% {
        transform: skew(-5deg);
        filter: blur(2px);
        background: rgba(255, 59, 48, 0.1);
    }

    40% {
        transform: skew(5deg);
        filter: blur(1px);
    }

    60% {
        transform: skew(-2deg);
        filter: blur(3px);
        background: rgba(10, 132, 255, 0.1);
    }

    80% {
        transform: skew(2deg);
        filter: blur(0);
    }

    100% {
        transform: skew(0deg);
    }
}

/* ── PHASE 6: HISTORICAL ANALYSIS ────────────────────── */

.historical-analysis-section {
    grid-column: 1 / -1;  /* Span all columns in parent 4-column grid */
    margin-top: 24px;
    padding: 0;
}

.historical-analysis-section h3 {
    font-size: 12px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 600;
}

.historical-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

/* Delta card styling (glassmorphism) */
.historical-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.historical-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.historical-card .card-label {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 500;
}

.historical-card .card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.card-delta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-top: 4px;
}

.delta-text {
    color: var(--text-secondary);
}

/* Delta badge styling (direction indicators) */
.delta-badge {
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
}

/* Positive delta = risk decreased (green) */
.delta-badge.positive {
    color: #34C759;
    background: rgba(52, 199, 89, 0.15);
}

/* Negative delta = risk increased (red) */
.delta-badge.negative {
    color: #FF3B30;
    background: rgba(255, 59, 48, 0.15);
}

/* Responsive: 1 column on mobile, 2 columns on tablet+ */
@media (max-width: 768px) {
    .historical-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Light theme overrides for historical cards */
body.light-theme .historical-card {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .historical-card:hover {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .historical-card .card-label {
    color: var(--text-tertiary);
}

body.light-theme .historical-card .card-value {
    color: var(--text-primary);
}

.delta-badge::before {
    content: attr(data-direction);
}

/* YoY comparison card (special layout) */
.yoy-card {
    grid-column: 1 / -1;
}

.yoy-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.yoy-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.yoy-period {
    font-size: 9px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.yoy-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.yoy-delta {
    font-size: 10px;
    font-weight: 600;
}

/* Light theme overrides */
body.light-theme .historical-card {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .historical-card:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.light-theme .yoy-item {
    background: rgba(0, 0, 0, 0.02);
}

/* ── eNPS CRITICAL ALERT ─────────────────────────────── */
.card.enps-critical {
    border-color: var(--border-glow-red);
    box-shadow: var(--shadow-card), var(--shadow-glow-red);
}
.enps-alert-banner {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--red);
    background: var(--red-muted);
    border-radius: 6px;
    padding: 6px 10px;
    margin-top: 8px;
}
body.light-theme .card.enps-critical {
    border-color: rgba(255, 59, 48, 0.4);
    box-shadow: 0 2px 12px rgba(255, 59, 48, 0.15);
}
body.light-theme .enps-alert-banner {
    background: rgba(255, 59, 48, 0.08);
}