/* ================================================================
   QC DASHBOARD v3.0 — COMPLETE STYLESHEET
   Premium Dark-Mode Design System
   ================================================================ */

/* --- Google Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
    /* DEFAULT PREMIUM THEME: EMERALD OBSIDIAN (Deep & Vibrant) */
    --bg-base: #030712; /* Rich Obsidian */
    --bg-surface: rgba(17, 24, 39, 0.85);
    --bg-card: rgba(31, 41, 55, 0.4);
    --bg-card-hover: rgba(55, 65, 81, 0.7);
    --border: rgba(255, 255, 255, 0.05);
    --border-active: #059669;

    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;

    --accent-blue: #10b981; /* Emerald Primary */
    --accent-teal: #14b8a6;
    --accent-green: #059669;
    --accent-cyan: #06b6d4;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --accent-gold: #fbbf24;

    --gradient-blue: linear-gradient(135deg, #10b981 0%, #064e3b 100%);
    --gradient-gold: linear-gradient(135deg, #fbbf24 0%, #fef3c7 50%, #d97706 100%);
    --gradient-emerald: linear-gradient(135deg, #10b981 0%, #34d399 50%, #059669 100%);
    --gradient-premium: linear-gradient(135deg, #059669 0%, #10b981 50%, #06b6d4 100%);
    
    --shadow-premium: 0 20px 40px -12px rgba(0, 0, 0, 0.8);
    --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.2);
    
    --radius-sm: 14px;
    --radius-md: 22px;
    --radius-lg: 36px;
    --sidebar-w: 280px;
    --header-h: 70px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    --glass-blur: blur(24px) saturate(190%);
    --noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    
    --premium-glow: radial-gradient(circle at 50% -20%, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
}

/* ================================================================
   FLUID CUSTOM SCROLLBARS
   ================================================================ */
html {
    scroll-behavior: smooth;
}

/* Global Scrollbar */
::-webkit-scrollbar {
    width: 14px; /* Larger, more comfortable size */
    height: 14px;
}

::-webkit-scrollbar-track {
    background: transparent;
    border-left: 1px solid rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background-color: rgba(140, 140, 140, 0.3);
    border-radius: 20px;
    border: 4px solid transparent;
    background-clip: padding-box;
    transition: background-color 0.3s ease-in-out, border-width 0.3s ease-in-out;
}

/* Fluid Hover Animation */
::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent-blue, rgba(140, 140, 140, 0.5));
    border: 2px solid transparent; /* Expands visually by shrinking the border */
}

/* Drag Animation */
::-webkit-scrollbar-thumb:active {
    background-color: var(--accent-blue, rgba(160, 160, 160, 0.8));
    border: 1px solid transparent; /* Expands even further during drag */
}

/* Dark mode specific track adjustment */
[data-theme="dark"] ::-webkit-scrollbar-track,
[data-theme="meta-dark"] ::-webkit-scrollbar-track,
[data-theme="midnight"] ::-webkit-scrollbar-track,
[data-theme="ocean"] ::-webkit-scrollbar-track,
[data-theme="default"] ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
}

/* Light mode specific track adjustment */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: rgba(200, 200, 200, 0.1);
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background-color: rgba(100, 100, 100, 0.3);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(100, 100, 100, 0.5);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:active {
    background-color: rgba(80, 80, 80, 0.7);
}


/* --- Global Decorations --- */
.decor-blob {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.08;
    z-index: -1;
    pointer-events: none;
    animation: blobFloat 25s infinite alternate ease-in-out;
}

.blob-1 { top: -200px; left: -200px; background: var(--blob-1); }
.blob-2 { bottom: -200px; right: -200px; background: var(--blob-2); animation-delay: -5s; }
.blob-3 { top: 40%; left: 50%; background: var(--blob-3); animation-delay: -10s; }

@keyframes blobFloat {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -80px) scale(1.1); }
    66% { transform: translate(-30px, 40px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

[data-theme="luxe"] .decor-blob { opacity: 0.05; }
[data-theme="luxe"] { --blob-1: #d4af37; --blob-2: #f7e7ce; --blob-3: #333; }
[data-theme="midnight"] { --blob-1: #0077b6; --blob-2: #00b4d8; --blob-3: #03045e; }


[data-theme="dark"] {
    --bg-base: #070f08;
    --bg-surface: rgba(13, 26, 16, 0.7);
    --bg-card: rgba(13, 26, 16, 0.6);
    --bg-card-hover: rgba(20, 36, 24, 0.8);
    --border: rgba(132, 204, 22, 0.1);
    --border-active: #84cc16;

    --text-primary: #ecfccb;
    --text-secondary: #bef264;
    --text-muted: #678b2d;

    --accent-blue: #84cc16;
    --accent-teal: #a3e635;
    --accent-green: #10b981;
}

[data-theme="light"] {
    /* DAYLIGHT PRO - Reduced Contrast & Golden Sparkle with Dark Grey Glazing */
    --bg-base: #f4ece1; /* Soft warm beige */
    --bg-surface: rgba(30, 31, 34, 0.85); /* Dark grey glass */
    --bg-card: rgba(40, 42, 46, 0.9); /* Dark grey card */
    --bg-card-hover: rgba(50, 52, 58, 0.95);
    --border: rgba(212, 175, 55, 0.3);
    --border-active: #d4af37;

    --text-primary: #d4af37; /* Brighter gold for dark panels */
    --text-secondary: #b39430; /* Medium Gold */
    --text-muted: #8a6c22;

    --accent-blue: #4f46e5; /* Indigo */
    --accent-teal: #0d9488; /* Teal */
    --accent-green: #059669;
    --accent-yellow: #d97706;
    --accent-red: #dc2626;
    --accent-purple: #7c3aed;

    --gradient-blue: linear-gradient(135deg, #4f46e5 0%, #0d9488 100%);
    --gradient-green: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --gradient-warn: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --gradient-red: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    --gradient-purple: linear-gradient(135deg, #7c3aed 0%, #c084fc 100%);

    --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 15px 50px rgba(79, 70, 229, 0.12);

    --radius-sm: 16px;
    --radius-md: 24px;
    --radius-lg: 32px;

    --font-heading: 'Outfit', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
    --glass-blur: blur(25px);
}

/* Golden Sparkle Animation for Light Theme Text */
@keyframes goldSparkle {
    0% { background-position: 0% 50%; filter: brightness(1) drop-shadow(0 0 2px rgba(212,175,55,0.2)); }
    50% { background-position: 100% 50%; filter: brightness(1.3) drop-shadow(0 0 5px rgba(212,175,55,0.6)); }
    100% { background-position: 0% 50%; filter: brightness(1) drop-shadow(0 0 2px rgba(212,175,55,0.2)); }
}

[data-theme="light"] h1, 
[data-theme="light"] h2, 
[data-theme="light"] h3, 
[data-theme="light"] .brand-text h2,
[data-theme="light"] .kpi-value {
    background: linear-gradient(110deg, #8a6c22 0%, #d4af37 25%, #f7e7ce 50%, #d4af37 75%, #8a6c22 100%);
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: goldSparkle 4s linear infinite;
    font-weight: 800;
}

/* Light Theme Logo Inversion & High Contrast Fixes */
[data-theme="light"] .sidebar-brand svg {
    filter: invert(0.4) sepia(1) saturate(3) hue-rotate(30deg) brightness(0.8); /* Golden tone for logo */
}

[data-theme="light"] .badge, 
[data-theme="light"] .status-pill {
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}

[data-theme="light"] td[style*="color: #fbbf24"],
[data-theme="light"] td[style*="color: #f59e0b"] {
    color: #b45309 !important; /* Darker amber for ACCEPTED/Warning text in light mode */
    font-weight: 700;
}

/* ================================================================
   META DARK — Deep Blue Accent
   ================================================================ */
[data-theme="meta-dark"] {
    /* CRIMSON VELVET - High-End Wine & Rose Gold */
    --bg-base: #110505;
    --bg-surface: rgba(26, 10, 10, 0.85);
    --bg-card: rgba(35, 15, 15, 0.7);
    --bg-card-hover: rgba(45, 20, 20, 0.9);
    --border: rgba(183, 110, 121, 0.2);
    --border-active: #b76e79;

    --text-primary: #fbe6e8;
    --text-secondary: #dcb1b5;
    --text-muted: #a37f83;

    --accent-blue: #e11d48; /* Deep Red */
    --accent-teal: #b76e79; /* Rose Gold */
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #be123c;
    --accent-purple: #9f1239;

    --gradient-blue: linear-gradient(135deg, #e11d48 0%, #b76e79 100%);
    --gradient-green: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-warn: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-red: linear-gradient(135deg, #be123c 0%, #9f1239 100%);
    --gradient-purple: linear-gradient(135deg, #b76e79 0%, #881337 100%);

    --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.8);
    --shadow-hover: 0 15px 50px rgba(183, 110, 121, 0.15);

    --font-heading: 'Outfit', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
    --glass-blur: blur(25px);
}

/* ================================================================
   META MIDNIGHT — Ultra Deep Indigo
   ================================================================ */
[data-theme="midnight"] {
    /* SAPPHIRE MATRIX - Futuristic Navy & Cyan */
    --bg-base: #040814;
    --bg-surface: rgba(10, 18, 38, 0.85);
    --bg-card: rgba(15, 26, 50, 0.7);
    --bg-card-hover: rgba(20, 36, 70, 0.9);
    --border: rgba(6, 182, 212, 0.2);
    --border-active: #06b6d4;

    --text-primary: #ecfeff;
    --text-secondary: #a5f3fc;
    --text-muted: #67e8f9;

    --accent-blue: #06b6d4; /* Neon Cyan */
    --accent-teal: #3b82f6; /* Electric Blue */
    --accent-green: #22c55e;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;

    --gradient-blue: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-green: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    --gradient-warn: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --gradient-red: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    --gradient-purple: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);

    --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.8);
    --shadow-hover: 0 15px 50px rgba(6, 182, 212, 0.15);

    --font-heading: 'Outfit', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
    --glass-blur: blur(25px);
}

/* ================================================================
   META OCEAN — Teal & Emerald
   ================================================================ */
[data-theme="ocean"] {
    /* AMETHYST VIOLET - Cyberpunk Fashion */
    --bg-base: #0b0514;
    --bg-surface: rgba(20, 10, 36, 0.85);
    --bg-card: rgba(30, 15, 50, 0.7);
    --bg-card-hover: rgba(45, 20, 70, 0.9);
    --border: rgba(168, 85, 247, 0.2);
    --border-active: #a855f7;

    --text-primary: #f5f3ff;
    --text-secondary: #ddd6fe;
    --text-muted: #a78bfa;

    --accent-blue: #a855f7; /* Neon Purple */
    --accent-teal: #d946ef; /* Fuchsia */
    --accent-green: #10b981;
    --accent-yellow: #fde68a;
    --accent-red: #fb7185;
    --accent-purple: #c026d3;

    --gradient-blue: linear-gradient(135deg, #a855f7 0%, #d946ef 100%);
    --gradient-green: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --gradient-warn: linear-gradient(135deg, #fde68a 0%, #fbbf24 100%);
    --gradient-red: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
    --gradient-purple: linear-gradient(135deg, #d946ef 0%, #c026d3 100%);

    --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.8);
    --shadow-hover: 0 15px 50px rgba(168, 85, 247, 0.15);

    --font-heading: 'Outfit', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
    --glass-blur: blur(25px);
}

/* ================================================================
   META LUXE — Obsidian & Gold (Premium)
   ================================================================ */
[data-theme="luxe"] {
    --bg-base: #050505;
    --bg-surface: rgba(8, 8, 10, 0.9);
    --bg-card: rgba(15, 15, 18, 0.7);
    --bg-card-hover: rgba(25, 25, 30, 0.9);
    --border: rgba(212, 175, 55, 0.15);
    --border-active: #d4af37;

    --text-primary: #ffffff;
    --text-secondary: #fdf5e6; /* Old Lace */
    --text-muted: #8b8374;

    --accent-gold: #d4af37;
    --accent-champagne: #f7e7ce;
    --accent-rose: #e8b0b0;
    --accent-blue: #d4af37;
    --accent-teal: #f59e0b;
    --accent-green: #10b981;
    --accent-yellow: #fbbf24;
    --accent-red: #ef4444;
    --accent-purple: #a78bfa;

    --gradient-gold: linear-gradient(135deg, #d4af37 0%, #f7e7ce 30%, #ffd700 50%, #f7e7ce 70%, #9a7d2e 100%);
    --gradient-blue: var(--gradient-gold);
    --gradient-green: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --gradient-warn: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --gradient-red: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    --gradient-purple: linear-gradient(135deg, #7c3aed 0%, #c084fc 100%);

    --shadow-card: 0 15px 50px rgba(0, 0, 0, 0.98), 0 0 30px rgba(212, 175, 55, 0.08);
    --shadow-hover: 0 25px 90px rgba(212, 175, 55, 0.25);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --glass-blur: blur(45px) saturate(280%);
    --glass-bg: rgba(5, 5, 6, 0.88);
    --glass-border: 1px solid rgba(212, 175, 55, 0.2);
    
    --grid-color: rgba(212, 175, 55, 0.08);
    --selection-bg: rgba(212, 175, 55, 0.3);
    --selection-text: #ffffff;
    --card-glow: 0 0 50px rgba(212, 175, 55, 0.1);
    --premium-glow: radial-gradient(circle at 50% -20%, rgba(212, 175, 55, 0.2) 0%, transparent 70%);
}

[data-theme="luxe"] body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--premium-glow);
    pointer-events: none;
    z-index: 100;
}

[data-theme="luxe"] ::selection {
    background: var(--selection-bg);
    color: var(--selection-text);
}

/* --- Luxe Button Overrides --- */
[data-theme="luxe"] .btn-primary {
    background: var(--gradient-gold);
    color: #0a0a0b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

[data-theme="luxe"] .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.5);
}

[data-theme="luxe"] .btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(212, 175, 55, 0.2);
    color: var(--accent-champagne);
}

[data-theme="luxe"] .btn-secondary:hover {
    background: rgba(212, 175, 55, 0.05);
    border-color: var(--accent-gold);
}

/* --- Luxe Sidebar Logo --- */
[data-theme="luxe"] .sidebar-brand svg path {
    stroke: var(--accent-gold) !important;
}

[data-theme="luxe"] .sidebar-brand svg text {
    fill: var(--accent-champagne) !important;
}

[data-theme="luxe"] .sidebar-brand svg line {
    stroke: var(--accent-gold) !important;
    filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.4));
}

[data-theme="luxe"] .brand-text h2 {
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Luxe Sidebar Overrides --- */
[data-theme="luxe"] .sidebar {
    background: rgba(10, 10, 11, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(212, 175, 55, 0.1);
}

.sidebar {
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Fluid custom scrollbar applies globally, but make sidebar slightly thinner */
.sidebar::-webkit-scrollbar {
    width: 8px;
}
.sidebar::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
}
.sidebar:hover::-webkit-scrollbar-thumb {
    background-color: rgba(140, 140, 140, 0.4);
}

[data-theme="luxe"] .nav-item.active {
    background: rgba(212, 175, 55, 0.1);
    border-left: 3px solid var(--accent-gold);
    color: var(--accent-gold);
}

[data-theme="luxe"] .nav-item ion-icon {
    color: var(--accent-gold);
    opacity: 0.8;
}

[data-theme="luxe"] .nav-item:hover ion-icon {
    opacity: 1;
    transform: scale(1.1);
}

/* ================================================================
   PREMIUM VISUALS & ANIMATIONS
   ================================================================ */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    background-image: 
        radial-gradient(circle at 50% 50%, transparent 0%, var(--bg-base) 100%),
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    opacity: 0.9;
    transition: opacity 1s ease;
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

.shimmer {
    background: linear-gradient(90deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.05) 50%, 
        rgba(255,255,255,0) 100%);
    background-size: 1000px 100%;
    animation: shimmer 3s infinite linear;
}

/* --- Luxe v2.0 Utilities --- */
.glass-premium {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.glass-premium::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.01) 45%,
        rgba(255, 255, 255, 0.03) 50%,
        rgba(255, 255, 255, 0.01) 55%,
        transparent
    );
    transform: rotate(-45deg);
    transition: 0.8s;
    pointer-events: none;
}

.glass-premium:hover::after {
    left: 100%;
    top: 100%;
}

.text-gradient-gold {
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    filter: drop-shadow(0 2px 10px rgba(212, 175, 55, 0.2));
}

[data-theme="luxe"] ::-webkit-scrollbar {
    width: 8px;
}

[data-theme="luxe"] ::-webkit-scrollbar-track {
    background: var(--bg-base);
}

[data-theme="luxe"] ::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, transparent, var(--accent-gold), transparent);
    border-radius: 10px;
}

/* ================================================================
   COMPACT SIDEBAR DENSITY
   ================================================================ */
.sidebar.compact .nav-item { padding: 6px 14px !important; font-size: 0.78rem !important; }
.sidebar.compact .nav-section-label { margin: 10px 0 4px 14px !important; font-size: 0.6rem !important; }

/* ================================================================
   META LIGHT (DREAMY) - SURPRISING HOVER STATES & MOTION
   ================================================================ */
[data-theme="light"] .kpi-card,
[data-theme="light"] .card,
[data-theme="light"] .chart-box {
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

/* 3D Float effect for cards */
.kpi-card,
.card,
.chart-box {
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), 
                box-shadow 0.6s cubic-bezier(0.22, 1, 0.36, 1), 
                border-color 0.4s ease,
                background 0.4s ease;
    will-change: transform, box-shadow;
}

.kpi-card:hover,
.card:hover,
.chart-box:hover {
    transform: translateY(-12px) scale(1.02) perspective(1500px) rotateX(4deg);
    box-shadow: var(--shadow-hover), 0 15px 45px -15px rgba(0,0,0,0.6);
    border-color: var(--border-active);
    z-index: 10;
    background: var(--bg-card-hover);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.1);
}

[data-theme="luxe"] .kpi-card:hover,
[data-theme="luxe"] .card:hover,
[data-theme="luxe"] .chart-box:hover {
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.15);
    border-color: var(--accent-gold);
}

/* Interactive Table Rows - Glowing slide */
[data-theme="light"] .data-table tr td,
[data-theme="light"] .ncr-table tr td {
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
}

[data-theme="light"] .data-table tr:hover td,
[data-theme="light"] .ncr-table tr:hover td {
    background: linear-gradient(90deg, #ffffff 0%, #faf5f6 100%);
    color: var(--text-primary);
    transform: scale(1.005);
}

[data-theme="light"] .data-table tr:hover td:first-child,
[data-theme="light"] .ncr-table tr:hover td:first-child {
    box-shadow: inset 4px 0 0 var(--accent-purple);
    padding-left: 20px;
    /* Slight push inwards */
}

/* Interactive Primary Buttons - Shine & Lift */
[data-theme="light"] .btn-primary {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .btn-primary::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    transform: skewX(-25deg);
    transition: all 0.6s ease;
}

[data-theme="light"] .btn-primary:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(159, 188, 228, 0.6);
}

/* --- Shimmer Loading Effect --- */
.shimmer {
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
}

.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.03) 20%,
        rgba(255, 255, 255, 0.08) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

[data-theme="light"] .btn-primary:hover::after {
    left: 200%;
}

/* Row Action Buttons - Playful pop and tilt */
.row-btn {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s ease, color 0.3s ease, box-shadow 0.3s;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.row-btn:hover {
    transform: translateY(-4px) rotate(10deg) scale(1.1);
    box-shadow: 0 8px 20px rgba(167, 139, 250, 0.3);
}

[data-theme="light"] .row-btn:hover {
    box-shadow: 0 8px 20px rgba(159, 188, 228, 0.4);
    background: var(--bg-card);
    border: 1px solid var(--border-active);
}

/* --- Reset --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-base);
    background-image: var(--noise);
    background-blend-mode: overlay;
    color: var(--text-primary);
    margin: 0;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Global Icon Fix - Standardized Centering & Sizing */
ion-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: -0.125em !important; /* Better baseline alignment */
    line-height: 1 !important;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Internal centering for the SVG */
    --ionicon-stroke-width: 32px;
    pointer-events: none; /* Usually icons shouldn't block clicks */
}

/* Vertical Positioning Fix for Buttons & Interactive Elements */
button ion-icon, 
.btn-secondary ion-icon, 
.btn-primary ion-icon,
.nav-item ion-icon,
.breadcrumb ion-icon,
.user-chip ion-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.btn-primary ion-icon, .btn-secondary ion-icon {
    margin-right: 10px;
    font-size: 1.15em;
}

/* --- Brand Logo Container & Standardized Animations --- */
.brand-logo-container {
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px;
    border: var(--glass-border);
    transition: var(--transition);
}

.brand-logo-container:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.brand-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
    filter: drop-shadow(0 0 12px rgba(0, 230, 153, 0.15));
}

@keyframes metaFadeIn { from { opacity: 0; transform: scale(0.98) } to { opacity: 1; transform: scale(1) } }
@keyframes metaDraw { to { stroke-dashoffset: 0 } }
@keyframes metaSlideUp { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: translateY(0) } }

.meta-fade-in { animation: metaFadeIn 0.8s ease-out forwards; }
.meta-draw { animation: metaDraw 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.meta-slide-up { animation: metaSlideUp 0.8s ease-out forwards; }

/* Standard Sidebar Logo Styles */
.sidebar-brand {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.brand-text {
    margin-top: 4px;
    position: relative;
}

/* Dynamic Mesh Background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 15% 15%, rgba(0, 200, 150, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(0, 209, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(167, 139, 250, 0.03) 0%, transparent 60%);
    z-index: -1;
    animation: backgroundShift 40s ease-in-out infinite alternate;
    pointer-events: none;
}

/* Glassmorphism Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-pill {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 40px;
    padding: 6px 14px;
}

/* Antigravity Floating Utility */
.floating {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(0.5deg); }
}

/* Entrance Animations */
.anime-slide-up {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Noise Texture Overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3e%3cfilter id='noiseFilter'%3e%3cturbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3e%3c/filter%3e%3crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3e%3c/svg%3e");
    opacity: 0.02;
    pointer-events: none;
    z-index: 9999;
}

@keyframes backgroundShift {
    0% {
        transform: rotate(0deg) scale(1);
    }

    100% {
        transform: rotate(5deg) scale(1.1);
    }
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input,
select {
    font-family: inherit;
}

/* ================================================================
   BUTTONS (Neo-Glass)
   ================================================================ */
.btn-primary {
    background: var(--gradient-blue);
    color: #000;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-bounce);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 25px rgba(0, 200, 150, 0.3);
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 15px 35px rgba(0, 200, 150, 0.4),
        0 0 50px rgba(0, 200, 150, 0.2);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition-bounce);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.btn-primary ion-icon, .btn-secondary ion-icon {
    font-size: 1.15rem;
    margin-bottom: 0.1em; /* Subtle adjustment for baseline */
}

/* AI / Special Action Buttons */
.btn-gem {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: #0d1117;
    border: none;
    border-radius: 12px;
    padding: 10px 18px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-bounce);
    box-shadow: 0 8px 20px rgba(0, 242, 254, 0.3);
}

.btn-gem:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0, 242, 254, 0.4);
    filter: brightness(1.1);
}

.btn-gen {
    background: rgba(79, 172, 254, 0.12);
    color: var(--accent-teal);
    border: 1px solid rgba(79, 172, 254, 0.3);
    border-radius: 12px;
    padding: 9px 16px;
    font-weight: 700;
    font-size: 0.83rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-gen:hover {
    background: rgba(79, 172, 254, 0.2);
    border-color: rgba(79, 172, 254, 0.5);
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; display: inline-block; }

/* ================================================================
   MODALS & FORMS (Centralized)
   ================================================================ */
.form-modal, .prompt-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(14px) saturate(180%);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.form-modal.open, .prompt-modal.open { display: flex; }

.form-box, .prompt-box {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border-heavy);
    border-radius: 28px;
    width: 100%;
    max-width: 600px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow-y: auto;
    max-height: 90vh;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.form-box h2, .prompt-box h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--accent-blue);
    margin-bottom: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input,
.form-group select,
.form-group textarea,
.prompt-textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

.prompt-textarea {
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
    min-height: 250px;
    line-height: 1.6;
}

.form-group input:focus,
.form-group select:focus,
.prompt-textarea:focus {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 20px rgba(0, 200, 150, 0.15);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 10px;
}

.prompt-info {
    background: rgba(0, 200, 150, 0.08);
    border: 1px solid rgba(0, 200, 150, 0.2);
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.5;
}

.prompt-info ion-icon {
    color: var(--accent-blue);
    font-size: 1.2rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

p {
    line-height: 1.6;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* ================================================================
   LAYOUT
   ================================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.brand-text h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-text p {
    font-size: 0.7rem;
    color: var(--accent-blue);
    margin: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.db-status {
    padding: 8px 16px;
    margin: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.db-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.db-status.online { color: var(--accent-blue); border-color: rgba(132, 204, 22, 0.2); }
.db-status.online .dot { background: var(--accent-blue); box-shadow: 0 0 10px var(--accent-blue); }

.nav-section-label {
    padding: 0 24px;
    margin: 20px 0 8px;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

/* ================================================================
   SIDEBAR & NAVIGATION
   ================================================================ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(to bottom, rgba(255,255,255,0.02), transparent);
}

.brand-logo-container {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.brand-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 10px rgba(0, 230, 153, 0.3));
}

.sidebar-brand:hover .brand-logo-container {
    border-color: var(--accent-blue);
    background: rgba(0, 230, 153, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(0, 230, 153, 0.3);
}

.sidebar-brand:hover .brand-logo-container::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, rgba(0, 230, 153, 0.2) 0%, transparent 70%);
}

.brand-text h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-text p {
    font-size: 0.7rem;
    color: var(--accent-blue);
    margin: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.db-status {
    padding: 8px 16px;
    margin: 12px 16px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.db-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.db-status.online { color: var(--accent-blue); border-color: rgba(132, 204, 22, 0.2); }
.db-status.online .dot { background: var(--accent-blue); box-shadow: 0 0 10px var(--accent-blue); }

.nav-section-label {
    padding: 0 24px;
    margin: 20px 0 8px;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.nav-menu {
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    padding: 8px 16px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid transparent;
    margin-bottom: 2px;
}

.nav-item ion-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition-bounce);
    position: relative;
    z-index: 1;
    color: var(--text-secondary);
    --ionicon-stroke-width: 32px;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateX(8px);
}

.nav-item:hover ion-icon {
    background: rgba(0, 230, 153, 0.08);
    transform: scale(1.1) rotate(-8deg);
    color: var(--accent-blue);
    border-color: rgba(0, 230, 153, 0.15);
}

.nav-item.active {
    color: var(--text-primary);
    background: rgba(0, 230, 153, 0.06);
    border: 1px solid rgba(0, 230, 153, 0.15);
    box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.5);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 15%; bottom: 15%; width: 4px;
    background: var(--accent-blue);
    border-radius: 0 4px 4px 0;
    box-shadow: 4px 0 15px var(--accent-blue);
    z-index: 2;
}

.nav-item.active ion-icon {
    color: #000;
    background: var(--gradient-blue);
    box-shadow: 0 0 20px rgba(0, 230, 153, 0.4);
    transform: scale(1.1) rotate(-5deg);
    border-color: transparent;
}

.sidebar-footer {
    margin-top: auto;
    padding: 24px;
    border-top: 1px solid var(--border);
}

.sidebar-clock {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ================================================================
   MAIN CONTENT & HEADER
   ================================================================ */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-header {
    height: var(--header-h);
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.breadcrumb a:hover {
    color: var(--text-primary);
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 700;
}

.breadcrumb ion-icon {
    font-size: 0.8rem;
    opacity: 0.5;
}

.header-search {
    flex: 1;
    max-width: 480px;
    background: rgba(10, 10, 15, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition-bounce);
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.05),
        0 20px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(25px) saturate(200%);
}

.header-search:focus-within {
    border-color: var(--accent-blue);
    background: rgba(15, 15, 25, 0.6);
    box-shadow: 
        0 0 40px rgba(0, 230, 153, 0.15), 
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    transform: scale(1.02) translateY(-2px);
}

.header-search ion-icon {
    font-size: 1.3rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.header-search:focus-within ion-icon {
    color: var(--accent-blue);
    transform: scale(1.1);
}

.header-search input {
    background: none;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-size: 0.92rem;
    font-weight: 500;
}

.search-hint {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: 700;
    margin-left: auto;
    opacity: 0.8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    position: relative;
    transition: var(--transition-bounce);
    cursor: pointer;
}

.header-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 200, 150, 0.2);
}

.dot-count {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    padding: 5px 5px 5px 16px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition-bounce);
    cursor: pointer;
    box-shadow: 
        inset 0 1px 1px rgba(255,255,255,0.05),
        0 4px 15px rgba(0,0,0,0.2);
    backdrop-filter: blur(8px);
}

.user-chip:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(0, 230, 153, 0.1);
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.2px;
}

.user-role {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 2px;
}

.user-chip img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--bg-base);
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
    transition: var(--transition-bounce);
}

.user-chip:hover img {
    transform: scale(1.1);
    border-color: var(--accent-blue);
}

/* ================================================================
   PAGE CONTENT AREA
   ================================================================ */
.page-content {
    padding: 28px;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

.page-tabs {
    display: flex;
    gap: 4px;
}

/* ================================================================
   KPI CARDS
   ================================================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.kpi-card {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    backdrop-filter: var(--glass-blur);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 30px 60px -15px rgba(0, 0, 0, 0.6),
        inset 0 1px 1px rgba(255, 255, 255, 0.1); /* Edge highlight */
    border-radius: 28px;
    padding: 26px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-bounce);
}

/* Premium Border Gradient effect */
.kpi-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 50%, rgba(255, 255, 255, 0.05));
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: destination-out;
    pointer-events: none;
}

.kpi-card:hover {
    transform: translateY(-6px) scale(1.01);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7);
}

.kpi-card.blue:hover { box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 242, 254, 0.1); }
.kpi-card.red:hover { box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), 0 0 30px rgba(244, 63, 94, 0.1); }
.kpi-card.green:hover { box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 230, 153, 0.1); }
.kpi-card.warn:hover { box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), 0 0 30px rgba(251, 191, 36, 0.1); }

.kpi-card:hover::before {
    top: -50%;
    left: -50%;
}

.kpi-icon {
    width: 60px;
    height: 60px;
    min-width: 60px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.5),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    transition: var(--transition-bounce);
    color: var(--text-primary);
    position: relative;
    z-index: 2;
}

/* Theme Specific KPI Glows - Softened for 'Drastic' Elegance */
.kpi-card.blue .kpi-icon { color: var(--accent-teal); border-color: rgba(0, 242, 254, 0.3); box-shadow: 0 0 20px rgba(0, 242, 254, 0.15); }
.kpi-card.red .kpi-icon { color: var(--accent-red); border-color: rgba(244, 63, 94, 0.3); box-shadow: 0 0 20px rgba(244, 63, 94, 0.15); }
.kpi-card.green .kpi-icon { color: var(--accent-blue); border-color: rgba(0, 230, 153, 0.3); box-shadow: 0 0 20px rgba(0, 230, 153, 0.15); }
.kpi-card.warn .kpi-icon { color: var(--accent-yellow); border-color: rgba(251, 191, 36, 0.3); box-shadow: 0 0 20px rgba(251, 191, 36, 0.15); }

.kpi-card:hover .kpi-icon {
    transform: scale(1.15) rotate(8deg);
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 0 45px currentColor,
        inset 0 1px 10px rgba(255, 255, 255, 0.3);
}

/* Pulsing effect for critical alerts (NCRs) */
.kpi-card.red:hover .kpi-icon ion-icon {
    animation: kpiPulse 1.2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes kpiPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.kpi-value {
    font-size: 2.4rem;
    font-weight: 800;
    font-family: var(--font-heading);
    letter-spacing: -1.5px;
    background: linear-gradient(180deg, #fff 40%, rgba(255, 255, 255, 0.5) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin-bottom: 2px;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.5));
}

.kpi-trend {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-trend.up {
    color: var(--accent-green);
}

/* ================================================================
   GLASS UTILITIES & CARDS
   ================================================================ */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur) saturate(180%);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 
        0 20px 50px -12px rgba(0, 0, 0, 0.8),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    z-index: 2;
}

/* ================================================================
   RESOURCE CARDS (Hub & Lists)
   ================================================================ */
.resource-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition-bounce);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.resource-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-hover);
}

.resource-card .icon-box {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent-blue);
    transition: var(--transition-bounce);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.resource-card:hover .icon-box {
    background: var(--gradient-blue);
    color: #000;
    transform: rotate(10deg) scale(1.1);
    box-shadow: 0 0 20px var(--accent-blue);
}

.res-text h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.file-actions {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.resource-card:hover .file-actions {
    opacity: 1;
}

.action-btn {
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    transform: scale(1.1);
}

.res-text p {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.glass-card:hover {
    transform: translateY(-8px) scale(1.01);
    border-color: rgba(0, 200, 150, 0.4);
    box-shadow: 
        0 40px 80px -15px rgba(0, 0, 0, 0.9),
        0 0 30px rgba(0, 200, 150, 0.1);
}

/* ================================================================
   WORKFLOW STEPPER
   ================================================================ */
.workflow-stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 40px;
    padding: 0 20px;
}

.workflow-stepper::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 50px;
    right: 50px;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 0;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 1;
    width: 100px;
    position: relative;
}

.step-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #0d1117;
    border: 2px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
    transition: var(--transition-bounce);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.step-item.active .step-circle {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #000;
    box-shadow: 0 0 20px var(--accent-blue);
    transform: scale(1.15);
}

.step-item.completed .step-circle {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 200, 150, 0.3);
}

.step-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-align: center;
}

.step-item.active .step-label { color: var(--text-primary); }

/* ================================================================
   NCR CARDS & RCA
   ================================================================ */
.ncr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 28px;
}

.ncr-card {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.meta-pill {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 0.72rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.meta-pill ion-icon {
    font-size: 0.95rem;
    color: var(--accent-blue);
}

.meta-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.rca-guide {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.12) 0%, rgba(0, 200, 150, 0.05) 100%);
    border: 1px solid rgba(167, 139, 250, 0.25);
    border-radius: 18px;
    padding: 22px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.rca-guide::before {
    content: '';
    position: absolute;
    top: -20px; right: -20px;
    width: 80px; height: 80px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.2) 0%, transparent 70%);
}

.rca-guide h4 {
    color: var(--accent-purple);
    font-weight: 800;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.why-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 18px;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    transition: var(--transition-bounce);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.why-input:focus {
    border-color: var(--accent-purple);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.15), inset 0 2px 4px rgba(0,0,0,0.4);
    transform: scale(1.01);
}

.card:hover {
    box-shadow:
        0 30px 60px -15px rgba(0, 0, 0, 0.8),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-5px);
}

.card-header {
    padding: 22px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(0,0,0,0.2);
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.card-header h2 ion-icon {
    color: var(--accent-blue);
    font-size: 1.4rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.04) 100%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 
        0 8px 16px rgba(0,0,0,0.45), 
        inset 0 1px 4px rgba(255,255,255,0.3);
    transition: var(--transition-bounce);
}

.card:hover .card-header h2 ion-icon {
    transform: scale(1.1) rotate(-5deg);
    border-color: var(--accent-blue);
    box-shadow: 0 0 20px rgba(0, 200, 150, 0.3);
}

.card-body {
    padding: 28px;
}

/* ================================================================
   STATUS BADGE
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    transition: var(--transition-bounce);
    box-shadow: 
        0 4px 10px rgba(0, 0, 0, 0.2),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

.badge ion-icon {
    font-size: 1rem;
}

.badge::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.badge:hover {
    transform: translateY(-2px) scale(1.05);
    filter: brightness(1.2);
}

.badge:hover::after {
    transform: translateX(100%);
}

.badge.green {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
}

.badge.yellow {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.2);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.1);
}

.badge.red {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
    border-color: rgba(244, 63, 94, 0.2);
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.1);
}

.badge.blue {
    background: rgba(0, 242, 254, 0.1);
    color: #00f2fe;
    border-color: rgba(0, 242, 254, 0.2);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.1);
}

.badge.purple {
    background: rgba(167, 139, 250, 0.1);
    color: #a78bfa;
    border-color: rgba(167, 139, 250, 0.2);
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.1);
}

/* ================================================================
   DATA TABLE
   ================================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-primary); /* High contrast */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(5px);
}

.data-table td {
    padding: 16px 20px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    transition: all 0.3s ease;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: scale(1.002);
}

.data-table tr:hover {
    background: linear-gradient(90deg, rgba(0, 230, 153, 0.08), transparent);
    box-shadow: 
        inset 4px 0 0 var(--accent-blue),
        0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.data-table td strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* ================================================================
   CHARTS GRID
   ================================================================ */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.chart-box {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
}

.chart-box h3 {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-box h3 ion-icon {
    color: var(--accent-blue);
    font-size: 1.3rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.03) 100%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4), inset 0 1px 3px rgba(255,255,255,0.3);
}

.chart-canvas-wrap {
    position: relative;
    height: 180px;
}

/* ================================================================
   DOCUMENT HUB FOLDER GRID
   ================================================================ */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.folder-tile {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.folder-tile::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-blue);
    transform: scaleX(0);
    transition: var(--transition);
}

.folder-tile:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7), var(--shadow-hover);
    border-color: var(--accent-blue);
    background: var(--bg-card-hover);
}

.folder-tile:hover::after {
    transform: scaleX(1);
}

.folder-tile .icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 2px 10px rgba(255,255,255,0.03), 0 8px 20px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-blue);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.folder-tile:hover .icon {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.25) 0%, rgba(79, 172, 254, 0.05) 100%);
    transform: scale(1.15) translateY(-5px);
    box-shadow: inset 0 2px 6px rgba(255,255,255,0.3), 0 15px 30px rgba(79, 172, 254, 0.3);
    border-color: rgba(79, 172, 254, 0.4);
}

.folder-tile h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

.folder-tile p {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.folder-tile .open-arrow {
    margin-top: auto;
    font-size: 0.7rem;
    color: var(--accent-blue);
    opacity: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.folder-tile:hover .open-arrow {
    opacity: 1;
}

/* ================================================================
   FILE LIST PAGE
   ================================================================ */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}

.file-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.file-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-active);
}

.file-card .file-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.file-card .file-icon.pdf {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.file-card .file-icon.excel {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.file-card .file-icon.word {
    background: rgba(79, 172, 254, 0.15);
    color: var(--accent-blue);
}

.file-card .file-icon.other {
    background: rgba(167, 139, 250, 0.15);
    color: var(--accent-purple);
}

.file-card h5 {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
}

.file-card .subfolder {
    font-size: 0.68rem;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: 20px;
    width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.file-card .file-size {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.file-card .file-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
}

.file-btn {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.file-btn.view {
    background: rgba(79, 172, 254, 0.15);
    color: var(--accent-blue);
}

.file-btn.view:hover {
    background: rgba(79, 172, 254, 0.3);
}

.file-btn.download {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.file-btn.download:hover {
    background: rgba(34, 197, 94, 0.3);
}

/* ================================================================
   INLINE FILE VIEWER MODAL
   ================================================================ */
.viewer-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.viewer-modal.open {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.viewer-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 92vw;
    height: 92vh;
    max-width: 1300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    gap: 14px;
}

.viewer-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-header h3 ion-icon {
    color: var(--accent-blue);
    flex-shrink: 0;
}

.viewer-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.viewer-btn {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    background: var(--bg-card);
}

.viewer-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-active);
}

.viewer-btn.primary {
    background: rgba(79, 172, 254, 0.15);
    color: var(--accent-blue);
    border-color: rgba(79, 172, 254, 0.3);
}

.viewer-btn.primary:hover {
    background: rgba(79, 172, 254, 0.25);
}

.viewer-btn.close-btn {
    color: var(--accent-red);
}

.viewer-frame {
    flex: 1;
    border: none;
    background: #fff;
    width: 100%;
    height: 100%;
}

.viewer-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: var(--accent-blue);
    opacity: 0;
    transition: var(--transition);
}

/* SPECIFIC KPI COLORS */
.kpi-card.blue { --accent-blue: #84cc16; }
.kpi-card.red { --accent-blue: #ef4444; }
.kpi-card.green { --accent-blue: #10b981; }
.kpi-card.warn { --accent-blue: #f59e0b; }
.kpi-card.purple { --accent-blue: #a78bfa; }

/* Download permission dialog */
.download-confirm {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    max-width: 400px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: slideUp 0.2s ease;
}

.download-confirm ion-icon {
    font-size: 2.5rem;
    color: var(--accent-yellow);
}

.download-confirm h3 {
    font-size: 1rem;
}

.download-confirm p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.download-confirm .btn-row {
    display: flex;
    gap: 10px;
}

.btn-primary {
    padding: 9px 20px;
    background: var(--accent-blue);
    color: #fff;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    padding: 9px 20px;
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    color: var(--text-primary);
}

/* ================================================================
   TESTING STATUS SECTION
   ================================================================ */
.testing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.testing-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}

.testing-item .project-id {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.status-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-size: 1.3rem;
}

.status-circle.pass {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.status-circle.fail {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.status-circle.prog {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
}

.status-circle.pend {
    background: rgba(79, 172, 254, 0.12);
    color: var(--accent-blue);
}

.testing-item .phase {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow-card);
    animation: slideInRight 0.3s ease;
    transition: var(--transition);
}

@keyframes slideInRight {
    from {
        transform: translateX(60px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast ion-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.toast.success ion-icon {
    color: var(--accent-green);
}

.toast.error ion-icon {
    color: var(--accent-red);
}

.toast.info ion-icon {
    color: var(--accent-blue);
}

.toast-body h4 {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.toast-body p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ================================================================
   SPIN ANIMATION
   ================================================================ */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}

.empty-state ion-icon {
    font-size: 3.5rem;
    opacity: 0.4;
}

.empty-state h3 {
    color: var(--text-secondary);
    font-size: 1rem;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 300px;
}

/* ================================================================
   BUTTON ROW
   ================================================================ */
.btn-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ================================================================
   PROGRESS BAR
   ================================================================ */
.progress-bar {
    height: 6px;
    background: var(--bg-surface);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--gradient-blue);
    transition: width 0.5s ease;
}

.progress-fill.green {
    background: var(--gradient-green);
}

.progress-fill.warn {
    background: var(--gradient-warn);
}

.progress-fill.red {
    background: var(--gradient-red);
}

/* ================================================================
   TROPICAL NEON MIDNIGHT (ALOHA) ATMOSPHERE ORBS (DEFAULT)
   ================================================================ */

body {
    position: relative;
}

body::before,
body::after {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    opacity: 0.25;
    pointer-events: none;
    animation: orbFloat 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
    transition: opacity 0.5s ease;
}

/* Neon Cyan */
body::before {
    background: #00f2fe;
    top: -10%;
    left: -10%;
}

/* Tropical Purple/Pink */
body::after {
    background: #a78bfa;
    bottom: -10%;
    right: -10%;
    animation-delay: -10s;
}

/* Hide orbs in Light Mode for clarity */
[data-theme="light"] body::before,
[data-theme="light"] body::after {
    opacity: 0;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
    background-clip: content-box;
}

@keyframes orbFloat {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.15);
    }
}

@keyframes backgroundShift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-5%, -5%) scale(1.05); }
    100% { transform: translate(5%, 5%) scale(1); }
}

/* ================================================================
   STAGGERED "WATERFALL" PAGE LOAD ANIMATIONS 
   ================================================================ */

@keyframes waterfallSlideRight {
    0% {
        opacity: 0;
        transform: translateX(-40px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes waterfallSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-40px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes waterfallSlideUp {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Assigning the waterfall animations to core layout pieces */
.sidebar {
    animation: waterfallSlideRight 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.top-header {
    opacity: 0;
    animation: waterfallSlideDown 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.1s;
}

.page-header {
    opacity: 0;
    animation: waterfallSlideRight 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.2s;
}

/* Specific staggered waterfall for the KPI metric cards */
.kpi-card {
    opacity: 0;
    animation: waterfallSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.kpi-card:nth-child(1) {
    animation-delay: 0.2s;
}

.kpi-card:nth-child(2) {
    animation-delay: 0.3s;
}

.kpi-card:nth-child(3) {
    animation-delay: 0.4s;
}

.kpi-card:nth-child(4) {
    animation-delay: 0.5s;
}

/* Further staggering for other content blocks */
.charts-grid .chart-box,
.ncr-table-wrap,
.card {
    opacity: 0;
    animation: waterfallSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0.6s;
}

/* Clinical Design Markers */
.card::after,
.chart-box::after {
    content: 'REF. META-QC.';
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 0.5rem;
    font-family: 'Courier New', monospace;
    color: var(--text-muted);
    opacity: 0.4;
    letter-spacing: 1px;
    pointer-events: none;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 10px;
    height: 10px;
    border-top: 1px solid var(--accent-blue);
    border-left: 1px solid var(--accent-blue);
    opacity: 0.3;
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

/* ================================================================
   RESPONSIVE DESIGN (MOBILE & TABLET)
   ================================================================ */

/* Tablet View (769px - 1024px): Icons-only sidebar */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --sidebar-w: 70px !important;
    }

    .sidebar-brand .brand-text,
    .nav-item span,
    .nav-section-label,
    .db-status span {
        display: none !important;
    }

    .sidebar {
        width: 70px !important;
        transition: var(--transition);
    }

    .main-content {
        margin-left: 70px !important;
    }
}

/* Mobile View (768px and below) */
@media (max-width: 768px) {
    :root {
        --sidebar-w: 0px !important;
        --header-h: 60px !important;
    }

    .app-layout {
        display: block !important;
        width: 100vw !important;
        overflow-x: hidden !important;
    }

    .sidebar {
        position: fixed !important;
        left: -280px !important;
        width: 280px !important;
        z-index: 2000 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .sidebar.mobile-open {
        left: 0 !important;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5) !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .top-header {
        padding: 0 10px !important;
        gap: 6px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }


    /* Breadcrumb: Only show current page */
    .page-breadcrumb ion-icon,
    .page-breadcrumb span:not(.current) {
        display: none !important;
    }

    .page-breadcrumb .current {
        font-size: 0.85rem !important;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-search {
        display: none !important;
    }

    .header-select {
        max-width: 90px !important;
        font-size: 0.75rem !important;
        padding: 4px 6px !important;
    }

    /* Header Actions: Ensure icons are visible */
    .header-actions {
        display: flex !important;
        gap: 6px !important;
        min-width: auto !important;
        flex-shrink: 0;
    }

    #settingsBtn, #logoutBtn {
        display: flex !important;
    }

    .header-btn, 
    .header-actions .btn-primary, 
    .header-actions .btn-secondary {
        width: 34px !important;
        height: 34px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        font-size: 0 !important; /* Hide text */
        border-radius: 8px !important;
        min-width: 34px !important;
        margin: 0 !important;
    }

    .header-btn ion-icon, 
    .header-actions .btn-primary ion-icon, 
    .header-actions .btn-secondary ion-icon {
        font-size: 1.25rem !important;
        margin: 0 !important;
        display: block !important;
    }

    /* Optimized mobile header actions */
    .header-actions {
        display: flex !important;
    }

    .header-actions > * {
        display: flex !important;
    }

    /* User Chip: Avatar only */
    .user-chip {
        padding: 2px !important;
        background: transparent !important;
        border: none !important;
    }

    .user-chip span {
        display: none !important;
    }

    .user-chip img {
        width: 32px !important;
        height: 32px !important;
        border: 1px solid var(--border);
    }

    .mobile-nav-toggle {
        display: flex !important;
        width: 34px !important;
        height: 34px !important;
        margin-right: 2px !important;
    }

    .page-content {
        padding: 12px !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    .card, .today-banner, .status-board {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Force status cards to stack if they overflow */
    .status-board {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* KPI Grid: 2 columns with tighter padding */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 20px !important;
    }

    .kpi-card {
        padding: 14px !important;
        gap: 8px !important;
        border-radius: 16px !important;
    }

    .kpi-icon {
        width: 34px !important;
        height: 34px !important;
        font-size: 1.1rem !important;
    }

    .kpi-data h3 {
        font-size: 0.65rem !important;
    }

    .kpi-value {
        font-size: 1.15rem !important;
    }

    .kpi-trend {
        font-size: 0.6rem !important;
    }

    .charts-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .chart-box {
        padding: 16px !important;
        border-radius: 20px !important;
    }

    .page-header h1 {
        font-size: 1.35rem !important;
    }

    /* Ensure text is visible in expanded mobile sidebar */
    .sidebar.mobile-open .brand-text,
    .sidebar.mobile-open .nav-item span,
    .sidebar.mobile-open .nav-section-label,
    .sidebar.mobile-open .db-status span {
        display: flex !important;
    }
}

/* Very small screens (iPhone SE, etc) */
@media (max-width: 360px) {
    .kpi-grid {
        grid-template-columns: 1fr !important;
    }
    
    .page-breadcrumb .current {
        max-width: 80px;
    }
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
}

.sidebar-overlay.active {
    display: block;
}

/* Default state for menu toggle */
.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 12px;
}

/* ================================================================
   DOCUMENT HUB - HIERARCHICAL VIEW
   ================================================================ */

.hub-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.crumb-link {
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.crumb-link:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.hub-breadcrumb ion-icon {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.hub-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    animation: metaFadeIn 0.5s ease-out forwards;
}

/* Folder Button Style */
.folder-button {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.folder-button:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 242, 254, 0.1);
}

.folder-icon {
    font-size: 2rem;
    color: var(--accent-yellow);
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 4px 8px rgba(245, 158, 11, 0.2));
}

.folder-details {
    flex: 1;
}

.folder-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}

.folder-arrow {
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.folder-button:hover .folder-arrow {
    transform: translateX(4px);
    color: var(--accent-blue);
}

/* Minimal File Card (for hierarchical view) */
.file-card.minimal {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.file-card.minimal:hover {
    border-color: var(--accent-teal);
    background: var(--bg-card-hover);
    transform: scale(1.02);
}

.file-card.minimal .file-icon {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    border-radius: 10px;
}

.file-card.minimal .file-info {
    flex: 1;
    overflow: hidden;
}

.file-card.minimal h5 {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.file-card.minimal .file-size {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.file-card.minimal .file-actions {
    display: flex;
    gap: 6px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.file-card.minimal:hover .file-actions {
    opacity: 1;
}

.file-card.minimal .file-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
}

.file-card.minimal .file-btn:hover {
    background: var(--accent-teal);
    color: white;
}

/* Folder Card: Optimized & Industrial */
.folder-tile.optimized {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0;
    overflow: hidden;
    height: auto;
    cursor: pointer;
    transition: var(--transition);
}

.folder-tile.optimized:hover {
    transform: translateY(-8px);
    border-color: var(--accent-blue);
    box-shadow: 0 20px 40px rgba(0, 242, 254, 0.1);
}

.folder-tile.optimized .folder-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}

.folder-header .icon-box {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--gradient-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.6rem;
    box-shadow: 0 8px 20px rgba(0, 200, 150, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.folder-meta-text h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.folder-meta-text p {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.folder-body {
    padding: 18px 24px;
    flex: 1;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 20px;
}

.folder-peek-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.folder-peek-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    min-width: 0; /* Important for flex-basis overflow */
}

.folder-peek-item span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.folder-peek-item ion-icon {
    font-size: 1rem;
    color: var(--accent-blue);
    flex-shrink: 0;
}

.empty-peek {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 10px 0;
}

.more-indicator {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
    padding-left: 20px;
}

.folder-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--border);
}

.folder-footer .badge {
    font-size: 0.65rem;
    font-weight: 700;
}

.open-action {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.3s ease;
}

.folder-tile.optimized:hover .open-action {
    transform: translateX(4px);
}

.folder-tile.optimized:hover .open-action ion-icon {
    animation: flashMove 0.8s infinite alternate;
}

@keyframes flashMove {
    from { transform: translateX(0); }
    to { transform: translateX(4px); }
}

/* Animations from Skill Repository */
@keyframes waterfallSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes waterfallSlideRight {
    to { opacity: 1; transform: translateX(0); }
}

/* --- Shared Components --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid rgba(255,255,255,0.05);
}

.badge.blue { background: rgba(0, 200, 150, 0.1); color: var(--accent-blue); }
.badge.red { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); }
.badge.green { background: rgba(16, 185, 129, 0.1); color: var(--accent-green); }
.badge.warn { background: rgba(245, 158, 11, 0.1); color: var(--accent-yellow); }
.badge ion-icon { font-size: 0.9rem; }

/* --- Toast System --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.success { border-left: 4px solid var(--accent-green); }
.toast.error { border-left: 4px solid var(--accent-red); }
.toast.info { border-left: 4px solid var(--accent-blue); }

.toast ion-icon { font-size: 1.4rem; flex-shrink: 0; }
.toast.success ion-icon { color: var(--accent-green); }
.toast.error ion-icon { color: var(--accent-red); }
.toast.info ion-icon { color: var(--accent-blue); }

.toast-body h4 { font-size: 0.85rem; margin-bottom: 4px; color: var(--text-primary); }
.toast-body p { font-size: 0.78rem; color: var(--text-secondary); margin: 0; }

/* ================================================================
   NCR & CAPA SPECIFIC STYLES
   ================================================================ */
.ncr-card-head { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
}

.ncr-id { 
    font-family: var(--font-heading); 
    font-size: 1.1rem; 
    font-weight: 800; 
    color: var(--accent-blue); 
    letter-spacing: -0.5px; 
}

.ncr-date { 
    font-size: 0.75rem; 
    color: var(--text-muted); 
}

.ncr-body { 
    font-size: 0.875rem; 
    color: var(--text-secondary); 
    line-height: 1.5; 
    flex-grow: 1; 
}

.ncr-meta { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    margin-top: 12px; 
}

.ncr-footer { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-top: 16px; 
    padding-top: 16px; 
    border-top: 1px solid var(--border); 
}

/* Side Panel (NCR Details/Form) */
.side-panel-bg { 
    position: fixed; 
    inset: 0; 
    background: rgba(0, 0, 0, 0.4); 
    backdrop-filter: blur(12px); 
    z-index: 1000; 
    visibility: hidden; 
    opacity: 0; 
    transition: var(--transition); 
}

.side-panel-bg.active { 
    visibility: visible; 
    opacity: 1; 
}

.side-panel { 
    position: fixed; 
    top: 0; 
    right: -650px; 
    width: min(650px, 95vw); 
    height: 100vh; 
    background: var(--bg-surface); 
    backdrop-filter: var(--glass-blur);
    border-left: 1px solid var(--glass-border-heavy); 
    z-index: 1001; 
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); 
    display: flex; 
    flex-direction: column; 
    box-shadow: -20px 0 80px rgba(0, 0, 0, 0.6); 
}

.side-panel.active { 
    right: 0; 
}

.panel-head { 
    padding: 32px; 
    border-bottom: 1px solid var(--border); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.panel-content { 
    padding: 32px; 
    flex-grow: 1; 
    overflow-y: auto; 
}

.panel-footer { 
    padding: 24px 32px; 
    border-top: 1px solid var(--border); 
    display: flex; 
    justify-content: flex-end; 
    gap: 12px; 
    background: rgba(255, 255, 255, 0.01); 
}

/* RCA & 5 Whys */
.rca-method-toggle { 
    display: flex; 
    gap: 8px; 
    margin-bottom: 24px; 
    padding: 6px; 
    background: rgba(255,255,255,0.03); 
    border-radius: 14px; 
    border: 1px solid var(--border); 
}

.five-whys { 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
}

.why-step { 
    display: grid; 
    grid-template-columns: 80px 1fr; 
    align-items: start; 
    gap: 16px; 
}

.why-label { 
    font-size: 0.7rem; 
    font-weight: 800; 
    color: var(--accent-purple); 
    text-transform: uppercase; 
    padding-top: 14px; 
    text-align: right; 
    letter-spacing: 1px;
}

/* ================================================================
   SYNC STATUS BADGE
   ================================================================ */
.header-status-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    user-select: none;
    backdrop-filter: blur(10px);
}

.header-status-badge:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.header-status-badge ion-icon {
    font-size: 1.1rem;
    color: var(--accent-blue);
    transition: transform 0.3s ease;
}

.header-status-badge:hover ion-icon {
    transform: scale(1.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4b4b4b;
    position: relative;
    transition: all 0.3s ease;
}

.header-status-badge.active {
    color: var(--text-primary);
    border-color: rgba(0, 230, 153, 0.2);
}

.header-status-badge.active .status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

.header-status-badge.active .status-dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--accent-green);
    animation: statusPulse 2s infinite ease-out;
}

.header-status-badge.syncing .status-dot {
    background: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue);
}

.header-status-badge.syncing ion-icon {
    animation: spin 2s linear infinite;
}

.header-status-badge.error .status-dot {
    background: #ef4444;
    box-shadow: 0 0 10px #ef4444;
}

.header-status-badge.offline .status-dot {
    background: var(--text-muted);
}

@keyframes statusPulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ================================================================
   META LUXE 2.0 STYLE EXPANSION FOR ALL THEMES
   Bringing premium aesthetics to every theme
   ================================================================ */

/* --- MIDNIGHT (ARCTIC COMMAND) PREMIUM UPGRADE --- */
[data-theme="midnight"] {
    --premium-glow: radial-gradient(circle at 50% -20%, rgba(125, 211, 252, 0.15) 0%, transparent 70%);
    --selection-bg: rgba(125, 211, 252, 0.3);
    --selection-text: #ffffff;
    --glass-bg: rgba(12, 20, 32, 0.88);
    --glass-border: 1px solid rgba(125, 211, 252, 0.2);
}
[data-theme="midnight"] body::before { content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--premium-glow); pointer-events: none; z-index: 100; }
[data-theme="midnight"] ::selection { background: var(--selection-bg); color: var(--selection-text); }
[data-theme="midnight"] .btn-primary { background: var(--gradient-blue); color: #000; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; border: none; box-shadow: 0 4px 15px rgba(125, 211, 252, 0.3); }
[data-theme="midnight"] .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(125, 211, 252, 0.5); }
[data-theme="midnight"] .brand-text h2 { background: var(--gradient-blue); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 2px 10px rgba(125, 211, 252, 0.2)); }
[data-theme="midnight"] .sidebar-brand svg path { stroke: var(--accent-blue) !important; filter: drop-shadow(0 0 5px rgba(125, 211, 252, 0.4)); }
[data-theme="midnight"] .sidebar-brand svg text { fill: #ffffff !important; }

/* --- SUNSET FORGE (META-DARK) PREMIUM UPGRADE --- */
[data-theme="meta-dark"] {
    --premium-glow: radial-gradient(circle at 50% -20%, rgba(231, 111, 81, 0.15) 0%, transparent 70%);
    --selection-bg: rgba(231, 111, 81, 0.3);
    --selection-text: #ffffff;
    --glass-bg: rgba(26, 16, 8, 0.88);
    --glass-border: 1px solid rgba(231, 111, 81, 0.2);
}
[data-theme="meta-dark"] body::before { content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--premium-glow); pointer-events: none; z-index: 100; }
[data-theme="meta-dark"] ::selection { background: var(--selection-bg); color: var(--selection-text); }
[data-theme="meta-dark"] .btn-primary { background: var(--gradient-blue); color: #000; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; border: none; box-shadow: 0 4px 15px rgba(231, 111, 81, 0.3); }
[data-theme="meta-dark"] .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(231, 111, 81, 0.5); }
[data-theme="meta-dark"] .brand-text h2 { background: var(--gradient-blue); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 2px 10px rgba(231, 111, 81, 0.2)); }
[data-theme="meta-dark"] .sidebar-brand svg path { stroke: var(--accent-blue) !important; filter: drop-shadow(0 0 5px rgba(231, 111, 81, 0.4)); }
[data-theme="meta-dark"] .sidebar-brand svg text { fill: #ffffff !important; }

/* --- OCEAN (ORGANIC TECH) PREMIUM UPGRADE --- */
[data-theme="ocean"] {
    --premium-glow: radial-gradient(circle at 50% -20%, rgba(34, 211, 238, 0.15) 0%, transparent 70%);
    --selection-bg: rgba(34, 211, 238, 0.3);
    --selection-text: #ffffff;
    --glass-bg: rgba(7, 15, 8, 0.88);
    --glass-border: 1px solid rgba(34, 211, 238, 0.2);
}
[data-theme="ocean"] body::before { content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--premium-glow); pointer-events: none; z-index: 100; }
[data-theme="ocean"] ::selection { background: var(--selection-bg); color: var(--selection-text); }
[data-theme="ocean"] .btn-primary { background: var(--gradient-blue); color: #000; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; border: none; box-shadow: 0 4px 15px rgba(34, 211, 238, 0.3); }
[data-theme="ocean"] .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(34, 211, 238, 0.5); }
[data-theme="ocean"] .brand-text h2 { background: var(--gradient-blue); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 2px 10px rgba(34, 211, 238, 0.2)); }
[data-theme="ocean"] .sidebar-brand svg path { stroke: var(--accent-teal) !important; filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.4)); }
[data-theme="ocean"] .sidebar-brand svg text { fill: #ffffff !important; }

/* --- BRONZE TITANIUM (DARK) PREMIUM UPGRADE --- */
[data-theme="dark"] {
    --bg-base: #0f1012;
    --bg-surface: rgba(25, 26, 30, 0.85);
    --bg-card: rgba(35, 36, 40, 0.7);
    --bg-card-hover: rgba(45, 46, 50, 0.9);
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --border: rgba(205, 127, 50, 0.2);
    --accent-blue: #cd7f32; /* Bronze */
    --accent-green: #f59e0b; /* Amber */
    --border-active: #cd7f32;
    --premium-glow: radial-gradient(circle at 50% -20%, rgba(205, 127, 50, 0.15) 0%, transparent 70%);
    --selection-bg: rgba(205, 127, 50, 0.3);
    --selection-text: #ffffff;
    --glass-bg: rgba(25, 26, 30, 0.88);
    --glass-border: 1px solid rgba(205, 127, 50, 0.2);
}
[data-theme="dark"] body::before { content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--premium-glow); pointer-events: none; z-index: 100; }
[data-theme="dark"] ::selection { background: var(--selection-bg); color: var(--selection-text); }
[data-theme="dark"] .btn-primary { background: linear-gradient(135deg, #cd7f32 0%, #f59e0b 100%); color: #000; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; border: none; box-shadow: 0 4px 15px rgba(205, 127, 50, 0.3); }
[data-theme="dark"] .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(205, 127, 50, 0.5); }
[data-theme="dark"] .brand-text h2 { background: linear-gradient(135deg, #cd7f32 0%, #f59e0b 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 2px 10px rgba(205, 127, 50, 0.2)); }
[data-theme="dark"] .sidebar-brand svg path { stroke: #cd7f32 !important; filter: drop-shadow(0 0 5px rgba(205, 127, 50, 0.4)); }
[data-theme="dark"] .sidebar-brand svg text { fill: #ffffff !important; }

/* --- EMERALD OBSIDIAN (DEFAULT) PREMIUM UPGRADE --- */
:root, [data-theme="default"] {
    --bg-base: #020604;
    --bg-surface: rgba(4, 18, 10, 0.85);
    --bg-card: rgba(10, 28, 16, 0.7);
    --bg-card-hover: rgba(16, 38, 22, 0.9);
    --text-primary: #ecfdf5;
    --border: rgba(16, 185, 129, 0.2);
    --premium-glow: radial-gradient(circle at 50% -20%, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
    --selection-bg: rgba(16, 185, 129, 0.3);
    --selection-text: #ffffff;
    --glass-bg: rgba(4, 18, 10, 0.88);
    --glass-border: 1px solid rgba(16, 185, 129, 0.2);
}
:root body::before, [data-theme="default"] body::before { content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--premium-glow); pointer-events: none; z-index: 100; }
:root ::selection, [data-theme="default"] ::selection { background: var(--selection-bg); color: var(--selection-text); }
:root .btn-primary, [data-theme="default"] .btn-primary { background: var(--gradient-emerald); color: #000; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; border: none; box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3); }
:root .btn-primary:hover, [data-theme="default"] .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5); }
:root .brand-text h2, [data-theme="default"] .brand-text h2 { background: var(--gradient-emerald); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 2px 10px rgba(16, 185, 129, 0.2)); }
:root .sidebar-brand svg path, [data-theme="default"] .sidebar-brand svg path { stroke: var(--accent-green) !important; filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.4)); }
:root .sidebar-brand svg text, [data-theme="default"] .sidebar-brand svg text { fill: #ffffff !important; }
