/* ========================================
   RBP Data Mining System - Premium Dark Theme
   Glassmorphism + Animated Background
   ======================================== */

/* ========================================
   CSS Variables
   ======================================== */
   :root {
    color-scheme: light dark;

    /* ===== LIGHT — claude.ai light theme ===== */
    /* Primary = Claude accent (terracotta / "Book Cloth") */
    --primary-50:  #f8ebe5;
    --primary-100: #f0d6cb;
    --primary-200: #e3b4a1;
    --primary-300: #d6937a;
    --primary-400: #cf7a5d;
    --primary-500: #c96442;   /* claude.ai --accent-main-100 */
    --primary-600: #ae5238;   /* claude.ai --accent-main-200 (hover) */
    --primary-700: #92452f;
    --primary-800: #763829;
    --primary-900: #5e2e23;

    --accent-purple: #6d5f93;
    --accent-pink: #b26085;
    --accent-cyan: #3a7d75;
    --accent-emerald: #4a8a60;
    --accent-amber: #b3833a;
    --accent-rose: #bd5240;

    /* Neutrals = claude.ai warm greys, INVERTED (950 = page ground, 50 = ink) */
    --slate-50: #1a1915;
    --slate-100: #1f1e1d;   /* --text-100 (headings / body) */
    --slate-200: #3d3d3a;
    --slate-300: #55554f;
    --slate-400: #706f6c;   /* --text-200 (muted) */
    --slate-500: #9b9a93;   /* --text-300 (faint) */
    --slate-600: #c5c3b8;
    --slate-700: #e3e1d8;   /* --border-100 */
    --slate-800: #f0eee6;   /* subtle panel */
    --slate-900: #ffffff;   /* card surface */
    --slate-950: #faf9f5;   /* page background */

    --success: #4a8a60;  --success-light: rgba(74, 138, 96, 0.14);
    --warning: #b3833a;  --warning-light: rgba(179, 131, 58, 0.16);
    --error:   #b8402f;  --error-light:   rgba(184, 64, 47, 0.14);
    --info:    #3a7d75;  --info-light:    rgba(58, 125, 117, 0.14);

    --glass-bg: rgba(31, 30, 29, 0.028);
    --glass-bg-hover: rgba(31, 30, 29, 0.055);
    --glass-border: rgba(31, 30, 29, 0.10);
    --glass-border-hover: rgba(31, 30, 29, 0.18);
    --glass-shadow: 0 8px 30px rgba(31, 30, 29, 0.08);

    --header-bg: rgba(250, 249, 245, 0.82);
    --overlay-bg: rgba(250, 249, 245, 0.9);
    --grid-line: rgba(31, 30, 29, 0.04);
    --fill-subtle: rgba(31, 30, 29, 0.035);
    --fill-hover: rgba(31, 30, 29, 0.07);

    --shadow-sm: 0 1px 2px rgba(31, 30, 29, 0.06);
    --shadow-md: 0 4px 10px rgba(31, 30, 29, 0.08);
    --shadow-lg: 0 12px 24px rgba(31, 30, 29, 0.10);
    --shadow-xl: 0 24px 48px rgba(31, 30, 29, 0.12);
    --shadow-glow: 0 0 34px rgba(201, 100, 66, 0.18);

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== DARK — claude.ai dark theme ===== */
:root[data-theme="dark"] {
    --primary-50:  #f8ebe5;
    --primary-100: #f0d6cb;
    --primary-200: #e6b6a0;
    --primary-300: #e09f83;
    --primary-400: #dc8a6c;
    --primary-500: #d97757;   /* claude.ai dark --accent-main-100 */
    --primary-600: #c96442;
    --primary-700: #ac5238;
    --primary-800: #8a4530;
    --primary-900: #6b3728;

    --accent-purple: #9d8fce;
    --accent-pink: #d488a8;
    --accent-cyan: #5cb8ac;
    --accent-emerald: #63be7e;
    --accent-amber: #d9a552;
    --accent-rose: #e0806c;

    /* Neutrals = claude.ai dark warm greys (950 = page ground, 50 = ink) */
    --slate-50: #faf9f5;    /* --text-000 */
    --slate-100: #e8e6df;   /* --text-100 */
    --slate-200: #cbc9c0;
    --slate-300: #a8a79e;   /* --text-200 */
    --slate-400: #8f8e87;   /* muted */
    --slate-500: #6f6e68;
    --slate-600: #514f4a;
    --slate-700: #3e3e3b;   /* --border-100 */
    --slate-800: #30302e;   /* raised surface */
    --slate-900: #2b2a27;   /* card surface */
    --slate-950: #262624;   /* page background */

    --success: #63be7e;  --success-light: rgba(99, 190, 126, 0.15);
    --warning: #d9a552;  --warning-light: rgba(217, 165, 82, 0.16);
    --error:   #e0705c;  --error-light:   rgba(224, 112, 92, 0.15);
    --info:    #5cb8ac;  --info-light:    rgba(92, 184, 172, 0.15);

    --glass-bg: rgba(255, 255, 255, 0.035);
    --glass-bg-hover: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-border-hover: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);

    --header-bg: rgba(38, 38, 36, 0.82);
    --overlay-bg: rgba(31, 30, 29, 0.92);
    --grid-line: rgba(255, 255, 255, 0.035);
    --fill-subtle: rgba(255, 255, 255, 0.035);
    --fill-hover: rgba(255, 255, 255, 0.08);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.42);
    --shadow-lg: 0 12px 22px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 24px 44px rgba(0, 0, 0, 0.58);
    --shadow-glow: 0 0 40px rgba(217, 119, 87, 0.36);
}

/* system dark preference (only when the user has not forced light) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary-50:  #f8ebe5;
        --primary-100: #f0d6cb;
        --primary-200: #e6b6a0;
        --primary-300: #e09f83;
        --primary-400: #dc8a6c;
        --primary-500: #d97757;
        --primary-600: #c96442;
        --primary-700: #ac5238;
        --primary-800: #8a4530;
        --primary-900: #6b3728;

        --accent-purple: #9d8fce;
        --accent-pink: #d488a8;
        --accent-cyan: #5cb8ac;
        --accent-emerald: #63be7e;
        --accent-amber: #d9a552;
        --accent-rose: #e0806c;

        --slate-50: #faf9f5;
        --slate-100: #e8e6df;
        --slate-200: #cbc9c0;
        --slate-300: #a8a79e;
        --slate-400: #8f8e87;
        --slate-500: #6f6e68;
        --slate-600: #514f4a;
        --slate-700: #3e3e3b;
        --slate-800: #30302e;
        --slate-900: #2b2a27;
        --slate-950: #262624;

        --success: #63be7e;  --success-light: rgba(99, 190, 126, 0.15);
        --warning: #d9a552;  --warning-light: rgba(217, 165, 82, 0.16);
        --error:   #e0705c;  --error-light:   rgba(224, 112, 92, 0.15);
        --info:    #5cb8ac;  --info-light:    rgba(92, 184, 172, 0.15);

        --glass-bg: rgba(255, 255, 255, 0.035);
        --glass-bg-hover: rgba(255, 255, 255, 0.07);
        --glass-border: rgba(255, 255, 255, 0.10);
        --glass-border-hover: rgba(255, 255, 255, 0.18);
        --glass-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);

        --header-bg: rgba(38, 38, 36, 0.82);
        --overlay-bg: rgba(31, 30, 29, 0.92);
        --grid-line: rgba(255, 255, 255, 0.035);
        --fill-subtle: rgba(255, 255, 255, 0.035);
        --fill-hover: rgba(255, 255, 255, 0.08);

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
        --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.42);
        --shadow-lg: 0 12px 22px rgba(0, 0, 0, 0.5);
        --shadow-xl: 0 24px 44px rgba(0, 0, 0, 0.58);
        --shadow-glow: 0 0 40px rgba(217, 119, 87, 0.36);
    }
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--slate-950);
    color: var(--slate-100);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* ========================================
   Animated Background
   ======================================== */
.bg-wrapper {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-gradient {
    /* claude.ai uses a flat warm ground - no aurora wash */
    display: none;
}

.bg-grid {
    display: none;
}

.bg-noise {
    position: absolute;
    inset: 0;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Floating Orbs - disabled to match claude.ai's flat ground */
.orb {
    display: none;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: var(--primary-500);
    top: -15%;
    right: -10%;
    opacity: 0.15;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--primary-500);
    bottom: 5%;
    left: -10%;
    opacity: 0.12;
    animation-delay: -8s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--primary-500);
    top: 40%;
    right: 15%;
    opacity: 0.08;
    animation-delay: -16s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(40px, -40px) scale(1.05); }
    50% { transform: translate(-30px, 30px) scale(0.95); }
    75% { transform: translate(30px, 40px) scale(1.02); }
}

/* ========================================
   Header
   ======================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: var(--space-3) 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: 52px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-500);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 20px rgba(217, 119, 87, 0.3);
}

.logo-text {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--slate-100);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-badge {
    padding: var(--space-1) var(--space-2);
    background: var(--primary-500);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
}

/* Navigation */
.nav-links {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-1);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    color: var(--slate-400);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-500);
    opacity: 0;
    transition: var(--transition-normal);
}

.nav-link span {
    position: relative;
    z-index: 1;
}

.nav-link:hover {
    color: var(--slate-100);
}

.nav-link:hover::before {
    opacity: 0.1;
}

.nav-link.active {
    color: white;
    box-shadow: 0 4px 15px rgba(217, 119, 87, 0.3);
}

.nav-link.active::before {
    opacity: 1;
}

/* Status Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

/* Theme toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--slate-300);
    cursor: pointer;
    transition: var(--transition-normal);
}

.theme-toggle:hover {
    color: var(--primary-500);
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.theme-toggle svg {
    display: block;
}

.theme-toggle .theme-icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-sun {
    display: block;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-moon {
    display: none;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 10px var(--warning);
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-dot.offline {
    background: var(--error);
    box-shadow: 0 0 10px var(--error);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
}

.status-text {
    font-size: 0.85rem;
    color: var(--slate-400);
    font-weight: 500;
}

/* ========================================
   Main Container
   ======================================== */
.main-container {
    padding: var(--space-12) 0;
    min-height: calc(100vh - 200px);
}

/* ========================================
   Hero Section
   ======================================== */
.hero-section {
    text-align: center;
    padding: var(--space-8) 0 var(--space-16);
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.15), rgba(217, 119, 87, 0.15));
    border: 1px solid rgba(217, 119, 87, 0.3);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary-600);
    margin-bottom: var(--space-6);
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--space-6);
    color: var(--slate-100);
}

.gradient-text {
    background: var(--primary-500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.2rem;
    color: var(--slate-400);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.8;
}

/* ========================================
   Section Headers
   ======================================== */
.section-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.section-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-500);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(217, 119, 87, 0.3);
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--slate-100);
}

.section-header p {
    font-size: 0.9rem;
    color: var(--slate-400);
    margin-top: var(--space-1);
}

/* ========================================
   Upload Section
   ======================================== */
.upload-section {
    margin-bottom: var(--space-12);
    animation: fadeInUp 0.8s ease-out 0.1s backwards;
}

.upload-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-12) var(--space-8);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.05), rgba(217, 119, 87, 0.05));
    opacity: 0;
    transition: var(--transition-normal);
}

.dropzone:hover {
    border-color: var(--primary-500);
    transform: translateY(-4px);
}

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

.dropzone.dragover {
    border-color: var(--primary-400);
    border-style: solid;
    background: rgba(217, 119, 87, 0.1);
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
}

.dropzone-content {
    position: relative;
    z-index: 1;
}

.upload-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-6);
}

.upload-icon-bg {
    position: absolute;
    inset: 0;
    background: var(--primary-500);
    border-radius: 50%;
    opacity: 0.15;
    animation: pulse 3s ease-in-out infinite;
}

.upload-icon {
    position: relative;
    width: 100%;
    height: 100%;
    stroke: var(--primary-400);
    padding: var(--space-4);
}

.dropzone-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--slate-100);
    margin-bottom: var(--space-2);
}

.dropzone-subtitle {
    font-size: 0.95rem;
    color: var(--slate-400);
    margin-bottom: var(--space-6);
}

.file-formats {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
}

.format-badge {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--slate-300);
}

/* Upload Progress */
.upload-progress {
    margin-top: var(--space-6);
    padding: var(--space-5);
    background: var(--slate-800);
    border-radius: var(--radius-md);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-3);
    font-size: 0.85rem;
}

.progress-filename {
    color: var(--slate-300);
    font-weight: 500;
}

.progress-percent {
    color: var(--primary-400);
    font-weight: 700;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--slate-700);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-500);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
    box-shadow: 0 0 15px rgba(217, 119, 87, 0.5);
}

/* Uploaded Files List */
.uploaded-files-list {
    margin-top: var(--space-6);
}

.uploaded-files-list:empty {
    display: none;
}

/* ========================================
   Query Section
   ======================================== */
.query-section {
    margin-bottom: var(--space-12);
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.query-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
}

.query-input-wrapper {
    background: var(--slate-900);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-normal);
}

.query-input-wrapper:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(217, 119, 87, 0.1);
}

.query-input-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--glass-border);
    background: var(--grid-line);
}

.input-icon {
    color: var(--primary-400);
}

.input-label {
    font-size: 0.85rem;
    color: var(--slate-400);
    font-weight: 500;
}

.query-input {
    width: 100%;
    padding: var(--space-5);
    background: transparent;
    border: none;
    font-size: 1.05rem;
    font-family: inherit;
    color: var(--slate-100);
    resize: none;
    line-height: 1.7;
}

.query-input::placeholder {
    color: var(--slate-500);
}

.query-input:focus {
    outline: none;
}

.query-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-top: 1px solid var(--glass-border);
    background: var(--grid-line);
}

.char-counter {
    font-size: 0.85rem;
    color: var(--slate-500);
}

.char-counter span:first-child {
    color: var(--primary-400);
    font-weight: 600;
}

.query-actions {
    display: flex;
    gap: var(--space-3);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-500);
    color: white;
    box-shadow: 0 4px 15px rgba(217, 119, 87, 0.3);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-600);
    opacity: 0;
    transition: var(--transition-normal);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(217, 119, 87, 0.4);
}

.btn-primary span,
.btn-primary svg {
    position: relative;
    z-index: 1;
}

.btn-ghost {
    background: transparent;
    color: var(--slate-400);
    border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
    background: var(--glass-bg);
    border-color: var(--error);
    color: var(--error);
}

.shortcut-badge {
    padding: var(--space-1) var(--space-2);
    background: var(--fill-hover);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
}

/* ========================================
   Examples Section
   ======================================== */
.examples-section {
    margin-top: var(--space-8);
    padding-top: var(--space-8);
    border-top: 1px solid var(--glass-border);
}

.examples-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--slate-400);
    margin-bottom: var(--space-5);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
}

.example-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-normal);
    text-align: center;
}

.example-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--primary-500);
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(217, 119, 87, 0.15);
}

.example-icon {
    font-size: 2rem;
}

.example-text {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--slate-300);
}

.example-card:hover .example-text {
    color: var(--primary-400);
}

/* ========================================
   Results Section
   ======================================== */
.results-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    animation: fadeInUp 0.5s ease-out;
}

.result-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding-bottom: var(--space-5);
    margin-bottom: var(--space-5);
    border-bottom: 1px solid var(--glass-border);
}

.result-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--slate-100);
    flex: 1 1 auto;
    min-width: 0;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* Action Buttons */
.btn-icon-action,
.action-btn {
    padding: var(--space-2);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--slate-400);
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-icon-action:hover,
.action-btn:hover {
    background: var(--glass-bg-hover);
    border-color: var(--primary-500);
    color: var(--primary-400);
    transform: translateY(-2px);
}

/* Explanation Content */
.explanation-content {
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.05), rgba(217, 119, 87, 0.05));
    border: 1px solid rgba(217, 119, 87, 0.15);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--slate-200);
}

.explanation-content strong {
    color: var(--primary-400);
    font-weight: 600;
}

.explanation-content code {
    background: var(--slate-800);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-family: 'Fira Code', monospace;
    color: var(--primary-600);
    font-size: 0.9em;
}

/* Code Block */
.code-block {
    background: var(--slate-900);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
}

.code-block code {
    font-family: 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--slate-300);
    line-height: 1.6;
}

/* Insight & Suggestions */
.insight-box {
    background: linear-gradient(135deg, rgba(217, 119, 87, 0.1), rgba(193, 95, 60, 0.1));
    border-right: 4px solid var(--info);
    padding: var(--space-5);
    border-radius: var(--radius-md);
}

.suggestions-box ul {
    list-style: none;
    padding: 0;
    margin-top: var(--space-4);
}

.suggestions-box li {
    padding: var(--space-3) var(--space-4);
    background: var(--glass-bg);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-2);
    border-right: 3px solid var(--success);
    color: var(--slate-300);
}

/* Metadata Grid */
.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
}

.metadata-item {
    padding: var(--space-5);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    text-align: center;
    transition: var(--transition-normal);
}

.metadata-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary-500);
}

.metadata-item .label {
    font-size: 0.85rem;
    color: var(--slate-400);
    margin-bottom: var(--space-2);
}

.metadata-item .value {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--primary-600);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--slate-800);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th,
.data-table td {
    padding: var(--space-4);
    text-align: right;
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    font-weight: 600;
    color: var(--slate-300);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--glass-bg-hover);
}

.data-table td {
    color: var(--slate-400);
    font-size: 0.95rem;
}

/* Validation Items */
.validation-item {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.validation-item.success {
    background: var(--success-light);
    color: var(--success);
    border-right: 4px solid var(--success);
}

.validation-item.error {
    background: var(--error-light);
    color: var(--error);
    border-right: 4px solid var(--error);
}

.validation-item.warning {
    background: var(--warning-light);
    color: var(--warning);
    border-right: 4px solid var(--warning);
}

/* ========================================
   Record Count Select
   ======================================== */
.record-count-select {
    padding: var(--space-2) var(--space-4);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--slate-300);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-normal);
}

.record-count-select:hover {
    border-color: var(--primary-500);
}

.record-count-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.1);
}

.record-count-select option {
    background: var(--slate-800);
    color: var(--slate-100);
}

/* ========================================
   Loading Overlay
   ======================================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

/* backward-compat: old spinner markup still renders as the new mark */
.loading-spinner,
.loading-mark {
    position: relative;
    width: 76px;
    height: 76px;
    margin: 0 auto var(--space-5);
    color: var(--primary-500);
    display: grid;
    place-items: center;
}

.loading-mark svg {
    width: 40px;
    height: 40px;
    display: block;
    overflow: visible;
    filter: drop-shadow(0 0 14px rgba(217, 119, 87, 0.3));
    animation: lm-breathe 1.7s ease-in-out infinite;
}

.loading-mark__ring,
.spinner-ring:nth-child(1) {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--glass-border);
    border-top-color: var(--primary-500);
    animation: spin 0.9s cubic-bezier(0.5, 0.15, 0.5, 0.85) infinite;
}

.spinner-ring:nth-child(2),
.spinner-ring:nth-child(3) { display: none; }

@keyframes lm-breathe {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.8; }
}

.loading-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: var(--space-3);
}

.loading-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-500);
    animation: ld-bounce 1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ld-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-7px); opacity: 1; }
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--slate-100);
    margin-bottom: var(--space-2);
}

.loading-hint {
    font-size: 0.9rem;
    color: var(--slate-500);
}

@media (prefers-reduced-motion: reduce) {
    .loading-mark svg,
    .loading-mark__ring,
    .spinner-ring,
    .loading-dots span { animation: none; }
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    top: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--slate-800);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 300px;
    animation: toastIn 0.3s ease-out;
    pointer-events: auto;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast.success { border-right: 4px solid var(--success); }
.toast.error { border-right: 4px solid var(--error); }
.toast.warning { border-right: 4px solid var(--warning); }
.toast.info { border-right: 4px solid var(--info); }

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    flex: 1;
    font-size: 0.95rem;
    color: var(--slate-200);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: var(--slate-900);
    border-top: 1px solid var(--glass-border);
    padding: var(--space-10) 0;
    margin-top: var(--space-16);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.footer-logo {
    width: 48px;
    height: 48px;
    background: var(--primary-500);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.footer-brand h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--slate-100);
}

.footer-brand p {
    font-size: 0.85rem;
    color: var(--slate-500);
}

.footer-links {
    display: flex;
    gap: var(--space-6);
}

.footer-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--slate-400);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition-normal);
}

.footer-link:hover {
    color: var(--primary-400);
}

.footer-copyright {
    font-size: 0.85rem;
    color: var(--slate-600);
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .header-content {
        /* keep the logo and the action buttons on one row; the app name
           truncates instead of pushing the buttons to a second line */
        flex-wrap: nowrap;
        gap: var(--space-3);
    }

    .logo {
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .logo-icon {
        flex-shrink: 0;
    }

    .logo-text {
        min-width: 0;
        overflow: hidden;
    }

    .logo-text h1 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-actions {
        flex-shrink: 0;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-4);
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-description {
        font-size: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        text-align: center;
    }
    
    .upload-card,
    .query-card {
        padding: var(--space-5);
    }
    
    .dropzone {
        padding: var(--space-8) var(--space-4);
    }
    
    .query-footer {
        flex-direction: column;
        gap: var(--space-4);
    }
    
    .query-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .query-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .examples-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .result-header {
        gap: var(--space-3);
    }

    .result-header h3 {
        font-size: 1.02rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: var(--space-3);
    }
}

@media (max-width: 480px) {
    .nav-links {
        flex-direction: column;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .metadata-grid {
        grid-template-columns: 1fr;
    }
}


/* ========================================
   Chart.js Text Color Fix
   ======================================== */
   canvas {
    color: var(--slate-300) !important;
}

/* Force Chart.js labels to be visible */
.chartjs-render-monitor {
    color: var(--slate-300) !important;
}


/* ========================================
   Strategy Tabs (for Recommendations page)
   ======================================== */
   .strategy-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--slate-400);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
}

.strategy-tab:hover {
    background: var(--glass-bg-hover);
    border-color: var(--primary-500);
    color: var(--slate-200);
}

.strategy-tab.active {
    background: var(--primary-500);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(217, 119, 87, 0.3);
}

/* ========================================
   Page Load Animation
   ======================================== */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 26px;
    background: var(--slate-950);
    transition: opacity 0.55s ease, visibility 0.55s ease;
}

.page-loader__mark {
    width: 60px;
    height: 60px;
    color: var(--primary-500);
    animation: pl-breathe 1.7s ease-in-out 0.35s infinite;
}

.page-loader__mark svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    filter: drop-shadow(0 0 16px rgba(217, 119, 87, 0.28));
}

.page-loader__mark path {
    stroke-dasharray: 96;
    stroke-dashoffset: 96;
    animation: pl-draw 0.95s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

.page-loader__mark .pl-p2 { animation-delay: 0.12s; }
.page-loader__mark .pl-p3 { animation-delay: 0.24s; }

@keyframes pl-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes pl-breathe {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.07); opacity: 0.82; }
}

.page-loader__bar {
    width: 128px;
    height: 3px;
    border-radius: 999px;
    background: var(--fill-hover);
    overflow: hidden;
}

.page-loader__bar span {
    display: block;
    height: 100%;
    width: 38%;
    border-radius: 999px;
    background: var(--primary-500);
    animation: pl-sweep 1.15s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes pl-sweep {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(390%); }
}

body.is-loaded .page-loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Content reveal after load */
.hero-section,
.query-section {
    opacity: 0;
    transform: translateY(16px);
}

body.is-loaded .hero-section {
    animation: pl-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.04s forwards;
}

body.is-loaded .query-section {
    animation: pl-rise 0.62s cubic-bezier(0.22, 1, 0.36, 1) 0.16s forwards;
}

@keyframes pl-rise {
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .page-loader { transition: none; }
    .page-loader__mark,
    .page-loader__mark path,
    .page-loader__bar span { animation: none; }
    .page-loader__mark path { stroke-dashoffset: 0; }
    .hero-section,
    .query-section { opacity: 1; transform: none; animation: none; }
}

/* ============================================================
   Ariana subtle background - MAIN PAGE ONLY (body without .login-page)
   Re-enables the decorative layer inside the existing .bg-wrapper.
   Warm orange/gold tone, a touch more visible. No theme colours,
   tokens, layout or anything else changed.
   ============================================================ */
body:not(.login-page) .bg-gradient {
    display: block;
    position: absolute;
    inset: -20%;
    background:
      radial-gradient(38% 30% at 84% 6%,  rgba(231,154,70,0.22), transparent 70%),
      radial-gradient(42% 40% at 10% 96%, rgba(214,133,58,0.17), transparent 72%),
      radial-gradient(28% 26% at 62% 52%, rgba(231,154,70,0.09), transparent 78%);
    pointer-events: none;
}
body:not(.login-page) .bg-grid {
    display: block;
    position: absolute;
    inset: -4%;
    opacity: 1;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201280%20900'%20preserveAspectRatio='xMidYMid%20slice'%3E%3Cg%20fill='none'%20stroke-linecap='round'%3E%3Cg%20stroke='%23cf8438'%20stroke-opacity='0.13'%20stroke-width='1.5'%3E%3Cpath%20d='M-80%20120%20C%20220%2040%20480%20210%20760%20120%20S%201180%2040%201360%20130'/%3E%3Cpath%20d='M-80%20230%20C%20240%20155%20520%20305%20800%20225%20S%201200%20150%201360%20245'/%3E%3Cpath%20d='M-80%20350%20C%20260%20275%20540%20435%20820%20355%20S%201220%20275%201360%20365'/%3E%3Cpath%20d='M-80%20480%20C%20220%20405%20520%20565%20800%20485%20S%201200%20405%201360%20495'/%3E%3Cpath%20d='M-80%20610%20C%20260%20545%20520%20695%20820%20615%20S%201220%20545%201360%20625'/%3E%3Cpath%20d='M-80%20730%20C%20240%20665%20520%20805%20800%20735%20S%201200%20665%201360%20745'/%3E%3C/g%3E%3Cpath%20stroke='%23c96442'%20stroke-opacity='0.16'%20stroke-width='2.4'%20d='M980%20-120%20A%20560%20560%200%200%200%20320%20900'/%3E%3Cpath%20stroke='%23d98a3d'%20stroke-opacity='0.10'%20stroke-width='1.8'%20d='M1120%20-40%20A%20470%20470%200%200%200%20620%20900'/%3E%3C/g%3E%3C/svg%3E");
}
:root[data-theme="dark"] body:not(.login-page) .bg-grid {
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201280%20900'%20preserveAspectRatio='xMidYMid%20slice'%3E%3Cg%20fill='none'%20stroke-linecap='round'%3E%3Cg%20stroke='%23e7a24b'%20stroke-opacity='0.11'%20stroke-width='1.5'%3E%3Cpath%20d='M-80%20120%20C%20220%2040%20480%20210%20760%20120%20S%201180%2040%201360%20130'/%3E%3Cpath%20d='M-80%20230%20C%20240%20155%20520%20305%20800%20225%20S%201200%20150%201360%20245'/%3E%3Cpath%20d='M-80%20350%20C%20260%20275%20540%20435%20820%20355%20S%201220%20275%201360%20365'/%3E%3Cpath%20d='M-80%20480%20C%20220%20405%20520%20565%20800%20485%20S%201200%20405%201360%20495'/%3E%3Cpath%20d='M-80%20610%20C%20260%20545%20520%20695%20820%20615%20S%201220%20545%201360%20625'/%3E%3Cpath%20d='M-80%20730%20C%20240%20665%20520%20805%20800%20735%20S%201200%20665%201360%20745'/%3E%3C/g%3E%3Cpath%20stroke='%23e79a46'%20stroke-opacity='0.16'%20stroke-width='2.4'%20d='M980%20-120%20A%20560%20560%200%200%200%20320%20900'/%3E%3Cpath%20stroke='%23f0b866'%20stroke-opacity='0.10'%20stroke-width='1.8'%20d='M1120%20-40%20A%20470%20470%200%200%200%20620%20900'/%3E%3C/g%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) body:not(.login-page) .bg-grid {
        background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201280%20900'%20preserveAspectRatio='xMidYMid%20slice'%3E%3Cg%20fill='none'%20stroke-linecap='round'%3E%3Cg%20stroke='%23e7a24b'%20stroke-opacity='0.11'%20stroke-width='1.5'%3E%3Cpath%20d='M-80%20120%20C%20220%2040%20480%20210%20760%20120%20S%201180%2040%201360%20130'/%3E%3Cpath%20d='M-80%20230%20C%20240%20155%20520%20305%20800%20225%20S%201200%20150%201360%20245'/%3E%3Cpath%20d='M-80%20350%20C%20260%20275%20540%20435%20820%20355%20S%201220%20275%201360%20365'/%3E%3Cpath%20d='M-80%20480%20C%20220%20405%20520%20565%20800%20485%20S%201200%20405%201360%20495'/%3E%3Cpath%20d='M-80%20610%20C%20260%20545%20520%20695%20820%20615%20S%201220%20545%201360%20625'/%3E%3Cpath%20d='M-80%20730%20C%20240%20665%20520%20805%20800%20735%20S%201200%20665%201360%20745'/%3E%3C/g%3E%3Cpath%20stroke='%23e79a46'%20stroke-opacity='0.16'%20stroke-width='2.4'%20d='M980%20-120%20A%20560%20560%200%200%200%20320%20900'/%3E%3Cpath%20stroke='%23f0b866'%20stroke-opacity='0.10'%20stroke-width='1.8'%20d='M1120%20-40%20A%20470%20470%200%200%200%20620%20900'/%3E%3C/g%3E%3C/svg%3E");
    }
}
body:not(.login-page) .bg-noise { opacity: 0.035; }

@media (prefers-reduced-motion: no-preference) {
    body:not(.login-page) .bg-grid {
        animation: kvBgDrift 46s ease-in-out infinite alternate;
        will-change: transform;
    }
}
@keyframes kvBgDrift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(-3%, -2%, 0) scale(1.06); }
}
/* --- Ariana bg: stronger LIGHT-theme treatment (dark theme unchanged) --- */
:root[data-theme="light"] body:not(.login-page) .bg-gradient {
    background:
      linear-gradient(155deg, rgba(255,246,232,0) 0%, rgba(231,150,70,0.06) 46%, rgba(206,116,48,0.11) 100%),
      radial-gradient(42% 34% at 86% 2%,  rgba(231,154,70,0.34), transparent 66%),
      radial-gradient(48% 46% at 6% 100%, rgba(203,116,48,0.26), transparent 70%),
      radial-gradient(32% 30% at 60% 48%, rgba(231,154,70,0.14), transparent 76%);
}
:root[data-theme="light"] body:not(.login-page) .bg-grid {
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201280%20900'%20preserveAspectRatio='xMidYMid%20slice'%3E%3Cg%20fill='none'%20stroke-linecap='round'%3E%3Cg%20stroke='%23bf7228'%20stroke-opacity='0.17'%20stroke-width='1.7'%3E%3Cpath%20d='M-80%2070%20C%20230%2010%20470%20150%20760%2070%20S%201180%200%201360%2080'/%3E%3Cpath%20d='M-80%20150%20C%20250%2090%20520%20240%20800%20150%20S%201200%2080%201360%20170'/%3E%3Cpath%20d='M-80%20240%20C%20260%20175%20540%20330%20820%20245%20S%201220%20165%201360%20260'/%3E%3Cpath%20d='M-80%20330%20C%20220%20265%20520%20420%20800%20335%20S%201200%20255%201360%20350'/%3E%3Cpath%20d='M-80%20420%20C%20260%20355%20520%20510%20820%20425%20S%201220%20345%201360%20440'/%3E%3Cpath%20d='M-80%20510%20C%20240%20445%20520%20600%20800%20515%20S%201200%20435%201360%20530'/%3E%3Cpath%20d='M-80%20610%20C%20260%20545%20540%20700%20820%20615%20S%201220%20535%201360%20630'/%3E%3Cpath%20d='M-80%20700%20C%20220%20640%20520%20790%20800%20705%20S%201200%20625%201360%20720'/%3E%3Cpath%20d='M-80%20790%20C%20260%20730%20520%20875%20820%20795%20S%201220%20715%201360%20810'/%3E%3Cpath%20d='M-80%20860%20C%20240%20810%20520%20940%20800%20865%20S%201200%20795%201360%20880'/%3E%3C/g%3E%3Cpath%20stroke='%23b6541f'%20stroke-opacity='0.24'%20stroke-width='3'%20d='M980%20-140%20A%20580%20580%200%200%200%20300%20900'/%3E%3Cpath%20stroke='%23c96442'%20stroke-opacity='0.16'%20stroke-width='2.1'%20d='M1140%20-50%20A%20480%20480%200%200%200%20600%20900'/%3E%3Cpath%20stroke='%23d98a3d'%20stroke-opacity='0.13'%20stroke-width='1.7'%20d='M1260%2040%20A%20400%20400%200%200%200%20820%20900'/%3E%3C/g%3E%3C/svg%3E");
}
:root[data-theme="light"] body:not(.login-page) .bg-noise { opacity: 0.05; }
/* ========================================
   Chart responsiveness (bar/line/pie result chart)
   Chart.js maintainAspectRatio is false; height comes from this
   wrapper so the chart stays readable on narrow screens instead of
   shrinking to a 2:1 sliver.
   ======================================== */
.chart-wrap {
    position: relative;
    width: 100%;
    height: 380px;
    padding: var(--space-6);
    box-sizing: border-box;
}
@media (max-width: 640px) {
    .chart-wrap {
        height: 360px;
        padding: var(--space-4) var(--space-3);
    }
}
@media (max-width: 380px) {
    .chart-wrap { height: 330px; }
}

/* Logout button — same chrome as .theme-toggle, warm hover instead of accent */
.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--slate-300);
    cursor: pointer;
    transition: var(--transition-normal);
}
.logout-btn:hover {
    color: var(--error);
    background: var(--error-light);
    border-color: var(--glass-border-hover);
}
.logout-btn:focus-visible {
    outline: 2px solid var(--error);
    outline-offset: 2px;
}
.logout-btn svg { display: block; }
