/* ==========================================================================
   G-NIVA — Official Design System & Mobile-First UX Stylesheet (Sprint 02)
   Zero Framework • Pure Vanilla CSS • High-Performance • Accessible
   ========================================================================== */

/* ==========================================================================
   1. Centralized Design Tokens
   ========================================================================== */
:root {
    /* Brand Colors (GITANA AI — The Intelligent Flow Design System) */
    --color-primary: #14B8A6;          /* Gitana Teal (Primary Brand, Balance & Trust) */
    --color-primary-hover: #0D9488;    /* Deep Teal */
    --color-primary-active: #115E59;
    --color-primary-subtle: rgba(20, 184, 166, 0.12);
    --color-primary-glow: rgba(20, 184, 166, 0.35);
    
    --color-primary-gradient: linear-gradient(135deg, #14B8A6 0%, #2563EB 100%);
    --color-accent-gradient: linear-gradient(135deg, #10B981 0%, #14B8A6 100%);
    --color-hero-gradient: linear-gradient(135deg, rgba(20, 184, 166, 0.08) 0%, rgba(37, 99, 235, 0.04) 50%, rgba(16, 185, 129, 0.06) 100%);

    /* Gitana Vibrant Accents */
    --color-secondary: #2563EB;        /* Royal Blue - AI Core */
    --color-secondary-hover: #1D4ED8;
    --color-secondary-subtle: rgba(37, 99, 235, 0.12);
    --color-secondary-glow: rgba(37, 99, 235, 0.3);

    --color-accent: #10B981;           /* Emerald Green - Growth & Vitality */
    --color-accent-hover: #059669;
    --color-accent-subtle: rgba(16, 185, 129, 0.14);

    --color-ai-cyan: #2DD4BF;          /* Cyan / Neural Mesh Glow */
    --color-ai-glow: rgba(45, 212, 191, 0.45);

    /* Functional Palette */
    --color-success: #10b981;
    --color-success-hover: #059669;
    --color-success-subtle: rgba(16, 185, 129, 0.12);
    --color-success-glow: rgba(16, 185, 129, 0.3);

    --color-warning: #f59e0b;
    --color-warning-hover: #d97706;
    --color-warning-subtle: rgba(245, 158, 11, 0.12);
    --color-warning-glow: rgba(245, 158, 11, 0.3);

    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;
    --color-danger-subtle: rgba(239, 68, 68, 0.12);
    --color-danger-glow: rgba(239, 68, 68, 0.3);

    --color-info: #16b8b5;
    --color-info-hover: #0d9488;
    --color-info-subtle: rgba(22, 184, 181, 0.12);
    --color-info-glow: rgba(22, 184, 181, 0.3);

    /* Neutral & Surface Palette (Dominant Bright, Clean & Modern) */
    --color-bg: #F8FAFC;               /* Crisp Off-White Slate Background */
    --color-surface: #FFFFFF;          /* Pure White Card & Panel Surface */
    --color-surface-hover: #F1F5F9;    /* Light Slate Hover State */
    --color-surface-elevated: #FFFFFF; /* Elevated Modals, Popovers & Menus */
    --color-surface-card: #FFFFFF;     /* Pure White Card Background */

    /* Borders & Dividers */
    --color-border: #E2E8F0;           /* Soft Border */
    --color-border-hover: #CBD5E1;     /* Interactive Hover Border */
    --color-border-active: var(--color-primary);

    /* Text Colors (High Accessibility & Contrast) */
    --color-text: #0F172A;             /* Deep Slate - Sharp & Clean Text */
    --color-text-secondary: #475569;   /* Slate Grey - Labels & Navigation */
    --color-text-muted: #64748B;       /* Muted Grey - Timestamps & Hints */
    --color-text-inverse: #FFFFFF;     /* Pure White for Buttons & Badges */

    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-8: 48px;

    /* Border Radius Scale */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows & Ambient Glows (Crisp, Light & Elevated) */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-fab: 0 8px 24px var(--color-primary-glow), 0 4px 12px rgba(20, 184, 166, 0.25);

    /* Typography Scale */
    --font-sans: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", Consolas, Menlo, monospace;

    --font-size-display: 1.75rem;    /* 28px */
    --font-size-page-title: 1.375rem;/* 22px */
    --font-size-section: 1.125rem;   /* 18px */
    --font-size-body: 0.9375rem;     /* 15px */
    --font-size-caption: 0.8125rem;  /* 13px */
    --font-size-label: 0.75rem;      /* 12px */

    /* Touch & Layout Constants */
    --touch-target-min: 44px;
    --header-height: 60px;
    --mobile-nav-height: 64px;
    --container-max-width: 960px;
}

/* ==========================================================================
   2. Base Reset & Box Sizing
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

img, svg {
    max-width: 100%;
    vertical-align: middle;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    padding-bottom: var(--mobile-nav-height);
}

@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }
}

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

a:hover {
    color: var(--color-primary-hover);
}

/* ==========================================================================
   3. Typography Classes
   ========================================================================== */
.font-display {
    font-size: var(--font-size-display);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    color: var(--color-text);
}

.font-page-title {
    font-size: var(--font-size-page-title);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.font-section-title {
    font-size: var(--font-size-section);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--color-text);
}

.font-body {
    font-size: var(--font-size-body);
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.font-caption {
    font-size: var(--font-size-caption);
    font-weight: 500;
    line-height: 1.4;
    color: var(--color-text-muted);
}

.font-label {
    font-size: var(--font-size-label);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

/* ==========================================================================
   4. Layout Containers & App Shell
   ========================================================================== */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.app-main {
    flex: 1;
    padding: var(--space-5) 0;
}

/* Header & Top Bar */
.app-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 90;
    height: var(--header-height);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: var(--space-3);
}

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

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-logo:hover {
    transform: translateY(-1px);
}

.brand-logo-badge {
    width: 36px;
    height: 36px;
    min-width: 36px;
    max-width: 36px;
    min-height: 36px;
    max-height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(20, 184, 166, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-logo:hover .brand-logo-badge {
    transform: scale(1.08) rotate(-3deg);
    box-shadow: 0 6px 18px rgba(20, 184, 166, 0.45);
}

.brand-logo-img {
    width: 28px;
    height: 28px;
    max-width: 28px;
    max-height: 28px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.brand-text-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand-title {
    font-family: 'Outfit', 'Plus Jakarta Sans', var(--font-sans);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #0F172A 30%, #14B8A6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #14B8A6;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: #ffffff;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 1rem;
    box-shadow: 0 0 14px var(--color-primary-glow);
}

.logo-text {
    letter-spacing: 0.04em;
}

/* Business Switcher */
.business-switcher-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.business-switcher-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 4px 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    max-width: 180px;
    min-height: 32px;
    transition: all 0.15s ease;
}

.business-switcher-btn:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-hover);
}

.biz-icon {
    font-size: 0.875rem;
    flex-shrink: 0;
    line-height: 1;
}

.biz-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
    font-size: 0.8125rem;
    font-weight: 600;
    max-width: 120px;
}

.biz-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--color-text-muted);
}

/* Desktop Nav Links */
.desktop-nav {
    display: none;
    align-items: center;
    gap: var(--space-1);
    margin-left: var(--space-4);
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
    }
}

.desktop-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: var(--space-1) var(--space-3);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}

.desktop-nav-link:hover {
    color: var(--color-primary);
    background: var(--color-surface-hover);
}

.desktop-nav-link.active {
    color: var(--color-primary-hover);
    background: var(--color-primary-subtle);
    font-weight: 700;
}

/* Header Action Buttons */
.header-search-btn {
    display: none;
    align-items: center;
    gap: var(--space-2);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 6px var(--space-3);
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
}

@media (min-width: 640px) {
    .header-search-btn {
        display: inline-flex;
    }
}

.header-icon {
    width: 16px;
    height: 16px;
}

.search-btn-kbd {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
}

.header-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    position: relative;
    cursor: pointer;
}

.header-icon-btn svg {
    width: 18px;
    height: 18px;
}

.header-icon-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.notification-badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    background-color: var(--color-danger);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--color-danger);
}

.user-avatar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #ffffff;
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

/* Language Switcher */
.lang-switch {
    display: inline-flex;
    align-items: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 2px 4px;
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 28px;
    padding: 2px 6px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    transition: all 0.15s ease;
}

.lang-btn:hover {
    color: var(--color-text);
}

.lang-btn.active {
    background-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 1px 4px var(--color-primary-glow);
}

.lang-divider {
    color: var(--color-text-muted);
    font-size: 0.6875rem;
    user-select: none;
}

/* ==========================================================================
   5. Mobile Bottom Navigation Bar (Max 5 items)
   ========================================================================== */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 80;
    padding: 0 var(--space-2);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

@media (min-width: 768px) {
    .mobile-bottom-nav {
        display: none;
    }
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--color-text-muted);
    text-decoration: none;
    gap: 3px;
    transition: color 0.15s ease;
    min-height: var(--touch-target-min);
}

.mobile-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
}

.mobile-nav-icon svg {
    width: 20px;
    height: 20px;
}

.mobile-nav-label {
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
    max-width: 68px;
    text-align: center;
}

.mobile-nav-item.active {
    color: var(--color-primary);
}

.mobile-nav-item.active .mobile-nav-icon svg {
    stroke: var(--color-primary);
}

.mobile-nav-item:active {
    transform: scale(0.95);
}

/* ==========================================================================
   6. Floating Quick Action Button & Bottom Sheet
   ========================================================================== */
.quick-action-fab {
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + 16px);
    right: var(--space-4);
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    color: #ffffff;
    border: none;
    box-shadow: var(--shadow-fab);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 85;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

@media (min-width: 768px) {
    .quick-action-fab {
        bottom: var(--space-5);
    }
}

.quick-action-fab:hover {
    transform: scale(1.08);
}

.quick-action-fab:active {
    transform: scale(0.92);
}

.fab-icon {
    width: 24px;
    height: 24px;
}

.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    padding: var(--space-2) 0;
}

@media (min-width: 480px) {
    .quick-action-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.quick-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-2);
    color: var(--color-text);
    cursor: pointer;
    text-align: center;
    gap: var(--space-2);
    min-height: 80px;
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.quick-action-item:hover {
    background: var(--color-surface-elevated);
    border-color: var(--color-primary-glow);
    transform: translateY(-2px);
}

.quick-action-item:active {
    transform: scale(0.96);
}

.quick-action-icon-box {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action-icon-box svg {
    width: 20px;
    height: 20px;
}

.action-sale { background: var(--color-success-subtle); color: var(--color-success); }
.action-purchase { background: var(--color-info-subtle); color: var(--color-info); }
.action-expense { background: var(--color-warning-subtle); color: var(--color-warning); }
.action-payment { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.action-customer { background: var(--color-primary-subtle); color: #a5b4fc; }

.quick-action-label {
    font-size: 0.8125rem;
    font-weight: 600;
}

.quick-action-hint {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* ==========================================================================
   7. Button System
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
    min-height: var(--touch-target-min);
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Sizes */
.btn-sm {
    min-height: 36px;
    padding: 6px var(--space-3);
    font-size: 0.8125rem;
}

.btn-md {
    min-height: 44px;
    padding: 10px var(--space-4);
    font-size: 0.9375rem;
}

.btn-lg {
    min-height: 50px;
    padding: 12px var(--space-5);
    font-size: 1rem;
}

/* Variants */
.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--color-primary-glow);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--color-primary-glow);
}

.btn-primary:active {
    background: var(--color-primary-active);
    transform: translateY(1px);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-hover);
}

.btn-outline {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-outline:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-border-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-ghost:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.btn-danger {
    background: var(--color-danger);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--color-danger-glow);
}

.btn-danger:hover {
    background: var(--color-danger-hover);
    color: #ffffff;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* Loading State */
.btn.is-loading {
    position: relative;
    pointer-events: none;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.6s linear infinite;
}

/* ==========================================================================
   8. Form & Input System
   ========================================================================== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.form-required {
    color: var(--color-danger);
    margin-left: 2px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.form-control {
    width: 100%;
    min-height: 44px;
    padding: 10px var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.form-control:disabled {
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

.form-textarea {
    min-height: 88px;
    resize: vertical;
}

/* Prefix / Suffix */
.input-prefix, .input-suffix {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

.input-prefix {
    left: var(--space-3);
}

.input-suffix {
    right: var(--space-3);
}

.input-wrapper.has-prefix .form-control {
    padding-left: 40px;
}

.input-wrapper.has-suffix .form-control {
    padding-right: 40px;
}

/* Select */
.select-wrapper {
    position: relative;
    width: 100%;
}

.form-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    cursor: pointer;
}

.select-chevron {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--color-text-muted);
    width: 18px;
    height: 18px;
}

.select-chevron svg {
    width: 18px;
    height: 18px;
}

/* Helper & Error Text */
.form-helper {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

.form-error {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--color-danger);
    margin-top: var(--space-1);
}

.error-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.has-error .form-control {
    border-color: var(--color-danger);
}

.has-error .form-control:focus {
    box-shadow: 0 0 0 3px var(--color-danger-subtle);
}

/* Checkbox & Radio */
.custom-control {
    display: inline-flex;
    align-items: flex-start;
    gap: var(--space-2);
    cursor: pointer;
    user-select: none;
    margin-bottom: var(--space-2);
    min-height: var(--touch-target-min);
}

.custom-control.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.custom-control-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.custom-control-indicator {
    width: 20px;
    height: 20px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.15s ease;
}

.custom-checkbox .custom-control-indicator svg {
    width: 14px;
    height: 14px;
    color: #ffffff;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s ease;
}

.custom-control-input:checked + .custom-control-indicator {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.custom-control-input:checked + .custom-control-indicator svg {
    opacity: 1;
    transform: scale(1);
}

.custom-radio .custom-control-indicator {
    border-radius: 50%;
}

.radio-inner-dot {
    width: 8px;
    height: 8px;
    background-color: #ffffff;
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s ease;
}

.custom-control-input:checked + .custom-control-indicator .radio-inner-dot {
    opacity: 1;
    transform: scale(1);
}

.custom-control-label-wrapper {
    display: flex;
    flex-direction: column;
}

.custom-control-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
}

.custom-control-description {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Switch Toggle */
.custom-switch-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    cursor: pointer;
    user-select: none;
    min-height: var(--touch-target-min);
}

.switch-track-wrapper {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    transition: 0.2s;
    border-radius: var(--radius-full);
}

.switch-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #ffffff;
    transition: 0.2s;
    border-radius: 50%;
}

.switch-input:checked + .switch-slider {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.switch-input:checked + .switch-slider::before {
    transform: translateX(20px);
}

.switch-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
}

.switch-description {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    display: block;
}

/* ==========================================================================
   9. Search Component
   ========================================================================== */
.search-bar-component {
    width: 100%;
}

.search-input-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: var(--space-3);
    width: 18px;
    height: 18px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    min-height: 44px;
    padding: 10px var(--space-3) 10px 40px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    transition: all 0.15s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
    background: var(--color-surface-hover);
}

.search-clear-btn {
    position: absolute;
    right: 42px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.search-clear-btn svg {
    width: 14px;
    height: 14px;
}

.search-shortcut-badge {
    position: absolute;
    right: var(--space-3);
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    pointer-events: none;
}

/* ==========================================================================
   Hero Banner & Pro Telemetry Components (NIVA by Gitana)
   ========================================================================== */
.card-hero-niva {
    position: relative;
    overflow: hidden;
    background: var(--color-hero-gradient);
    border: 1px solid rgba(20, 184, 166, 0.25);
    border-radius: var(--radius-xl);
    padding: var(--space-6) var(--space-4);
    text-align: center;
    box-shadow: 0 12px 36px -12px rgba(20, 184, 166, 0.15), 0 2px 6px rgba(0, 0, 0, 0.02);
    margin-bottom: var(--space-5);
    transition: border-color 0.3s ease;
}

.card-hero-niva:hover {
    border-color: rgba(20, 184, 166, 0.45);
}

.hero-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(20, 184, 166, 0.3);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    color: #0D9488;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.12);
    margin-bottom: var(--space-3);
}

.live-pulse-dot {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero-title-gradient {
    font-family: 'Outfit', 'Plus Jakarta Sans', var(--font-sans);
    font-size: clamp(2.25rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #0F172A 20%, #14B8A6 65%, #2563EB 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--space-2);
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--color-text-secondary);
    max-width: 520px;
    margin: 0 auto var(--space-4) auto;
    line-height: 1.6;
}

.quick-launch-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.quick-launch-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.quick-launch-pill:hover {
    transform: translateY(-2px);
    border-color: #0EA5E9;
    color: #0284C7;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.25);
    background: #FFFFFF;
}

.quick-launch-icon {
    font-size: 0.95rem;
}

/* Telemetry & Feature Grid */
.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

@media (min-width: 640px) {
    .telemetry-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.telemetry-card {
    background: var(--color-surface-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.telemetry-card:hover {
    transform: translateY(-3px);
    border-color: rgba(14, 165, 233, 0.45);
    box-shadow: 0 10px 24px -4px rgba(14, 165, 233, 0.12), var(--shadow-sm);
}

.telemetry-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.telemetry-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.telemetry-value {
    font-family: 'Outfit', 'Plus Jakarta Sans', var(--font-sans);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 2px;
}

.telemetry-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

/* ==========================================================================
   10. Cards
   ========================================================================== */
.card {
    background: var(--color-surface-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-clickable {
    cursor: pointer;
    display: block;
}

.card-clickable:hover {
    transform: translateY(-3px);
    border-color: #99F6E4;
    box-shadow: 0 12px 24px -4px rgba(20, 184, 166, 0.12);
}

.card-header {
    margin-bottom: var(--space-3);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
}

.card-subtitle {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* Metric Card */
.card-metric {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.metric-body {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-text);
    font-family: var(--font-sans);
}

.metric-delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.metric-delta.is-positive {
    background: var(--color-success-subtle);
    color: var(--color-success);
}

.metric-delta.is-negative {
    background: var(--color-danger-subtle);
    color: var(--color-danger);
}

.metric-footer {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Action Card */
.action-card-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.action-card-text {
    flex: 1;
}

.action-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text);
}

.action-card-subtitle {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.action-card-chevron {
    color: var(--color-text-muted);
    font-size: 1.1rem;
}

/* ==========================================================================
   11. Badges & Pills
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.badge-dot-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-primary { background: var(--color-primary-subtle); color: #a5b4fc; border: 1px solid rgba(79, 70, 229, 0.3); }
.badge-primary .badge-dot-indicator { background: var(--color-primary); }

.badge-success { background: var(--color-success-subtle); color: var(--color-success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-success .badge-dot-indicator { background: var(--color-success); animation: pulse 2s infinite; }

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

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

.badge-info { background: var(--color-info-subtle); color: var(--color-info); border: 1px solid rgba(14, 165, 233, 0.3); }
.badge-info .badge-dot-indicator { background: var(--color-info); }

.badge-neutral { background: var(--color-surface-hover); color: var(--color-text-secondary); border: 1px solid var(--color-border); }
.badge-neutral .badge-dot-indicator { background: var(--color-text-muted); }

/* ==========================================================================
   12. Alerts
   ========================================================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    border: 1px solid transparent;
    font-size: 0.875rem;
}

.alert-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-icon svg {
    width: 20px;
    height: 20px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 700;
    margin-bottom: 2px;
}

.alert-message {
    color: inherit;
    opacity: 0.9;
}

.alert-close-btn {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 2px;
}

.alert-close-btn:hover {
    opacity: 1;
}

.alert-close-btn svg {
    width: 16px;
    height: 16px;
}

.alert-success { background: var(--color-success-subtle); border-color: rgba(16, 185, 129, 0.3); color: #34d399; }
.alert-warning { background: var(--color-warning-subtle); border-color: rgba(245, 158, 11, 0.3); color: #fbbf24; }
.alert-danger  { background: var(--color-danger-subtle); border-color: rgba(239, 68, 68, 0.3); color: #f87171; }
.alert-info    { background: var(--color-info-subtle); border-color: rgba(14, 165, 233, 0.3); color: #38bdf8; }

/* ==========================================================================
   13. Toast Notifications
   ========================================================================== */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    right: var(--space-4);
    left: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: 1000;
    pointer-events: none;
    max-width: 400px;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .toast-container {
        left: auto;
        margin: 0;
    }
}

.toast-item {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow-lg);
    color: var(--color-text);
    font-size: 0.875rem;
    animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-item.is-hiding {
    opacity: 0;
    transform: translateY(-10px);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
}

.toast-message {
    flex: 1;
    font-weight: 500;
}

.toast-close-btn {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 2px;
}

.toast-close-btn:hover {
    color: var(--color-text);
}

.toast-close-btn svg {
    width: 16px;
    height: 16px;
}

.toast-item.toast-success { border-left: 4px solid var(--color-success); }
.toast-item.toast-success .toast-icon { color: var(--color-success); }
.toast-item.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-item.toast-warning .toast-icon { color: var(--color-warning); }
.toast-item.toast-danger  { border-left: 4px solid var(--color-danger); }
.toast-item.toast-danger .toast-icon { color: var(--color-danger); }
.toast-item.toast-info    { border-left: 4px solid var(--color-info); }
.toast-item.toast-info .toast-icon { color: var(--color-info); }

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

/* ==========================================================================
   14. Modals
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: var(--space-4);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-backdrop.is-open {
    display: flex;
    opacity: 1;
}

.modal-dialog {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-backdrop.is-open .modal-dialog {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
}

.modal-close-btn:hover {
    color: var(--color-text);
}

.modal-close-btn svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: var(--space-5);
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-hover);
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
}

/* ==========================================================================
   15. Bottom Sheet (Mobile-First Drawer)
   ========================================================================== */
.bottom-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bottom-sheet-backdrop.is-open {
    display: flex;
    opacity: 1;
}

.bottom-sheet-dialog {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 85vh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 16px);
}

.bottom-sheet-backdrop.is-open .bottom-sheet-dialog {
    transform: translateY(0);
}

.bottom-sheet-handle-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) 0 4px 0;
}

.sheet-handle {
    width: 36px;
    height: 4px;
    background-color: var(--color-border-hover);
    border-radius: var(--radius-full);
}

.bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.bottom-sheet-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
}

.bottom-sheet-close-btn {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
}

.bottom-sheet-close-btn svg {
    width: 20px;
    height: 20px;
}

.bottom-sheet-body {
    padding: var(--space-4);
}

.bottom-sheet-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   16. Tabs (Segmented Control)
   ========================================================================== */
.tabs-container {
    width: 100%;
}

.tabs-nav {
    display: flex;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 4px;
    gap: 4px;
    margin-bottom: var(--space-4);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 6px var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--color-text);
}

.tab-btn.active {
    background: var(--color-surface-elevated);
    color: var(--color-text);
    box-shadow: var(--shadow-sm);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.2s ease;
}

.tab-pane.active {
    display: block;
}

/* ==========================================================================
   17. Dropdown Menu
   ========================================================================== */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 4px;
    z-index: 150;
    display: none;
    animation: fadeIn 0.15s ease;
}

.dropdown-wrapper.is-open .dropdown-menu {
    display: block;
}

.dropdown-wrapper.align-right .dropdown-menu {
    right: 0;
}

.dropdown-wrapper.align-left .dropdown-menu {
    left: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px var(--space-3);
    color: var(--color-text);
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background 0.15s ease;
}

.dropdown-item:hover {
    background: var(--color-surface-hover);
    color: #ffffff;
}

.dropdown-item.is-danger {
    color: var(--color-danger);
}

.dropdown-item.is-danger:hover {
    background: var(--color-danger-subtle);
    color: var(--color-danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: 4px 0;
}

/* ==========================================================================
   18. Empty State, Loading, Skeletons, & Errors
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    background: var(--color-surface-card);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-3) auto;
    color: var(--color-text-muted);
}

.empty-state-icon svg {
    width: 48px;
    height: 48px;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-1);
}

.empty-state-desc {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    max-width: 360px;
    margin: 0 auto var(--space-4) auto;
}

/* Loading & Skeletons */
.loading-component {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-muted);
}

.loading-component.is-centered {
    display: flex;
    justify-content: center;
    padding: var(--space-5) 0;
}

.spinner-circle {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.skeleton-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: 100%;
}

.skeleton-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, var(--color-surface-hover) 25%, var(--color-surface-elevated) 50%, var(--color-surface-hover) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-xs);
}

.skeleton-title {
    height: 18px;
    width: 40%;
}

.skeleton-value {
    height: 28px;
    width: 60%;
}

.skeleton-subtitle {
    height: 12px;
    width: 30%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--color-surface-hover);
    flex-shrink: 0;
}

.skeleton-list-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.skeleton-list-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

/* Error State */
.error-state-card {
    background: var(--color-surface);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    text-align: center;
}

.error-state-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto var(--space-2) auto;
    color: var(--color-danger);
}

.error-state-icon svg {
    width: 36px;
    height: 36px;
}

.error-state-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.error-state-desc {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-3);
}

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

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

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==========================================================================
   19. UI Demo Showcase Layout
   ========================================================================== */
.ui-demo-hero {
    margin-bottom: var(--space-6);
    text-align: center;
}

.ui-demo-section {
    background: var(--color-surface-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.ui-demo-section-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-4);
}

.component-demo-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    margin-bottom: var(--space-4);
}

.component-demo-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 640px) {
    .component-demo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .component-demo-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==========================================================================
   20. Sprint 17: PWA Foundation & Mobile Responsiveness
   ========================================================================== */

/* Network Status Badge in Navigation */
.gniva-network-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.gniva-network-status.status-online {
    background: rgba(32, 201, 151, 0.12);
    color: var(--color-success);
    border: 1px solid rgba(32, 201, 151, 0.25);
}

.gniva-network-status.status-offline {
    background: rgba(220, 53, 69, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background-color: var(--color-success);
    box-shadow: 0 0 6px rgba(32, 201, 151, 0.7);
}

.status-dot.offline {
    background-color: var(--color-danger);
    box-shadow: 0 0 6px rgba(220, 53, 69, 0.7);
}

/* PWA Install Banner */
.pwa-install-banner {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

.pwa-install-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.pwa-install-icon {
    flex-shrink: 0;
    border-radius: var(--radius-md);
}

.pwa-install-text {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    font-size: 0.875rem;
}

.pwa-install-text strong {
    color: var(--color-text);
}

.pwa-install-text span {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.pwa-install-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

/* PWA Update Banner */
.pwa-update-banner {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #090d16;
    border: 1px solid var(--color-primary);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-update-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

.btn-pwa-update {
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-pwa-update:hover {
    background: var(--color-primary-hover);
}

.pwa-install-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(20, 184, 166, 0.35);
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.16), 0 4px 14px rgba(20, 184, 166, 0.2);
    z-index: 9999;
    display: none;
    width: calc(100% - 32px);
    max-width: 420px;
    box-sizing: border-box;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 768px) {
    .pwa-install-banner {
        bottom: calc(var(--mobile-nav-height, 64px) + 14px);
        width: calc(100% - 24px);
        max-width: 390px;
        padding: 9px 12px;
        border-radius: 14px;
    }
}

.pwa-install-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
}

.pwa-install-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    object-fit: contain;
}

.pwa-install-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    text-align: left;
}

.pwa-install-text strong {
    color: #0F172A;
    font-size: 0.8125rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-install-text span {
    color: #64748B;
    font-size: 0.71875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-install-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.btn-pwa-install-action {
    background: linear-gradient(135deg, #14B8A6 0%, #0D9488 100%);
    color: #ffffff !important;
    border: none;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.35);
    transition: all 0.15s ease;
}

.btn-pwa-install-action:hover {
    background: linear-gradient(135deg, #0D9488 0%, #115E59 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.45);
}

.btn-pwa-dismiss {
    background: transparent;
    color: #94A3B8 !important;
    border: none;
    padding: 6px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease;
}

.btn-pwa-dismiss:hover {
    color: #64748B !important;
}

.btn-pwa-install-action:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

/* Minimum Touch Targets & Mobile Safe Area Enhancements */
@media (max-width: 768px) {
    .btn,
    .mobile-nav-item,
    .form-control,
    .form-select,
    .header-icon-btn {
        min-height: 44px;
    }

    .mobile-bottom-nav {
        padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
        height: calc(60px + env(safe-area-inset-bottom, 0px));
    }

    .app-main {
        padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
    }
}

/* Mobile Header & Viewport Micro-Alignment */
@media (max-width: 640px) {
    .header-container {
        padding: 0 var(--space-3);
        gap: var(--space-2);
    }

    .header-left, .header-right {
        gap: var(--space-2);
    }

    .brand-logo {
        font-size: 1.05rem;
    }

    .lang-switch {
        display: none;
    }

    .gniva-network-status {
        padding: 4px 6px;
    }

    .gniva-network-status .status-text {
        display: none;
    }

    .header-right .btn-sm {
        min-height: 32px;
        padding: 5px 10px;
        font-size: 0.8125rem;
    }

    .business-switcher-btn {
        max-width: 120px;
        padding: 3px 6px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .biz-name {
        max-width: 75px;
        font-size: 0.75rem;
    }

    .biz-chevron {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 768px) {

    /* Mobile Table Card Collapsing */
    .table-responsive-cards table,
    .table-responsive-cards thead,
    .table-responsive-cards tbody,
    .table-responsive-cards th,
    .table-responsive-cards td,
    .table-responsive-cards tr {
        display: block;
    }

    .table-responsive-cards thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .table-responsive-cards tr {
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        margin-bottom: var(--space-3);
        padding: var(--space-3);
        box-shadow: var(--shadow-sm);
    }

    .table-responsive-cards td {
        border: none;
        position: relative;
        padding: 6px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
    }

    .table-responsive-cards td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--color-text-muted);
        text-align: left;
        padding-right: var(--space-2);
        flex-shrink: 0;
    }

    .hide-on-mobile {
        display: none !important;
    }

    .form-grid-2col {
        grid-template-columns: 1fr !important;
        gap: var(--space-3) !important;
    }

    .business-create-container,
    .business-settings-container,
    .auth-container {
        padding-bottom: calc(var(--mobile-nav-height, 64px) + 32px);
    }
}

.form-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

