:root,
body.theme-dark,
[data-theme="dark"] {
    /* ==========================================================================
       PHALANTIS ENTERPRISE SaaS DESIGN SYSTEM (SAP FIORI / JD EDWARDS CLOUD)
       PALETA CORPORATIVA PROFESIONAL EMPRESARIAL — MODO OSCURO (DEFAULT)
       ========================================================================== */
    
    /* Brand & Primary System Colors (Corporate Sapphire / Fiori Blue) */
    --color-primary: #0066E0;
    --color-primary-light: #2A85FF;
    --color-primary-dark: #004BB3;
    --color-primary-subtle: rgba(0, 102, 224, 0.12);
    --color-primary-glow: rgba(0, 102, 224, 0.28);
    
    /* Corporate Secondary & Accents */
    --color-accent: #0284C7;
    --color-accent-subtle: rgba(2, 132, 199, 0.12);
    --color-indigo: #6366F1;
    --color-slate-badge: #1E293B;

    /* Corporate Dark Surfaces (Deep Obsidian & Slate Navy) */
    --bg-base: #0A0E17;
    --bg-surface: #101626;
    --bg-surface-elevated: #162035;
    --bg-surface-card: #12192B;
    --bg-surface-hover: #1A243D;
    --bg-input: #0B101D;
    --bg-table-stripe: rgba(255, 255, 255, 0.015);
    --bg-glass: rgba(16, 22, 38, 0.90);

    /* Text & Legibility */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-inverse: #0F172A;
    --text-code: #38BDF8;

    /* Semantic Status (Financial & Operational - Strictly Corporate) */
    --color-success: #10B981;
    --color-success-subtle: rgba(16, 185, 129, 0.12);
    --color-danger: #EF4444;
    --color-danger-subtle: rgba(239, 68, 68, 0.12);
    --color-warning: #F59E0B;
    --color-warning-subtle: rgba(245, 158, 11, 0.12);
    --color-info: #0284C7;
    --color-info-subtle: rgba(2, 132, 199, 0.12);

    /* Enterprise Grid Lines & Borders */
    --border-color: #1E293B;
    --border-color-subtle: rgba(255, 255, 255, 0.05);
    --border-color-focus: #0066E0;
    --border-radius-xs: 4px;
    --border-radius-sm: 6px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;

    /* Enterprise Elevation & Lighting */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 36px -4px rgba(0, 0, 0, 0.75);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-glow: 0 0 20px rgba(0, 102, 224, 0.28);

    /* Typography Hierarchy */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}

body.theme-light,
[data-theme="light"] {
    /* ==========================================================================
       PHALANTIS ENTERPRISE SaaS DESIGN SYSTEM (SAP FIORI / JD EDWARDS CLOUD)
       PALETA CORPORATIVA PROFESIONAL EMPRESARIAL — MODO CLARO (HORIZON LIGHT)
       ========================================================================== */
    
    /* Brand & Primary System Colors (Corporate Fiori Blue) */
    --color-primary: #0066E0;
    --color-primary-light: #0052B4;
    --color-primary-dark: #003E8A;
    --color-primary-subtle: rgba(0, 102, 224, 0.08);
    --color-primary-glow: rgba(0, 102, 224, 0.18);
    
    /* Corporate Secondary & Accents */
    --color-accent: #0284C7;
    --color-accent-subtle: rgba(2, 132, 199, 0.08);
    --color-indigo: #4F46E5;
    --color-slate-badge: #F1F5F9;

    /* Corporate Light Surfaces (Clean Porcelain / White Canvas / Slate 50) */
    --bg-base: #F4F6F9;
    --bg-surface: #FFFFFF;
    --bg-surface-elevated: #FFFFFF;
    --bg-surface-card: #FFFFFF;
    --bg-surface-hover: #F8FAFC;
    --bg-input: #FFFFFF;
    --bg-table-stripe: #F8FAFC;
    --bg-glass: rgba(255, 255, 255, 0.95);

    /* Text & Legibility (High-Contrast Slate Hierarchy) */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #64748B;
    --text-inverse: #FFFFFF;
    --text-code: #0284C7;

    /* Semantic Status */
    --color-success: #059669;
    --color-success-subtle: rgba(16, 185, 129, 0.09);
    --color-danger: #DC2626;
    --color-danger-subtle: rgba(239, 68, 68, 0.09);
    --color-warning: #D97706;
    --color-warning-subtle: rgba(245, 158, 11, 0.09);
    --color-info: #0284C7;
    --color-info-subtle: rgba(2, 132, 199, 0.09);

    /* Enterprise Grid Lines & Borders */
    --border-color: #E2E8F0;
    --border-color-subtle: #EDF2F7;
    --border-color-focus: #0066E0;

    /* Enterprise Elevation & Lighting */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 28px -4px rgba(0, 0, 0, 0.10);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px #E2E8F0;
    --shadow-glow: 0 0 20px rgba(0, 102, 224, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 13.5px;
    overflow-x: hidden;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Enterprise Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: #1E293B;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

a {
    color: var(--color-primary-light);
    text-decoration: none;
    transition: all 0.15s ease;
}

a:hover {
    color: #60A5FA;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 0.5em;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

/* Enterprise Glass & Panel Utilities */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

/* Tabular Monospace Data */
.font-mono, .tabular-nums {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Semantic Badges & Chips */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: var(--border-radius-xs);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-primary {
    background: var(--color-primary-subtle);
    color: #60A5FA;
    border: 1px solid rgba(0, 102, 224, 0.3);
}

.badge-success {
    background: var(--color-success-subtle);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: var(--color-danger-subtle);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-warning {
    background: var(--color-warning-subtle);
    color: #FBBF24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-info {
    background: var(--color-info-subtle);
    color: #38BDF8;
    border: 1px solid rgba(2, 132, 199, 0.3);
}

.badge-neutral {
    background: #1A243D;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* Light Theme Badges */
body.theme-light .badge-primary {
    background: rgba(0, 102, 224, 0.08);
    color: #0052B4;
    border: 1px solid rgba(0, 102, 224, 0.22);
}

body.theme-light .badge-success {
    background: rgba(16, 185, 129, 0.09);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.22);
}

body.theme-light .badge-danger {
    background: rgba(239, 68, 68, 0.09);
    color: #B91C1C;
    border: 1px solid rgba(239, 68, 68, 0.22);
}

body.theme-light .badge-warning {
    background: rgba(245, 158, 11, 0.10);
    color: #B45309;
    border: 1px solid rgba(245, 158, 11, 0.22);
}

body.theme-light .badge-info {
    background: rgba(2, 132, 199, 0.09);
    color: #0369A1;
    border: 1px solid rgba(2, 132, 199, 0.22);
}

body.theme-light .badge-neutral {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #CBD5E1;
}

/* Light Theme Scrollbars */
body.theme-light ::-webkit-scrollbar-track {
    background: #F4F6F9;
}
body.theme-light ::-webkit-scrollbar-thumb {
    background: #CBD5E1;
}
body.theme-light ::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* System Pulse Dot */
.status-indicator {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.status-indicator.offline {
    background: var(--color-danger);
    box-shadow: 0 0 8px var(--color-danger);
}

/* Utilities */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-small { font-size: 0.8rem; }
.text-xs { font-size: 0.72rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-primary { color: var(--color-primary-light) !important; }
