/* ============================================
   HAKKUU - DESIGN SYSTEM V2
   World-Class UI Design Foundation
   ============================================ */

/* ============================================
   CSS ARCHITECTURE
   ============================================

   Naming: BEM (Block__Element--Modifier)
   - Blocks: .modal, .toast, .card, .btn, .nav
   - Elements: .modal-header, .modal-body, .toast-message
   - Modifiers: .modal--large, .toast--glass, .btn--primary

   Components:
   - base.css: Core design system (tokens, components)
   - landing.css: Marketing pages (extends base)
   - settings.css: Settings page (extends base)
   - [page].css: Page-specific styles

   Animations: Defined in base.css, referenced elsewhere
   - fadeIn, fadeOut, fadeInUp, slideUp, slideDown
   - slideRight, slideLeft, scaleIn, pulse, shake
   ============================================ */

/* ============================================
   DESIGN TOKENS
   ============================================ */

:root {
    /* Light Mode Brand Colors */
    --brand-lightest: #E5F1FF;
    --brand-light: #99C9FF;
    --brand-medium: #007AFF;
    --brand-dark: #0051D5;

    /* Light Mode Colors */
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f5f5f7;
    --color-bg-tertiary: #e8e8ed;
    --color-surface: #ffffff;
    --color-surface-elevated: #ffffff;

    --color-text-primary: #1d1d1f;
    --color-text-secondary: #6e6e73;
    --color-text-tertiary: #86868b;
    --color-text-inverse: #ffffff;

    --color-border-light: rgba(0, 0, 0, 0.06);
    --color-border-medium: rgba(0, 0, 0, 0.1);
    --color-border-heavy: rgba(0, 0, 0, 0.18);

    /* Semantic Colors */
    --color-primary: #007AFF;
    --color-primary-hover: #0051D5;
    --color-primary-light: rgba(0, 122, 255, 0.1);

    --color-success: #34C759;
    --color-success-light: rgba(52, 199, 89, 0.1);
    --color-warning: #FF9500;
    --color-warning-light: rgba(255, 149, 0, 0.1);
    --color-danger: #FF3B30;
    --color-danger-light: rgba(255, 59, 48, 0.1);
    --color-info: #007AFF;
    --color-info-light: rgba(0, 122, 255, 0.1);

    /* Brand Teal Colors (Hakkuu Theme) */
    --brand-teal: #39AEA9;
    --brand-teal-rgb: 57, 174, 169;  /* RGB values for use with rgba() */
    --brand-teal-light: #A2D5AB;
    --brand-teal-light-rgb: 162, 213, 171;
    --brand-teal-dark: #557B83;
    --brand-teal-dark-rgb: 85, 123, 131;
    --brand-accent: #E5FEC1;
    --brand-teal-gradient: linear-gradient(135deg, #39AEA9 0%, #557B83 100%);
    --brand-teal-gradient-light: linear-gradient(135deg, #A2D5AB 0%, #39AEA9 100%);

    /* Spacing Scale - 4px base unit */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    --space-16: 4rem;     /* 64px */
    --space-20: 5rem;     /* 80px */
    --space-24: 6rem;     /* 96px */

    /* Typography Scale - Mobile First (Touch-optimized) */
    --text-xs: 0.6875rem;    /* 11px */
    --text-sm: 0.8125rem;    /* 13px */
    --text-base: 1rem;       /* 16px */
    --text-lg: 1.125rem;     /* 18px */
    --text-xl: 1.25rem;      /* 20px */
    --text-2xl: 1.5rem;      /* 24px */
    --text-3xl: 1.875rem;    /* 30px */
    --text-4xl: 2.25rem;     /* 36px */
    --text-5xl: 3rem;        /* 48px */

    /* Component Sizing - Mobile First */
    --button-height-sm: 36px;
    --button-height-base: 44px;
    --button-height-lg: 52px;
    --button-padding-x: 1.5rem;
    --button-padding-y: 0.75rem;

    --input-height: 44px;
    --input-padding-x: 1rem;
    --input-padding-y: 0.75rem;

    --card-padding: 1.5rem;    /* 24px */
    --nav-height: 64px;

    --icon-sm: 16px;
    --icon-base: 20px;
    --icon-lg: 24px;
    --icon-xl: 32px;

    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;

    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* Border Radius Scale */
    --radius-sm: 0.375rem;    /* 6px */
    --radius-base: 0.5rem;    /* 8px */
    --radius-md: 0.75rem;     /* 12px */
    --radius-lg: 1rem;        /* 16px */
    --radius-xl: 1.5rem;      /* 24px */
    --radius-2xl: 2rem;       /* 32px */
    --radius-3xl: 3rem;       /* 48px */
    --radius-full: 9999px;

    /* Shadow Scale - Subtle Elevation */
    --shadow-xs: 0 1px 1px 0 rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-base: 0 2px 8px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px 0 rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 32px 0 rgba(0, 0, 0, 0.14);
    --shadow-2xl: 0 16px 48px 0 rgba(0, 0, 0, 0.16);
    --shadow-inner: inset 0 1px 2px 0 rgba(0, 0, 0, 0.04);

    /* Brand Shadows - Subtle Blue Glow */
    --shadow-brand-sm: 0 2px 8px rgba(0, 122, 255, 0.12);
    --shadow-brand-md: 0 4px 16px rgba(0, 122, 255, 0.16);
    --shadow-brand-lg: 0 8px 32px rgba(0, 122, 255, 0.2);

    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-notification: 1080;

    /* Animation Durations */
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 350ms;
    --duration-slower: 500ms;

    /* Animation Easings */
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Glass Effect Properties - Minimal Style */
    --glass-bg: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-blur: 10px;

    /* Gradient Backgrounds - Clean Gradients */
    --gradient-primary: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
    --gradient-success: linear-gradient(135deg, #34C759 0%, #248A3D 100%);
    --gradient-brand: linear-gradient(135deg, #99C9FF 0%, #007AFF 50%, #0051D5 100%);
    --gradient-accent: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    --gradient-shine: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

/* ============================================
   DARK MODE THEME
   ============================================ */

[data-theme="dark"] {
    /* Dark Mode - True Black Elevated Design */
    --color-bg-primary: #000000;
    --color-bg-secondary: #1c1c1e;
    --color-bg-tertiary: #2c2c2e;
    --color-surface: #1c1c1e;
    --color-surface-elevated: #2c2c2e;

    /* Dark Mode Text - High Contrast */
    --color-text-primary: #ffffff;
    --color-text-secondary: #98989d;
    --color-text-tertiary: #636366;
    --color-text-inverse: #000000;

    /* Dark Mode Borders - Subtle Light Borders */
    --color-border-light: rgba(255, 255, 255, 0.08);
    --color-border-medium: rgba(255, 255, 255, 0.15);
    --color-border-heavy: rgba(255, 255, 255, 0.24);

    /* Dark Mode Primary - Brighter Blue */
    --color-primary: #0A84FF;
    --color-primary-hover: #409CFF;
    --color-primary-light: rgba(10, 132, 255, 0.15);

    /* Dark Mode Glass - Clean Elevation */
    --glass-bg: rgba(28, 28, 30, 0.88);
    --glass-border: rgba(255, 255, 255, 0.12);

    /* Dark Mode Shadows - Subtle Depth */
    --shadow-xs: 0 1px 1px 0 rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-base: 0 2px 8px 0 rgba(0, 0, 0, 0.6);
    --shadow-md: 0 4px 16px 0 rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 8px 24px 0 rgba(0, 0, 0, 0.8);
    --shadow-xl: 0 12px 32px 0 rgba(0, 0, 0, 0.9);
    --shadow-2xl: 0 16px 48px 0 rgba(0, 0, 0, 0.95);

    /* Dark Mode Brand Shadows - Blue Glow */
    --shadow-brand-sm: 0 2px 8px rgba(10, 132, 255, 0.2);
    --shadow-brand-md: 0 4px 16px rgba(10, 132, 255, 0.24);
    --shadow-brand-lg: 0 8px 32px rgba(10, 132, 255, 0.28);

    /* Dark Mode Semantic Colors */
    --color-success: #32D74B;
    --color-success-light: rgba(50, 215, 75, 0.15);
    --color-warning: #FF9F0A;
    --color-warning-light: rgba(255, 159, 10, 0.15);
    --color-danger: #FF453A;
    --color-danger-light: rgba(255, 69, 58, 0.15);

    /* Dark Mode Brand Teal Colors (Adjusted for visibility) */
    --brand-teal: #5AC8FA;
    --brand-teal-rgb: 90, 200, 250;  /* RGB values for use with rgba() */
    --brand-teal-light: #B8E6C9;
    --brand-teal-light-rgb: 184, 230, 201;
    --brand-teal-dark: #7FB3BE;
    --brand-teal-dark-rgb: 127, 179, 190;
    --brand-accent: #F0FFD5;
    --brand-teal-gradient: linear-gradient(135deg, #5AC8FA 0%, #7FB3BE 100%);
    --brand-teal-gradient-light: linear-gradient(135deg, #B8E6C9 0%, #5AC8FA 100%);

    /* Dark Mode Brand Colors (Brighter for visibility) */
    --brand-lightest: #1e3a5f;
    --brand-light: #60a5fa;
    --brand-medium: #0A84FF;
    --brand-dark: #409CFF;

    /* Dark Mode Info Color */
    --color-info: #0A84FF;
    --color-info-light: rgba(10, 132, 255, 0.15);

    /* Dark Mode Gradients */
    --gradient-accent: linear-gradient(90deg, #60a5fa, #a78bfa, #f472b6);
}

/* Dark Mode Animated Background - Minimal Style */
[data-theme="dark"] .fixed.inset-0 > .absolute.inset-0 {
    background: var(--color-bg-primary);
}

[data-theme="dark"] .animate-blob {
    display: none;
}

/* Light mode - Minimal gradient background */
.fixed.inset-0 > .absolute.inset-0 {
    background: linear-gradient(135deg, rgba(245, 245, 247, 0.4) 0%, rgba(255, 255, 255, 0.6) 100%);
}

.animate-blob {
    display: none;
}

/* ============================================
   RESPONSIVE DESIGN TOKENS
   ============================================ */

/* Tablet (iPad) - Medium Sizing */
@media (min-width: 768px) {
    :root {
        --text-xs: 0.6875rem;    /* 11px */
        --text-sm: 0.75rem;      /* 12px */
        --text-base: 0.9375rem;  /* 15px */
        --text-lg: 1rem;         /* 16px */
        --text-xl: 1.125rem;     /* 18px */
        --text-2xl: 1.375rem;    /* 22px */
        --text-3xl: 1.75rem;     /* 28px */
        --text-4xl: 2rem;        /* 32px */
        --text-5xl: 2.5rem;      /* 40px */

        --button-height-sm: 32px;
        --button-height-base: 40px;
        --button-height-lg: 44px;
        --button-padding-x: 1.25rem;
        --button-padding-y: 0.625rem;

        --input-height: 40px;
        --input-padding-x: 0.875rem;
        --input-padding-y: 0.625rem;

        --card-padding: 1.25rem;  /* 20px */
        --nav-height: 112px;

        --icon-sm: 16px;
        --icon-base: 18px;
        --icon-lg: 20px;
        --icon-xl: 24px;
    }
}

/* Desktop - Compact, Mouse-optimized */
@media (min-width: 1024px) {
    :root {
        --text-xs: 0.6875rem;    /* 11px */
        --text-sm: 0.75rem;      /* 12px */
        --text-base: 0.875rem;   /* 14px */
        --text-lg: 0.9375rem;    /* 15px */
        --text-xl: 1rem;         /* 16px */
        --text-2xl: 1.25rem;     /* 20px */
        --text-3xl: 1.5rem;      /* 24px */
        --text-4xl: 1.75rem;     /* 28px */
        --text-5xl: 2.25rem;     /* 36px */

        --button-height-sm: 28px;
        --button-height-base: 32px;
        --button-height-lg: 36px;
        --button-padding-x: 1rem;
        --button-padding-y: 0.5rem;

        --input-height: 36px;
        --input-padding-x: 0.75rem;
        --input-padding-y: 0.5rem;

        --card-padding: 1rem;     /* 16px */
        --nav-height: 104px;

        --icon-sm: 14px;
        --icon-base: 16px;
        --icon-lg: 18px;
        --icon-xl: 20px;
    }
}

/* Touch Device Detection - Keep larger targets */
@media (hover: none) and (pointer: coarse) {
    :root {
        --button-height-sm: 36px;
        --button-height-base: 44px;
        --button-height-lg: 52px;
        --input-height: 44px;
    }
}

/* ============================================
   BASE RESETS & DEFAULTS
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text-primary);
    background-color: var(--color-bg-primary);
    transition: background-color var(--duration-slow) var(--ease-in-out),
                color var(--duration-slow) var(--ease-in-out);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   TYPOGRAPHY SYSTEM
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
    margin-bottom: var(--space-4);
    color: var(--color-text-secondary);
    line-height: var(--leading-relaxed);
}

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }

.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-extrabold { font-weight: var(--font-extrabold); }

/* ============================================
   GLASS MORPHISM SYSTEM
   ============================================ */

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(120%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(120%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

.glass-strong {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .glass-strong {
    background: rgba(28, 28, 30, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.glass-subtle {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .glass-subtle {
    background: rgba(28, 28, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============================================
   BUTTON SYSTEM
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--button-padding-y) var(--button-padding-x);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    line-height: var(--leading-none);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-in-out);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: var(--button-height-base);
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-in-out);
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: scale(0.96);
    opacity: 0.8;
}

.btn:disabled,
.btn:disabled:hover,
.btn:disabled:active {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Primary Button */
.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-sm);
}

.btn-primary:active {
    transform: scale(0.96);
    opacity: 0.8;
}

/* Secondary Button */
.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1.5px solid var(--color-border-medium);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-border-heavy);
    box-shadow: var(--shadow-base);
    transform: translateY(-1px);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-ghost:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

/* Danger Button */
.btn-danger {
    background: var(--color-danger);
    color: white;
    box-shadow: var(--shadow-xs);
}

.btn-danger:hover {
    opacity: 0.9;
    box-shadow: var(--shadow-sm);
}

/* Icon Button */
.btn-icon {
    padding: var(--space-2);
    min-width: var(--button-height-base);
}

/* Small Button */
.btn-sm {
    padding: calc(var(--button-padding-y) * 0.75) calc(var(--button-padding-x) * 0.75);
    font-size: var(--text-xs);
    min-height: var(--button-height-sm);
}

/* Large Button */
.btn-lg {
    padding: calc(var(--button-padding-y) * 1.25) calc(var(--button-padding-x) * 1.5);
    font-size: var(--text-base);
    min-height: var(--button-height-lg);
}

/* ============================================
   CARD SYSTEM
   ============================================ */

.card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--card-padding);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-base) var(--ease-in-out);
    border: 1px solid var(--color-border-light);
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    box-shadow: var(--shadow-base);
    border-color: var(--color-border-medium);
}

.card-interactive:active {
    transform: scale(0.99);
    opacity: 0.95;
}

.card-elevated {
    box-shadow: var(--shadow-lg);
}

.card-flat {
    box-shadow: none;
    border: 1px solid var(--color-border-light);
}

/* ============================================
   INPUT SYSTEM
   ============================================ */

.form-group {
    margin-bottom: var(--space-6);
    position: relative;
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
    transition: color var(--duration-fast) var(--ease-in-out);
}

.form-input {
    width: 100%;
    padding: var(--input-padding-y) var(--input-padding-x);
    font-size: var(--text-sm);
    font-family: inherit;
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1.5px solid var(--color-border-medium);
    border-radius: var(--radius-lg);
    transition: all var(--duration-base) var(--ease-in-out);
    min-height: var(--input-height);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-input::placeholder {
    color: var(--color-text-tertiary);
}

/* Color input - round inner swatch to match border */
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}
input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 0.375rem;
}
input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 0.375rem;
}

/* Input with icon */
.input-icon {
    position: relative;
}

.input-icon svg {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--color-text-tertiary);
    pointer-events: none;
}

.input-icon input {
    padding-left: var(--space-12);
}

/* ============================================
   TABLE SYSTEM
   ============================================ */

.table-container {
    overflow-x: auto;
    border-radius: var(--radius-2xl);
    background: var(--color-surface);
    box-shadow: var(--shadow-base);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead {
    background: var(--color-bg-secondary);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.table thead th {
    padding: var(--space-4) var(--space-6);
    text-align: left;
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-border-medium);
    white-space: nowrap;
}

.table thead th:first-child {
    border-top-left-radius: 12px;
}

.table thead th:last-child {
    border-top-right-radius: 12px;
}

.table tbody tr {
    transition: all var(--duration-fast) var(--ease-in-out);
    border-bottom: 1px solid var(--color-border-light);
}

.table tbody tr:hover {
    background: var(--color-primary-light);
}

.table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.01);
}

.table tbody tr:nth-child(even):hover {
    background: var(--color-primary-light);
}

.table tbody td {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-sm);
    color: var(--color-text-primary);
}

.table tbody tr.selected {
    background: var(--color-primary-light);
    border-left: 3px solid var(--color-primary);
}

/* Invoice items table specific styles */
.invoice-items-table {
    table-layout: fixed;
}

.invoice-items-table thead th:nth-child(1) {
    width: 50%;
    text-align: left;
}

.invoice-items-table thead th:nth-child(2),
.invoice-items-table thead th:nth-child(3),
.invoice-items-table thead th:nth-child(4) {
    width: 16.66%;
    text-align: right;
}

.invoice-items-table tbody td:nth-child(2),
.invoice-items-table tbody td:nth-child(3),
.invoice-items-table tbody td:nth-child(4) {
    text-align: right;
}

/* Mobile responsive table */
@media (max-width: 768px) {
    .table-responsive thead {
        display: none;
    }

    .table-responsive tbody,
    .table-responsive tr,
    .table-responsive td {
        display: block;
    }

    .table-responsive tr {
        margin-bottom: var(--space-4);
        border-radius: var(--radius-xl);
        padding: var(--space-4);
        background: var(--color-surface);
        box-shadow: var(--shadow-sm);
    }

    .table-responsive td {
        display: flex;
        justify-content: space-between;
        padding: var(--space-3) 0;
        border: none;
    }

    .table-responsive td::before {
        content: attr(data-label);
        font-weight: var(--font-semibold);
        color: var(--color-text-secondary);
        font-size: var(--text-xs);
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }
}

/* ============================================
   BREADCRUMB NAVIGATION - Minimal One-Line
   ============================================ */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: var(--space-3);
    font-size: 13px;
    line-height: 1;
}

.breadcrumb-sep {
    margin: 0 6px;
    color: var(--color-text-tertiary);
    opacity: 0.5;
    font-weight: 300;
}

.breadcrumb-link {
    color: var(--color-text-tertiary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.breadcrumb-link:hover {
    color: var(--color-text-primary);
}

.breadcrumb-current {
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* Dark mode - improved visibility */
[data-theme="dark"] .breadcrumb-sep {
    color: var(--color-text-secondary);
    opacity: 0.4;
}

[data-theme="dark"] .breadcrumb-link {
    color: var(--color-text-secondary);
}

[data-theme="dark"] .breadcrumb-link:hover {
    color: var(--color-text-primary);
}

[data-theme="dark"] .breadcrumb-current {
    color: var(--color-text-primary);
    opacity: 0.9;
}

/* ============================================
   NAVIGATION - MINIMAL DESIGN
   ============================================ */

.nav-premium {
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--color-border-light);
    transition: all var(--duration-base) var(--ease-in-out);
}

[data-theme="dark"] .nav-premium {
    background: rgba(28, 28, 30, 0.72);
}

/* Navigation Container Wrapper */
.nav-container-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Navigation Container */
.nav-container {
    width: 100%;
    max-width: 1280px;
    padding: 0 1.5rem;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all var(--duration-base) var(--ease-bounce);
}

.logo-icon:hover {
    transform: scale(1.1) rotate(5deg);
}

.logo-text {
    font-size: var(--text-xl);
    font-weight: var(--font-extrabold);
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-item {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all var(--duration-base) var(--ease-in-out);
    position: relative;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: transform var(--duration-base) var(--ease-in-out);
}

.nav-item:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.nav-item-active {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.nav-item-active::after {
    transform: translateX(-50%) scaleX(1);
}

.user-badge {
    padding: var(--space-2) var(--space-4);
    background: var(--color-surface);
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border-light);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
}

.user-role {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.logout-btn {
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    color: var(--color-text-secondary);
    transition: all var(--duration-base) var(--ease-in-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    background: var(--color-danger-light);
    color: var(--color-danger);
    transform: scale(1.1);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes blob {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(10px, -20px) scale(1.05);
    }
    66% {
        transform: translate(-10px, 10px) scale(0.95);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(0, 122, 255, 0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--duration-slow) var(--ease-in-out);
}

.animate-slide-up {
    animation: slideUp var(--duration-slow) var(--ease-out);
}

.animate-slide-down {
    animation: slideDown var(--duration-slow) var(--ease-out);
}

.animate-slide-right {
    animation: slideRight var(--duration-slow) var(--ease-out);
}

.animate-scale-in {
    animation: scaleIn var(--duration-base) var(--ease-out);
}

.animate-bounce-in {
    animation: scaleIn var(--duration-slow) var(--ease-bounce);
}

.animate-float {
    animation: float 3s var(--ease-smooth) infinite;
}

.animate-pulse {
    animation: pulse 2s var(--ease-smooth) infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-fade-out {
    animation: fadeOut var(--duration-slow) var(--ease-in-out);
}

.animate-slide-in-right {
    animation: slideInRight var(--duration-base) var(--ease-out);
}

.animate-slide-left {
    animation: slideLeft var(--duration-slow) var(--ease-out);
}

/* ============================================
   REDUCED MOTION SUPPORT
   Respects user's OS-level motion preferences
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .animate-fade-in,
    .animate-fade-out,
    .animate-slide-up,
    .animate-slide-down,
    .animate-slide-right,
    .animate-slide-in-right,
    .animate-slide-left,
    .animate-scale-in,
    .animate-bounce-in,
    .animate-float,
    .animate-pulse,
    .animate-spin {
        animation: none !important;
    }
}

.animate-blob {
    animation: blob 12s var(--ease-smooth) infinite;
}

/* Animation Delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-500 { animation-delay: 500ms; }

/* ============================================
   MODAL SYSTEM (BEM Architecture)
   Base: .modal, .modal-backdrop, .modal-header, .modal-body, .modal-footer
   Modifiers: .modal--fullscreen (settings.css), .modal--large, .modal--small
   ============================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: fadeIn var(--duration-base) var(--ease-out);
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn var(--duration-base) var(--ease-bounce);
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
}

.modal-close {
    padding: var(--space-2);
    border-radius: var(--radius-lg);
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-in-out);
}

.modal-close:hover {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-6);
    border-top: 1px solid var(--color-border-light);
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

/* Modal BEM Modifiers */
.modal--small {
    max-width: 400px;
}

.modal--large {
    max-width: 800px;
}

.modal--fullwidth {
    max-width: 95vw;
    width: 95vw;
}

/* ============================================
   NOTIFICATION / TOAST SYSTEM
   ============================================ */

.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-notification);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 400px;
}

.toast {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: slideRight var(--duration-base) var(--ease-out);
    border-left: 4px solid var(--color-primary);
}

.toast-success {
    border-left-color: var(--color-success);
}

.toast-error {
    border-left-color: var(--color-danger);
}

.toast-warning {
    border-left-color: var(--color-warning);
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.toast-close {
    padding: var(--space-1);
    border: none;
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-base);
    transition: all var(--duration-fast) var(--ease-in-out);
}

.toast-close:hover {
    background: var(--color-border-light);
    color: var(--color-text-primary);
}

/* Toast BEM Modifier - Glass morphism variant */
.toast--glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--color-primary);
}

.toast--glass.toast-success {
    border-left-color: var(--color-success);
    background: var(--color-success-light);
}

.toast--glass.toast-error {
    border-left-color: var(--color-danger);
    background: var(--color-danger-light);
}

.toast--glass.toast-warning {
    border-left-color: var(--color-warning);
    background: var(--color-warning-light);
}

.toast--glass.toast-info {
    border-left-color: var(--color-info);
    background: var(--color-info-light);
}

/* ============================================
   BADGE SYSTEM
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.badge-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.badge-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-neutral {
    background: var(--color-border-medium);
    color: var(--color-text-secondary);
}

/* ============================================
   LOADING STATES
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-bg-tertiary) 0%,
        var(--color-bg-secondary) 50%,
        var(--color-bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-base);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   PROGRESS BARS
   ============================================ */

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-border-light);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--duration-slow) var(--ease-in-out);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-shine);
    animation: shine 2s infinite;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-8);
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.empty-state:hover {
    opacity: 0.8;
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto var(--space-6);
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    animation: float 3s var(--ease-smooth) infinite;
}

.empty-state-title {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-6);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.rounded { border-radius: var(--radius-base); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-base); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* ============================================
   DARK MODE TOGGLE
   ============================================ */

.theme-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    border: 2px solid var(--color-border-light);
    background: var(--color-background);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.theme-toggle:hover {
    transform: scale(1.05);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-light);
}

.theme-toggle::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23262626' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(0deg);
}

.theme-toggle:hover::after {
    transform: rotate(20deg);
}

[data-theme="dark"] .theme-toggle {
    background: var(--color-surface);
    border-color: var(--color-border-medium);
}

[data-theme="dark"] .theme-toggle::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FAFAFA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'%3E%3C/circle%3E%3Cline x1='12' y1='1' x2='12' y2='3'%3E%3C/line%3E%3Cline x1='12' y1='21' x2='12' y2='23'%3E%3C/line%3E%3Cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'%3E%3C/line%3E%3Cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'%3E%3C/line%3E%3Cline x1='1' y1='12' x2='3' y2='12'%3E%3C/line%3E%3Cline x1='21' y1='12' x2='23' y2='12'%3E%3C/line%3E%3Cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'%3E%3C/line%3E%3Cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'%3E%3C/line%3E%3C/svg%3E");
    transform: rotate(0deg);
}

[data-theme="dark"] .theme-toggle:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-light);
}

[data-theme="dark"] .theme-toggle:hover::after {
    transform: rotate(-20deg);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

@media (max-width: 768px) {
    :root {
        --space-container: var(--space-4);
    }

    .mobile-menu-btn {
        padding: var(--space-2);
        border-radius: var(--radius-lg);
        border: none;
        background: transparent;
        color: var(--color-text-primary);
        cursor: pointer;
    }

    .mobile-menu {
        display: none;
        background: var(--color-surface);
        border-radius: var(--radius-xl);
        margin-top: var(--space-4);
        padding: var(--space-4);
        box-shadow: var(--shadow-lg);
    }

    .mobile-menu.active {
        display: block;
        animation: slideDown var(--duration-base) var(--ease-out);
    }

    .mobile-menu-item {
        display: block;
        padding: var(--space-3) var(--space-4);
        color: var(--color-text-primary);
        text-decoration: none;
        border-radius: var(--radius-lg);
        transition: background var(--duration-fast) var(--ease-in-out);
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .mobile-menu-item:hover {
        background: var(--color-primary-light);
        color: var(--color-primary);
    }
}

/* Desktop: Hide mobile menu */
@media (min-width: 769px) {
    .mobile-menu {
        display: none !important;
    }

    .mobile-menu-btn {
        display: none !important;
    }
}

/* Brand Teal Utility Classes */
.text-brand-teal {
    color: var(--brand-teal) !important;
}

.bg-brand-teal {
    background-color: var(--brand-teal) !important;
}

.border-brand-teal {
    border-color: var(--brand-teal) !important;
}

/* Checkbox with brand teal */
input[type="checkbox"].checkbox-brand-teal {
    color: var(--brand-teal);
    border-color: var(--color-border-medium);
}

input[type="checkbox"].checkbox-brand-teal:focus {
    ring-color: var(--brand-teal);
    border-color: var(--brand-teal);
}

/* Print Styles */
@media print {
    .nav-premium,
    .btn,
    .mobile-menu-btn {
        display: none !important;
    }

    body {
        background: white;
    }

    .glass {
        background: var(--color-bg-primary);
        border: 1px solid var(--color-border-medium);
    }
}

/* ============================================
   CUSTOM SCROLLBAR - THEME AWARE
   ============================================ */

/* Webkit browsers (Chrome, Safari, Edge) - Applied to scrollable containers only */
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.table-container::-webkit-scrollbar,
.dropdown-menu::-webkit-scrollbar,
.card-body::-webkit-scrollbar,
[data-scrollable]::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track,
.dropdown-menu::-webkit-scrollbar-track,
.card-body::-webkit-scrollbar-track,
[data-scrollable]::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--radius-full);
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb,
.dropdown-menu::-webkit-scrollbar-thumb,
.card-body::-webkit-scrollbar-thumb,
[data-scrollable]::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(var(--brand-teal-rgb), 0.5) 0%, rgba(var(--brand-teal-rgb), 0.7) 100%);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: all var(--duration-base) var(--ease-in-out);
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover,
.dropdown-menu::-webkit-scrollbar-thumb:hover,
.card-body::-webkit-scrollbar-thumb:hover,
[data-scrollable]::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(var(--brand-teal-rgb), 0.7) 0%, rgba(var(--brand-teal-rgb), 0.9) 100%);
    border-width: 1px;
}

html::-webkit-scrollbar-thumb:active,
body::-webkit-scrollbar-thumb:active,
.main-content::-webkit-scrollbar-thumb:active,
.modal-content::-webkit-scrollbar-thumb:active,
.sidebar::-webkit-scrollbar-thumb:active,
.table-container::-webkit-scrollbar-thumb:active,
.dropdown-menu::-webkit-scrollbar-thumb:active,
.card-body::-webkit-scrollbar-thumb:active,
[data-scrollable]::-webkit-scrollbar-thumb:active {
    background: var(--brand-teal-gradient);
}

/* Dark mode scrollbar */
[data-theme="dark"] html::-webkit-scrollbar-track,
[data-theme="dark"] body::-webkit-scrollbar-track,
[data-theme="dark"] .main-content::-webkit-scrollbar-track,
[data-theme="dark"] .modal-content::-webkit-scrollbar-track,
[data-theme="dark"] .sidebar::-webkit-scrollbar-track,
[data-theme="dark"] .table-container::-webkit-scrollbar-track,
[data-theme="dark"] .dropdown-menu::-webkit-scrollbar-track,
[data-theme="dark"] .card-body::-webkit-scrollbar-track,
[data-theme="dark"] [data-scrollable]::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] html::-webkit-scrollbar-thumb,
[data-theme="dark"] body::-webkit-scrollbar-thumb,
[data-theme="dark"] .main-content::-webkit-scrollbar-thumb,
[data-theme="dark"] .modal-content::-webkit-scrollbar-thumb,
[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb,
[data-theme="dark"] .table-container::-webkit-scrollbar-thumb,
[data-theme="dark"] .dropdown-menu::-webkit-scrollbar-thumb,
[data-theme="dark"] .card-body::-webkit-scrollbar-thumb,
[data-theme="dark"] [data-scrollable]::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(93, 217, 193, 0.4) 0%, rgba(93, 217, 193, 0.6) 100%);
}

[data-theme="dark"] html::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] body::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .main-content::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .modal-content::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .table-container::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .dropdown-menu::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .card-body::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] [data-scrollable]::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(93, 217, 193, 0.6) 0%, rgba(93, 217, 193, 0.8) 100%);
}

[data-theme="dark"] html::-webkit-scrollbar-thumb:active,
[data-theme="dark"] body::-webkit-scrollbar-thumb:active,
[data-theme="dark"] .main-content::-webkit-scrollbar-thumb:active,
[data-theme="dark"] .modal-content::-webkit-scrollbar-thumb:active,
[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb:active,
[data-theme="dark"] .table-container::-webkit-scrollbar-thumb:active,
[data-theme="dark"] .dropdown-menu::-webkit-scrollbar-thumb:active,
[data-theme="dark"] .card-body::-webkit-scrollbar-thumb:active,
[data-theme="dark"] [data-scrollable]::-webkit-scrollbar-thumb:active {
    background: var(--brand-teal-gradient-light);
}

/* Firefox - Applied to scrollable containers only (not * selector for performance) */
html,
body,
.main-content,
.modal-content,
.sidebar,
.table-container,
.dropdown-menu,
.card-body,
[data-scrollable] {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--brand-teal-rgb), 0.6) rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] html,
[data-theme="dark"] body,
[data-theme="dark"] .main-content,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .sidebar,
[data-theme="dark"] .table-container,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .card-body,
[data-theme="dark"] [data-scrollable] {
    scrollbar-color: rgba(93, 217, 193, 0.5) rgba(255, 255, 255, 0.05);
}

/* ============================================
   MAIN CONTENT ALIGNMENT
   ============================================ */

.main-content-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding-top: calc(var(--nav-height) + 2rem);
    padding-bottom: 3rem;
}

.main-content {
    width: 100%;
    max-width: 1280px;
    padding: 0 1.5rem;
}

/* ============================================
   NEW MINIMAL NAVIGATION STYLES
   ============================================ */

/* Logo */
.nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity var(--duration-base) var(--ease-out);
    flex-shrink: 0;
}

.nav-logo:hover {
    opacity: 0.8;
}

.nav-logo-img {
    height: 40px;
    width: auto;
}

/* Logo theme switching */
.light-logo {
    display: block;
}

.dark-logo {
    display: none;
}

[data-theme="dark"] .light-logo {
    display: none;
}

[data-theme="dark"] .dark-logo {
    display: block;
}

/* Navigation Links */
.nav-links {
    display: none;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    margin: 0 2rem;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
    }
}

.nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all var(--duration-base) var(--ease-in-out);
    position: relative;
}

.nav-link:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-tertiary);
}

.nav-link-active {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.nav-link-active:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

/* User Actions - Right */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Action Buttons */
.nav-action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--color-text-secondary);
    border: none;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-in-out);
}

.nav-action-btn:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

/* Theme Toggle Icons */
.nav-icon-sun {
    display: none;
}

.nav-icon-moon {
    display: block;
}

[data-theme="dark"] .nav-icon-sun {
    display: block;
}

[data-theme="dark"] .nav-icon-moon {
    display: none;
}

/* User Profile */
.nav-profile {
    position: relative;
    display: none;
}

@media (min-width: 768px) {
    .nav-profile {
        display: block;
    }
}

.nav-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-in-out);
    color: var(--color-text-secondary);
}

.nav-profile-btn:hover {
    color: var(--color-text-primary);
}

.nav-profile-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: inherit;
}

/* Profile Dropdown Menu */
.nav-profile-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all var(--duration-base) var(--ease-out);
    z-index: 50;
}

.nav-profile-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-profile-header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border-light);
}

.nav-profile-info {
    display: flex;
    flex-direction: column;
}

.nav-profile-fullname {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.nav-profile-role {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    text-transform: capitalize;
}

.nav-profile-divider {
    height: 1px;
    background: var(--color-border-light);
}

.nav-profile-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--color-text-primary);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-in-out);
    font-size: 0.875rem;
}

.nav-profile-item:hover {
    background: var(--color-bg-tertiary);
}

/* Business Switcher List */
.nav-business-list {
    padding: 0.25rem 0;
}

.nav-business-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text-primary);
    text-align: left;
    transition: background var(--duration-fast) var(--ease-in-out);
}

.nav-business-item:hover {
    background: var(--color-bg-tertiary);
}

.nav-business-item.nav-business-active {
    color: var(--color-primary);
    font-weight: 500;
}

.nav-business-item.nav-business-create {
    gap: 0.5rem;
    justify-content: flex-start;
    color: var(--color-primary);
    font-weight: 500;
    border-top: 1px solid var(--color-border-light);
    margin-top: 0.25rem;
    padding-top: 0.75rem;
}

/* Mobile Menu Toggle */
.nav-mobile-toggle {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
}

@media (min-width: 768px) {
    .nav-mobile-toggle {
        display: none;
    }
}

.nav-mobile-line {
    width: 20px;
    height: 2px;
    background: var(--color-text-primary);
    border-radius: 2px;
    transition: all var(--duration-base) var(--ease-in-out);
}

.nav-mobile-toggle.active .nav-mobile-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-mobile-toggle.active .nav-mobile-line:nth-child(2) {
    opacity: 0;
}

.nav-mobile-toggle.active .nav-mobile-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Slide-out Menu */
.nav-mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100%;
    background: var(--color-surface);
    z-index: 1100;
    transition: right var(--duration-base) var(--ease-in-out);
    overflow-y: auto;
}

.nav-mobile-menu.show {
    right: 0;
}

.nav-mobile-menu-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.nav-mobile-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border-light);
}


.nav-mobile-user-info {
    display: flex;
    flex-direction: column;
}

.nav-mobile-user-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.nav-mobile-user-role {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    text-transform: capitalize;
}

.nav-mobile-links {
    flex: 1;
    padding: 0.5rem;
}

.nav-mobile-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--color-text-primary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all var(--duration-fast) var(--ease-in-out);
    font-size: 0.9375rem;
}

.nav-mobile-link:hover {
    background: var(--color-bg-tertiary);
}

.nav-mobile-link-active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.nav-mobile-actions {
    padding: 0.5rem;
    border-top: 1px solid var(--color-border-light);
}

.nav-mobile-logout {
    color: var(--color-danger);
}

.nav-mobile-logout:hover {
    background: var(--color-danger-light);
}

/* Mobile Menu Overlay */
.nav-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    z-index: 1099;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-base) var(--ease-in-out);
}

.nav-mobile-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   COMMAND PALETTE
   ============================================ */

.command-palette {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.command-palette.active {
    display: flex;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.command-palette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
}

.command-palette-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border-medium);
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transform: scale(0.95) translateY(-10px);
    transition: transform var(--duration-fast) var(--ease-spring);
}

.command-palette.active .command-palette-container {
    transform: scale(1) translateY(0);
}

.command-palette-header {
    padding: 0.75rem;
    border-bottom: 1px solid var(--color-border-light);
}

.command-palette-search-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.75rem;
}

.command-palette-search-icon {
    color: var(--color-text-tertiary);
    flex-shrink: 0;
}

.command-palette-input {
    flex: 1;
    padding: 0.75rem 0;
    border: none;
    background: transparent;
    font-size: 1.125rem;
    color: var(--color-text-primary);
    outline: none;
}

.command-palette-input::placeholder {
    color: var(--color-text-tertiary);
}

.command-palette-kbd {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--color-text-tertiary);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: 0.375rem;
}

.command-palette-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.command-palette-group {
    margin-bottom: 0.5rem;
}

.command-palette-group:last-child {
    margin-bottom: 0;
}

.command-palette-group-title {
    padding: 0.5rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
}

.command-palette-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-in-out);
}

.command-palette-item:hover,
.command-palette-item.selected {
    background: var(--color-bg-secondary);
}

.command-palette-item.selected {
    background: var(--color-primary-light);
}

.command-palette-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.command-palette-item.selected .command-palette-item-icon {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.command-palette-item-content {
    flex: 1;
    min-width: 0;
}

.command-palette-item-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-palette-item-description {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-palette-item-shortcut {
    display: flex;
    gap: 0.25rem;
}

.command-palette-item-shortcut kbd {
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--color-text-tertiary);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border-light);
    border-radius: 0.25rem;
}

.command-palette-empty {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-tertiary);
}

.command-palette-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

.command-palette-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--color-border-light);
    background: var(--color-bg-secondary);
    font-size: 0.6875rem;
    color: var(--color-text-tertiary);
}

.command-palette-footer kbd {
    padding: 0.125rem 0.375rem;
    font-size: 0.625rem;
    font-family: inherit;
    font-weight: 500;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: 0.25rem;
    margin-right: 0.25rem;
}

/* ============================================
   MOBILE PERFORMANCE OPTIMIZATIONS
   backdrop-filter is GPU-intensive on mobile
   ============================================ */

/* Disable backdrop-filter on low-powered devices and when reduced motion is preferred */
@media (prefers-reduced-motion: reduce) {
    .nav-premium,
    .modal-overlay,
    .nav-mobile-overlay,
    .command-palette-overlay,
    .glass,
    .glass-light,
    .glass-heavy,
    .toast-glass,
    [class*="backdrop-filter"] {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* Provide solid fallback backgrounds */
    .nav-premium {
        background: rgba(255, 255, 255, 0.95);
    }

    [data-theme="dark"] .nav-premium {
        background: rgba(17, 24, 39, 0.95);
    }

    .modal-overlay,
    .nav-mobile-overlay,
    .command-palette-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
}

/* Mobile-specific optimizations (touch devices tend to have weaker GPUs) */
@media (max-width: 768px) and (hover: none) {
    /* Reduce blur intensity on mobile for better performance */
    .glass,
    .glass-light {
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    .glass-heavy {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .nav-premium {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    /* Simpler overlays on mobile */
    .modal-overlay,
    .nav-mobile-overlay {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
}

/* For very low-powered mobile devices - disable entirely */
@media (max-width: 480px) and (hover: none) and (pointer: coarse) {
    .nav-premium,
    .glass,
    .glass-light,
    .glass-heavy {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        /* Use increased opacity instead */
        background-color: rgba(255, 255, 255, 0.92);
    }

    [data-theme="dark"] .nav-premium,
    [data-theme="dark"] .glass,
    [data-theme="dark"] .glass-light,
    [data-theme="dark"] .glass-heavy {
        background-color: rgba(17, 24, 39, 0.92);
    }
}

/* GPU compositing hint for elements that animate with backdrop-filter */
.nav-premium,
.modal-overlay,
.glass,
.glass-light,
.glass-heavy {
    will-change: auto; /* Let browser decide - avoids memory overhead */
    contain: layout style; /* CSS containment for better isolation */
}
