/* ARGC Coffee - Modern Professional Stylesheet */
/* ================================================== */

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

/* CSS Custom Properties - Light Theme (Default) */
:root {
    /* Primary Colors - Coffee Brown */
    --primary-50: #FAF7F2;
    --primary-100: #F5E6D3;
    --primary-200: #E8D5B8;
    --primary-300: #D4A574;
    --primary-400: #A67B4A;
    --primary-500: #8B4513;
    --primary-600: #6B3410;
    --primary-700: #4A2409;
    --primary-800: #2C1810;
    --primary-900: #1A1412;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --success-100: #dcfce7;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --warning-100: #fef3c7;
    --warning-400: #fbbf24;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --danger-100: #fee2e2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --danger-700: #b91c1c;
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.1);

    /* Neutral Colors */
    --neutral-50: #fafafa;
    --neutral-100: #f5f5f5;
    --neutral-200: #e5e5e5;
    --neutral-300: #d4d4d4;
    --neutral-400: #a3a3a3;
    --neutral-500: #737373;
    --neutral-600: #525252;
    --neutral-700: #404040;
    --neutral-800: #262626;
    --neutral-900: #171717;

    /* Border shorthand */
    --border: var(--border-default);

    /* Income/Expense */
    --income: #10b981;
    --income-bg: rgba(16, 185, 129, 0.1);
    --expense: #ef4444;
    --expense-bg: rgba(239, 68, 68, 0.1);

    /* Category Colors - Quick Actions */
    --category-inventory: #3b82f6;
    --category-inventory-bg: rgba(59, 130, 246, 0.1);
    --category-inventory-hover: rgba(59, 130, 246, 0.15);
    --category-harvest: #f59e0b;
    --category-harvest-bg: rgba(245, 158, 11, 0.1);
    --category-harvest-hover: rgba(245, 158, 11, 0.15);
    --category-work: #8b5cf6;
    --category-work-bg: rgba(139, 92, 246, 0.1);
    --category-work-hover: rgba(139, 92, 246, 0.15);
    --category-reports: #6366f1;
    --category-reports-bg: rgba(99, 102, 241, 0.1);
    --category-reports-hover: rgba(99, 102, 241, 0.15);

    /* Background Colors */
    --bg-base: #FAF7F2;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-hover: #F5E6D3;
    --bg-active: #E8D5B8;
    --bg-sidebar: #ffffff;

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text-disabled: #cbd5e1;
    --text-inverse: #ffffff;

    /* Border Colors */
    --border-light: #f1f5f9;
    --border-default: #e2e8f0;
    --border-strong: #cbd5e1;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;
    --header-height: 64px;
    --mobile-nav-height: 64px;
    --content-max-width: 1400px;

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

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

    /* Typography */
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'IBM Plex Mono', 'Courier New', monospace;
    --font-mono: 'IBM Plex Mono', 'Fira Code', monospace;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 200ms ease;
    --transition-slow: 300ms ease;

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal-backdrop: 300;
    --z-modal: 400;
    --z-toast: 500;

    /* Safe Areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);

    /* Weather Widget Glassmorphism */
    --weather-glass-bg: rgba(255, 255, 255, 0.25);
    --weather-glass-bg-hover: rgba(255, 255, 255, 0.35);
    --weather-glass-bg-elevated: rgba(255, 255, 255, 0.4);
    --weather-text-primary: #1e293b;
    --weather-text-secondary: #475569;
    --weather-text-muted: #64748b;
    --weather-border: rgba(255, 255, 255, 0.4);
    --weather-border-subtle: rgba(255, 255, 255, 0.2);
    --weather-rain: #60a5fa;
    --weather-gradient-start: #e2e8f0;
    --weather-gradient-end: #cbd5e1;
}

/* Dark Theme - Coffee Browns */
[data-theme="dark"] {
    --primary-50: #1A1412;
    --primary-100: #2C1810;
    --primary-200: #4A2409;
    --primary-300: #6B3410;
    --primary-400: #8B4513;
    --primary-500: #D4A574;
    --primary-600: #E8D5B8;

    --success-light: rgba(16, 185, 129, 0.15);
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger-light: rgba(239, 68, 68, 0.15);
    --info-light: rgba(139, 90, 43, 0.15);

    --income-bg: rgba(16, 185, 129, 0.15);
    --expense-bg: rgba(239, 68, 68, 0.15);

    /* Category Colors - Dark Mode */
    --category-inventory-bg: rgba(59, 130, 246, 0.15);
    --category-inventory-hover: rgba(59, 130, 246, 0.25);
    --category-harvest-bg: rgba(245, 158, 11, 0.15);
    --category-harvest-hover: rgba(245, 158, 11, 0.25);
    --category-work-bg: rgba(139, 92, 246, 0.15);
    --category-work-hover: rgba(139, 92, 246, 0.25);
    --category-reports-bg: rgba(99, 102, 241, 0.15);
    --category-reports-hover: rgba(99, 102, 241, 0.25);

    --bg-base: #1A1412;
    --bg-surface: #2C1810;
    --bg-elevated: #3D2518;
    --bg-hover: #3D2518;
    --bg-active: #4A2409;
    --bg-sidebar: #2C1810;

    --text-primary: #F5E6D3;
    --text-secondary: #D4A574;
    --text-tertiary: #A67B4A;
    --text-disabled: #6B3410;

    --border-light: #3D2518;
    --border-default: #4A2409;
    --border-strong: #6B3410;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);

    /* Weather Widget Glassmorphism - Dark */
    --weather-glass-bg: rgba(30, 41, 59, 0.6);
    --weather-glass-bg-hover: rgba(30, 41, 59, 0.75);
    --weather-glass-bg-elevated: rgba(51, 65, 85, 0.7);
    --weather-text-primary: #f1f5f9;
    --weather-text-secondary: #cbd5e1;
    --weather-text-muted: #94a3b8;
    --weather-border: rgba(148, 163, 184, 0.3);
    --weather-border-subtle: rgba(148, 163, 184, 0.15);
    --weather-gradient-start: #1e293b;
    --weather-gradient-end: #0f172a;
}

/* Base Styles */
html {
    height: 100%;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    height: 100%;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--neutral-600);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-500);
}

/* Focus Visible States */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

#app {
    height: 100%;
}

/* Utility Classes */
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.desktop-only { display: none; }
.mobile-only { display: flex; }

@media (min-width: 768px) {
    .desktop-only { display: flex; }
    .mobile-only { display: none !important; }
}

/* =============================================
   LOGIN VIEW
   ============================================= */
#login-view {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
}

.login-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: var(--space-6);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-logo {
    margin-bottom: var(--space-4);
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
}

.logo-icon svg {
    width: 36px;
    height: 36px;
    color: white;
}

.logo-icon img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.login-header h1 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: 0.1em;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.input-group label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group label svg {
    width: 16px;
    height: 16px;
}

.input-group input {
    width: 100%;
    height: 48px;
    padding: 0 var(--space-4);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
}

.input-group input::placeholder {
    color: var(--text-tertiary);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

[data-theme="dark"] .input-group input:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.password-input {
    position: relative;
}

.password-input input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: color var(--transition-fast);
}

.toggle-password:hover {
    color: var(--text-secondary);
}

.toggle-password svg {
    width: 20px;
    height: 20px;
}

.error-message {
    padding: var(--space-3) var(--space-4);
    background: var(--danger-light);
    color: var(--danger);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    text-align: center;
}

.error-message:empty {
    display: none;
}

.success-message {
    padding: var(--space-3) var(--space-4);
    background: var(--success-light);
    color: var(--success);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    text-align: center;
}

.success-message:empty,
.success-message.hidden {
    display: none;
}

.auth-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.875rem;
}

.auth-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.auth-links a:hover {
    color: var(--primary-600);
    text-decoration: underline;
}

.auth-links .divider {
    color: var(--text-tertiary);
}

.input-hint {
    display: block;
    margin-top: var(--space-2);
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.login-footer {
    margin-top: var(--space-8);
    text-align: center;
}

.login-language-selector {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    padding: var(--space-2) var(--space-3);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
}

.login-language-selector svg {
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.7);
}

.login-language-selector .language-select {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    cursor: pointer;
    padding-right: var(--space-2);
}

.login-language-selector .language-select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.login-footer p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8125rem;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    height: 40px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg-hover);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-700);
    border-color: var(--primary-700);
}

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

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

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-hover);
}

.btn-sm {
    height: 32px;
    padding: 0 var(--space-3);
    font-size: 0.8125rem;
}

.btn-lg {
    height: 48px;
    padding: 0 var(--space-6);
    font-size: 0.9375rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.btn-icon.danger {
    color: var(--danger);
}

.btn-icon.danger:hover {
    background: var(--danger-light);
}

.btn-group {
    display: flex;
    gap: var(--space-2);
}

/* =============================================
   MAIN LAYOUT
   ============================================= */
#main-view {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sticky);
    transition: transform var(--transition-normal), width var(--transition-normal);
    transform: translateX(-100%);
}

@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0);
    }
}

.sidebar.mobile-open {
    transform: translateX(0);
}

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

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

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.brand-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.brand-icon img,
.brand-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.brand-text {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.05em;
}

/* Heading typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.stat-value,
.card-title,
.section-title {
    font-family: var(--font-heading);
}

.sidebar-toggle {
    display: none;
}

@media (min-width: 1024px) {
    .sidebar-toggle {
        display: flex;
    }
}

/* Collapsed sidebar state (desktop) */
@media (min-width: 1024px) {
    .sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar.collapsed .brand-text,
    .sidebar.collapsed .nav-section-title,
    .sidebar.collapsed .nav-item span {
        display: none;
    }

    .sidebar.collapsed .sidebar-header {
        justify-content: center;
        padding: var(--space-4) var(--space-2);
    }

    .sidebar.collapsed .brand {
        gap: 0;
        cursor: pointer;
    }

    .sidebar.collapsed .sidebar-toggle {
        display: none;
    }

    .sidebar.collapsed .nav-item {
        justify-content: center;
        padding: var(--space-3);
    }

    .sidebar.collapsed .nav-item svg {
        margin: 0;
    }

    .sidebar.collapsed ~ .main-wrapper {
        margin-left: var(--sidebar-collapsed-width);
    }
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4) var(--space-3);
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    display: block;
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    margin-bottom: var(--space-1);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-50);
    color: var(--primary-600);
}

[data-theme="dark"] .nav-item.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary-400);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sticky) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.sidebar-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: 0;
    transition: margin-left var(--transition-normal);
}

@media (min-width: 1024px) {
    .main-wrapper {
        margin-left: var(--sidebar-width);
    }
}

/* App Header */
.app-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--space-4);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    z-index: var(--z-sticky);
}

@media (min-width: 768px) {
    .app-header {
        padding: 0 var(--space-6);
    }
}

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

.breadcrumb {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* User Menu */
.user-menu-wrapper {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    background: none;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-menu-btn:hover {
    background: var(--bg-hover);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary-100);
    border-radius: var(--radius-full);
}

[data-theme="dark"] .user-avatar {
    background: rgba(16, 185, 129, 0.2);
}

.user-avatar svg {
    width: 20px;
    height: 20px;
    color: var(--primary-600);
}

.user-avatar.large {
    width: 48px;
    height: 48px;
}

.user-avatar.large svg {
    width: 24px;
    height: 24px;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: capitalize;
}

.user-menu-btn > svg:last-child {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-2);
    min-width: 200px;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
}

.dropdown-menu:not(.hidden) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: none;
    border: none;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

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

.dropdown-item.danger:hover {
    background: var(--danger-light);
}

.dropdown-item svg {
    width: 18px;
    height: 18px;
}

/* Language Selector in Dropdown */
.dropdown-item.language-selector,
.sheet-item.language-selector {
    cursor: default;
}

.dropdown-item.language-selector:hover,
.sheet-item.language-selector:hover {
    background: transparent;
}

.language-select {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 90px;
}

.language-select:focus {
    outline: none;
    border-color: var(--primary-500);
}

/* Quick Add Menu */
.quick-add-menu {
    right: auto;
    left: 0;
}

/* Role Badge */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-radius: var(--radius-full);
    background: var(--primary-100);
    color: var(--primary-700);
}

[data-theme="dark"] .role-badge {
    background: rgba(16, 185, 129, 0.2);
    color: var(--primary-400);
}

.role-badge.admin {
    background: var(--danger-light);
    color: var(--danger);
}

.role-badge.manager {
    background: var(--info-light);
    color: var(--info);
}

.role-badge.worker {
    background: var(--warning-light);
    color: var(--warning);
}

.role-badge.viewer {
    background: var(--bg-active);
    color: var(--text-secondary);
}

/* Main Content */
.content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    padding-bottom: calc(var(--mobile-nav-height) + var(--space-4) + var(--safe-bottom));
}

@media (min-width: 768px) {
    .content {
        padding: var(--space-6);
        padding-bottom: var(--space-6);
    }
}

@media (min-width: 1024px) {
    .content {
        padding: var(--space-8);
        padding-bottom: var(--space-8);
    }
}

/* Sections */
.section {
    display: none;
    max-width: var(--content-max-width);
    margin: 0 auto;
    animation: fadeIn 0.2s ease;
}

.section.active {
    display: block;
}

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

.section-intro {
    margin-bottom: var(--space-8);
}

.section-intro h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.025em;
}

.section-intro p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.section-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

@media (min-width: 640px) {
    .section-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.section-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.section-title p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.filter-inline {
    flex: 1;
    max-width: 200px;
}

/* =============================================
   STATS GRID
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

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

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

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-500);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stat-card:hover {
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.12), 0 4px 8px -4px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.stat-card:hover::before {
    opacity: 1;
}

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

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: var(--bg-hover);
    border-radius: var(--radius-lg);
}

.stat-icon svg,
.stat-icon i {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.stat-card.balance .stat-icon {
    background: var(--primary-100);
}

.stat-card.balance .stat-icon svg {
    color: var(--primary-600);
}

[data-theme="dark"] .stat-card.balance .stat-icon {
    background: rgba(16, 185, 129, 0.15);
}

.stat-card.income .stat-icon {
    background: var(--income-bg);
}

.stat-card.income .stat-icon svg {
    color: var(--income);
}

.stat-card.expense .stat-icon {
    background: var(--expense-bg);
}

.stat-card.expense .stat-icon svg {
    color: var(--expense);
}

.stat-card.harvests .stat-icon {
    background: var(--warning-light);
}

.stat-card.harvests .stat-icon svg {
    color: var(--warning);
}

/* Card-specific accent colors on hover */
.stat-card.balance::before { background: var(--primary-500); }
.stat-card.income::before { background: var(--income); }
.stat-card.expense::before { background: var(--expense); }
.stat-card.harvests::before { background: var(--warning); }

.stat-trend {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--success);
}

.stat-trend svg {
    width: 14px;
    height: 14px;
}

.stat-card-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--text-tertiary);
}

.stat-value {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.stat-card.income .stat-value {
    color: var(--income);
}

.stat-card.expense .stat-value {
    color: var(--expense);
}

/* =============================================
   QUICK ACTIONS GRID
   ============================================= */
.quick-actions-grid {
    margin-bottom: var(--space-8);
}

.quick-actions-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-4);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-3);
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xs);
}

.action-card:hover {
    border-color: var(--border-default);
    transform: translateY(-3px);
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1), 0 4px 8px -4px rgba(0, 0, 0, 0.06);
}

.action-card:active {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.action-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    background: var(--bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.action-icon svg {
    width: 22px;
    height: 22px;
    color: var(--primary-600);
}

/* Category-based icon colors */
.action-icon.inventory {
    background: var(--category-inventory-bg);
}
.action-icon.inventory svg { color: var(--category-inventory); }

.action-icon.harvest {
    background: var(--category-harvest-bg);
}
.action-icon.harvest svg { color: var(--category-harvest); }

.action-icon.income {
    background: var(--success-light);
}
.action-icon.income svg { color: var(--success); }

.action-icon.expense {
    background: var(--danger-light);
}
.action-icon.expense svg { color: var(--danger); }

.action-icon.work {
    background: var(--category-work-bg);
}
.action-icon.work svg { color: var(--category-work); }

.action-icon.reports {
    background: var(--category-reports-bg);
}
.action-icon.reports svg { color: var(--category-reports); }

/* Hover states - icons turn solid with white icon */
.action-card:hover .action-icon {
    background: var(--primary-500);
    transform: scale(1.05);
}
.action-card:hover .action-icon svg {
    color: white;
}
.action-card:hover .action-icon.inventory {
    background: var(--category-inventory);
}
.action-card:hover .action-icon.harvest {
    background: var(--category-harvest);
}
.action-card:hover .action-icon.income {
    background: var(--success);
}
.action-card:hover .action-icon.expense {
    background: var(--danger);
}
.action-card:hover .action-icon.work {
    background: var(--category-work);
}
.action-card:hover .action-icon.reports {
    background: var(--category-reports);
}

.action-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

@media (max-width: 640px) {
    .action-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .action-card {
        padding: var(--space-3) var(--space-2);
    }
    .action-icon {
        width: 40px;
        height: 40px;
    }
    .action-label {
        font-size: 0.6875rem;
    }
}

/* =============================================
   DASHBOARD ALERTS
   ============================================= */
.dashboard-alerts {
    margin-bottom: var(--space-6);
}

.alert-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}

.alert-card.warning {
    background: var(--warning-light);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.alert-card.danger {
    background: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-card.warning .alert-card-icon {
    background: rgba(245, 158, 11, 0.15);
}
.alert-card.warning .alert-card-icon svg {
    color: var(--warning);
}

.alert-card.danger .alert-card-icon {
    background: rgba(239, 68, 68, 0.15);
}
.alert-card.danger .alert-card-icon svg {
    color: var(--danger);
}

.alert-card-content {
    flex: 1;
}

.alert-card-content strong {
    display: block;
    font-size: 0.875rem;
    margin-bottom: var(--space-1);
}

.alert-card-content p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.alert-card-items {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    list-style: disc;
    padding-left: var(--space-4);
    margin: 0;
}

.alert-card-items li {
    margin-bottom: var(--space-1);
}

.alert-card .btn {
    flex-shrink: 0;
    align-self: center;
}

/* Low Stock Widget */
.low-stock-widget {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.low-stock-widget-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    color: var(--success);
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.low-stock-widget-empty svg {
    width: 20px;
    height: 20px;
}

.low-stock-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}

.low-stock-widget-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.low-stock-widget-title svg {
    width: 18px;
    height: 18px;
    color: var(--danger);
}

.low-stock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    background: var(--danger);
    border-radius: 10px;
}

.low-stock-widget-content {
    padding: 0.75rem;
}

.low-stock-section {
    margin-bottom: 0.75rem;
}

.low-stock-section:last-child {
    margin-bottom: 0;
}

.low-stock-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: var(--radius-md);
}

.low-stock-section.danger .low-stock-section-header {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.low-stock-section.warning .low-stock-section-header {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.low-stock-section-header svg {
    width: 14px;
    height: 14px;
}

.low-stock-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.low-stock-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.low-stock-item:hover {
    background: var(--bg-tertiary);
}

.low-stock-item-info {
    flex: 1;
    min-width: 0;
}

.low-stock-item-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.low-stock-item-location {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.low-stock-item-qty {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    flex-shrink: 0;
}

.low-stock-qty {
    font-size: 0.875rem;
    font-weight: 600;
}

.low-stock-qty.danger {
    color: var(--danger);
}

.low-stock-qty.warning {
    color: var(--warning);
}

.low-stock-threshold {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.low-stock-item .btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.low-stock-item .btn-icon svg {
    width: 14px;
    height: 14px;
}

.low-stock-widget-footer {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

@media (max-width: 768px) {
    .low-stock-widget-header {
        padding: 0.875rem 1rem;
    }

    .low-stock-item-name {
        font-size: 0.8125rem;
    }

    .low-stock-qty {
        font-size: 0.8125rem;
    }
}

/* =============================================
   DASHBOARD GRID
   ============================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    margin-top: var(--space-8);
}

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

/* =============================================
   CARDS
   ============================================= */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition-fast);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-surface);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-header h3 svg {
    width: 18px;
    height: 18px;
    color: var(--primary-500);
    opacity: 0.8;
}

.card-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--primary-600);
    text-decoration: none;
}

.card-link:hover {
    text-decoration: underline;
}

.card-toolbar {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-light);
}

@media (min-width: 768px) {
    .card-toolbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.card-body {
    padding: var(--space-4) var(--space-5);
}

/* =============================================
   FILTER GROUP
   ============================================= */
.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.filter-item label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
}

.filter-presets {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.chip {
    padding: var(--space-2) var(--space-3);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chip:hover {
    border-color: var(--primary-400);
    color: var(--primary-600);
}

.chip.active {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: white;
}

/* =============================================
   FORM INPUTS
   ============================================= */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    height: 40px;
    padding: 0 var(--space-3);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-textarea:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.form-textarea {
    height: auto;
    min-height: 100px;
    padding: var(--space-3);
    resize: vertical;
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

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

@media (min-width: 480px) {
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-light);
}

/* =============================================
   TABS
   ============================================= */
.tabs-container {
    margin-bottom: var(--space-4);
}

.tabs {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-1);
    background: var(--bg-hover);
    border-radius: var(--radius-lg);
    overflow-x: auto;
}

.tabs.scrollable {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs.scrollable::-webkit-scrollbar {
    display: none;
}

.tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

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

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

.tab svg {
    width: 16px;
    height: 16px;
}

.tab-content {
    animation: fadeIn 0.2s ease;
}

.tab-content.hidden {
    display: none;
}

/* =============================================
   DATA TABLES
   ============================================= */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    background: var(--bg-base);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Sortable table headers */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease, background 0.15s ease;
}

.data-table th.sortable:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.data-table th.sortable:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: -2px;
}

.data-table th.sortable.sorted {
    color: var(--primary-600);
}

[data-theme="dark"] .data-table th.sortable.sorted {
    color: var(--primary-400);
}

.data-table th .sort-indicator {
    display: inline-flex;
    align-items: center;
    margin-left: 0.25rem;
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.data-table th.sortable:hover .sort-indicator,
.data-table th.sortable.sorted .sort-indicator {
    opacity: 1;
}

.data-table th .sort-indicator i {
    width: 14px;
    height: 14px;
}

.data-table th:first-child {
    border-top-left-radius: var(--radius-md);
}

.data-table th:last-child {
    border-top-right-radius: var(--radius-md);
}

.data-table td {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Zebra striping for better readability */
.data-table tbody tr:nth-child(even) {
    background: var(--neutral-50);
}

[data-theme="dark"] .data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr {
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
    box-shadow: inset 3px 0 0 var(--primary-500);
}

.data-table .income {
    color: var(--income);
    font-weight: 500;
}

.data-table .expense {
    color: var(--expense);
    font-weight: 500;
}

.actions-col {
    width: 1%;
    white-space: nowrap;
}

.data-table .actions-col {
    text-align: right;
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-1);
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    text-transform: capitalize;
}

.status-badge.active {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.inactive {
    background: var(--bg-active);
    color: var(--text-tertiary);
}

/* Quality Badge */
.quality-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    text-transform: capitalize;
}

.quality-badge.excellent,
.quality-badge.good {
    background: var(--success-light);
    color: var(--success);
}

.quality-badge.average {
    background: var(--warning-light);
    color: var(--warning);
}

.quality-badge.poor {
    background: var(--danger-light);
    color: var(--danger);
}

/* Type Badge */
.type-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    text-transform: capitalize;
}

.type-badge.income {
    background: var(--income-bg);
    color: var(--income);
}

.type-badge.expense {
    background: var(--expense-bg);
    color: var(--expense);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
    text-align: center;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-disabled);
    margin-bottom: var(--space-3);
}

.empty-state p {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.empty-row td {
    padding: 0 !important;
    border: none !important;
}

.empty-row:hover {
    background: transparent !important;
}

/* =============================================
   REPORTS
   ============================================= */
.report-period {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.report-content {
    min-height: 200px;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.report-stat {
    padding: var(--space-4);
    background: var(--bg-base);
    border-radius: var(--radius-lg);
}

.report-stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: var(--space-1);
}

.report-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.report-stat-value.income {
    color: var(--income);
}

.report-stat-value.expense {
    color: var(--expense);
}

.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: var(--space-6);
}

.chart-container h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

@media (min-width: 768px) {
    .charts-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.category-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.category-bar {
    padding: var(--space-3);
    background: var(--bg-base);
    border-radius: var(--radius-md);
}

.category-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.category-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.category-amount {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.category-progress {
    height: 8px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.category-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.category-fill.income {
    background: var(--income);
}

.category-fill.expense {
    background: var(--expense);
}

/* =============================================
   MOBILE NAVIGATION
   ============================================= */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: var(--mobile-nav-height);
    padding-bottom: var(--safe-bottom);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-light);
    z-index: var(--z-sticky);
}

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

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    padding: var(--space-2);
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-tertiary);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--transition-fast);
}

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

.mobile-nav-item svg {
    width: 22px;
    height: 22px;
}

/* =============================================
   BOTTOM SHEET
   ============================================= */
.bottom-sheet {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.bottom-sheet:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.bottom-sheet-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: var(--bg-surface);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + var(--safe-bottom));
    transform: translateY(100%);
    transition: transform var(--transition-normal);
}

.bottom-sheet:not(.hidden) .bottom-sheet-content {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border-default);
    border-radius: var(--radius-full);
    margin: 0 auto var(--space-4);
}

.bottom-sheet-header {
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

.bottom-sheet-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.bottom-sheet-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.sheet-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: 0.9375rem;
    color: var(--text-primary);
    text-decoration: none;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    text-align: left;
    width: 100%;
}

.sheet-item:hover {
    background: var(--bg-hover);
}

.sheet-item svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.sheet-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-2) 0;
}

/* =============================================
   MODAL
   ============================================= */
.modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-card {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.modal:not(.hidden) .modal-card {
    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(--border-light);
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
}

.confirm-message {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: var(--z-toast);
    max-width: 400px;
}

@media (max-width: 480px) {
    .toast-container {
        left: var(--space-4);
        right: var(--space-4);
    }
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.show {
    animation: slideInRight 0.3s ease;
}

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

.toast span {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.toast-success svg { color: var(--success); }
.toast-error svg { color: var(--danger); }
.toast-warning svg { color: var(--warning); }
.toast-info svg { color: var(--info); }

/* =============================================
   LOADING OVERLAY
   ============================================= */
.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: calc(var(--z-toast) + 1);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.loading-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-6);
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-default);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-spinner span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* =============================================
   PAGINATION
   ============================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-4);
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--primary-500);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary-500);
    border-color: var(--primary-500);
    color: white;
}

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

.pagination-select {
    height: 36px;
    padding: 0 var(--space-3);
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
}

.pagination:empty {
    display: none;
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {
    .sidebar,
    .app-header,
    .mobile-nav,
    .modal,
    .toast-container,
    .loading-overlay {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .content {
        padding: 0 !important;
    }

    body {
        background: white;
        color: black;
    }
}

/* Coffee Price Widget - Glassmorphism */
.coffee-price-widget {
    background: linear-gradient(135deg, #475569 0%, #1e293b 100%);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    color: #f1f5f9;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 24px -4px rgba(30, 41, 59, 0.4),
        0 8px 16px -8px rgba(0, 0, 0, 0.2);
}

.coffee-price-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(71, 85, 105, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(241, 245, 249, 0.15);
    border-radius: inherit;
    z-index: 0;
}

.coffee-price-widget::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15);
    pointer-events: none;
    z-index: 2;
}

.coffee-price-widget > * {
    position: relative;
    z-index: 1;
}

[data-theme="dark"] .coffee-price-widget {
    background: linear-gradient(135deg, #334155 0%, #0f172a 100%);
    box-shadow:
        0 4px 24px -4px rgba(0, 0, 0, 0.5),
        0 8px 16px -8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .coffee-price-widget::before {
    background: rgba(51, 65, 85, 0.6);
    border-color: rgba(148, 163, 184, 0.15);
}

[data-theme="dark"] .coffee-price-widget::after {
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.coffee-price-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    color: #cbd5e1;
}

.coffee-price-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(241, 245, 249, 0.3);
    border-top-color: #f1f5f9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.coffee-price-unconfigured {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    color: #cbd5e1;
}

.coffee-price-unconfigured svg {
    width: 20px;
    height: 20px;
    color: #94a3b8;
}

.coffee-price-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.coffee-price-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.coffee-price-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(241, 245, 249, 0.15);
    border-radius: var(--radius-lg);
    transition: transform var(--transition-normal);
}

.coffee-price-widget:hover .coffee-price-icon {
    transform: scale(1.05);
}

.coffee-price-icon svg {
    width: 24px;
    height: 24px;
    color: #e2e8f0;
}

.coffee-price-title-container {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.coffee-price-title {
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
}

.coffee-price-subtitle {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.coffee-price-sources {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.coffee-price-source-card {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.875rem;
    background: rgba(241, 245, 249, 0.08);
    border-radius: var(--radius-md);
    border: 1px solid rgba(241, 245, 249, 0.12);
    transition: all var(--transition-fast);
}

.coffee-price-source-card:hover {
    background: rgba(241, 245, 249, 0.12);
    border-color: rgba(241, 245, 249, 0.2);
}

.coffee-price-source-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.coffee-price-source-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: -0.02em;
}

.coffee-price-source-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #cbd5e1;
}

.coffee-price-source-change svg {
    width: 12px;
    height: 12px;
}

.coffee-price-source-change.up {
    color: #86efac;
}

.coffee-price-source-change.down {
    color: #fca5a5;
}

.coffee-price-source-date {
    font-size: 0.625rem;
    color: rgba(241, 245, 249, 0.5);
}

.coffee-price-footer {
    display: flex;
    justify-content: flex-end;
    font-size: 0.625rem;
    color: rgba(241, 245, 249, 0.4);
}

/* Clickable source card (for charts) */
.coffee-price-source-card.clickable {
    cursor: pointer;
}

.coffee-price-source-card.clickable:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.coffee-price-source-label {
    display: inline-flex;
    align-items: center;
}

/* Coffee price history modal */
.coffee-price-history-modal {
    min-width: 400px;
}

.coffee-price-history-modal .modal-section-header {
    margin-bottom: 1rem;
}

.coffee-price-history-modal h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.125rem;
}

.coffee-price-history-modal .text-muted {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.chart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-muted);
}

.chart-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    color: var(--text-muted);
}

.chart-error svg {
    width: 20px;
    height: 20px;
    color: var(--danger);
}

/* Coffee price stats grid */
.coffee-price-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.coffee-price-stats .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.coffee-price-stats .stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
}

.coffee-price-stats .stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.coffee-price-stats .stat-value.positive {
    color: var(--success);
}

.coffee-price-stats .stat-value.negative {
    color: var(--danger);
}

@media (max-width: 768px) {
    .coffee-price-history-modal {
        min-width: unset;
    }

    .coffee-price-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .coffee-price-widget {
        padding: 1rem 1.25rem;
        border-radius: var(--radius-lg);
    }

    .coffee-price-sources {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .coffee-price-source-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem;
    }

    .coffee-price-source-label {
        flex: 1;
    }

    .coffee-price-source-price {
        font-size: 1.125rem;
    }

    .coffee-price-source-change {
        margin-left: 0.5rem;
    }

    .coffee-price-source-date {
        display: none;
    }
}

/* Weather Widget - Glassmorphism */
.weather-widget {
    background: linear-gradient(135deg, var(--weather-gradient-start) 0%, var(--weather-gradient-end) 100%);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    color: var(--weather-text-primary);
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 24px -4px rgba(0, 0, 0, 0.12),
        0 8px 16px -8px rgba(0, 0, 0, 0.08);
}

.weather-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--weather-glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--weather-border);
    border-radius: inherit;
    z-index: 0;
}

.weather-widget::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4);
    pointer-events: none;
    z-index: 2;
}

.weather-widget > * {
    position: relative;
    z-index: 1;
}

[data-theme="dark"] .weather-widget {
    box-shadow:
        0 4px 24px -4px rgba(0, 0, 0, 0.4),
        0 8px 16px -8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .weather-widget::after {
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.weather-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    color: var(--weather-text-secondary);
}

.weather-loading .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--weather-border-subtle);
    border-top-color: var(--weather-text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.weather-unconfigured {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    color: var(--weather-text-secondary);
}

.weather-unconfigured svg {
    width: 24px;
    height: 24px;
    color: var(--weather-text-muted);
}

.weather-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.weather-icon {
    width: 72px;
    height: 72px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    transition: transform var(--transition-normal);
}

.weather-widget:hover .weather-icon {
    transform: scale(1.05);
}

.weather-temp {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    color: var(--weather-text-primary);
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.weather-desc {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--weather-text-secondary);
    text-transform: capitalize;
    margin-top: 0.25rem;
}

.weather-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.weather-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--weather-text-secondary);
    background: var(--weather-glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    border: 1px solid var(--weather-border-subtle);
    transition: all var(--transition-fast);
}

.weather-detail:hover {
    background: var(--weather-glass-bg-hover);
    border-color: var(--weather-border);
}

.weather-detail svg {
    width: 16px;
    height: 16px;
    color: var(--weather-text-muted);
}

.weather-alerts {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--weather-border-subtle);
}

.weather-alert {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    background: var(--weather-glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
}

.weather-alert:last-child {
    margin-bottom: 0;
}

.weather-alert svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.weather-alert.warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #b45309;
}

[data-theme="dark"] .weather-alert.warning {
    color: #fbbf24;
}

.weather-alert.severe {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #b91c1c;
}

[data-theme="dark"] .weather-alert.severe {
    color: #f87171;
}

.weather-alert.watch {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #1d4ed8;
}

[data-theme="dark"] .weather-alert.watch {
    color: #60a5fa;
}

@media (max-width: 768px) {
    .weather-widget {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
    }

    .weather-current {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .weather-temp {
        font-size: 2.5rem;
    }

    .weather-icon {
        width: 56px;
        height: 56px;
    }

    .weather-details {
        width: 100%;
        justify-content: flex-start;
    }

    .weather-detail {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: slideUp 0.3s ease;
}

.offline-indicator.hidden {
    display: none;
}

.offline-indicator svg {
    width: 18px;
    height: 18px;
}

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

/* Mobile Touch Improvements */
@media (max-width: 768px) {
    /* Ensure touch-friendly button sizes */
    .btn,
    .btn-icon,
    button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger tap targets for table actions */
    .table-actions .btn-icon {
        width: 44px;
        height: 44px;
    }

    /* Better spacing for mobile nav */
    .nav-item {
        min-height: 48px;
    }

    /* Larger form inputs on mobile */
    .form-input,
    .form-select,
    .form-textarea {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    /* Better card padding on mobile */
    .card-body {
        padding: 1rem;
    }

    /* Stack card toolbar on mobile */
    .card-toolbar {
        flex-direction: column;
        gap: 1rem;
    }

    .filter-group {
        flex-wrap: wrap;
    }

    .filter-item {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 120px;
    }
}

/* Pull to Refresh indicator (for future use) */
.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: var(--bg-surface);
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    transition: transform 0.3s ease;
    z-index: 9998;
}

.pull-refresh-indicator.visible {
    transform: translateX(-50%) translateY(0);
}

.pull-refresh-indicator .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-primary);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==========================================
   TASKS MODULE STYLES
   ========================================== */

/* Filter Card */
.filter-card {
    padding: var(--space-4);
    margin-bottom: var(--space-5);
}

.filter-card .filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.filter-card .filter-item {
    flex: 1;
    min-width: 150px;
}

.filter-card .filter-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Tasks Stats Grid */
.tasks-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

@media (max-width: 768px) {
    .tasks-stats {
        grid-template-columns: 1fr;
    }
}

/* Task Stat Card Color Variants */
.stat-card.scheduled .stat-icon {
    background: var(--primary-100);
}

.stat-card.scheduled .stat-icon svg {
    color: var(--primary-600);
}

.stat-card.in-progress .stat-icon {
    background: var(--warning-light);
}

.stat-card.in-progress .stat-icon svg {
    color: var(--warning);
}

.stat-card.completed .stat-icon {
    background: var(--success-light);
}

.stat-card.completed .stat-icon svg {
    color: var(--success);
}

/* Task status badges */
.status-badge.info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-500);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary-500);
}

.status-badge.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-icon.success {
    color: var(--secondary-500);
}

.btn-icon.success:hover {
    background: rgba(16, 185, 129, 0.1);
}

/* Workers panel in modal */
.workers-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.workers-panel h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.workers-panel .worker-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.workers-panel .worker-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.workers-panel .empty-text {
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.workers-panel .add-worker-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.workers-panel .add-worker-form .form-input {
    flex: 1;
}

/* Detail view in modals */
.detail-view {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-secondary);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    min-width: 100px;
    font-size: 0.813rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    flex: 1;
    color: var(--text-primary);
}

.detail-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-primary);
}

.detail-section h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.detail-section .worker-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.detail-section .worker-list li {
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

/* ==========================================
   ANALYTICS MODULE STYLES - Modern Dashboard
   ========================================== */

/* Hero KPI Strip */
.analytics-kpi-strip {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
}

.kpi-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    position: relative;
    min-width: 0;
}

.kpi-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}

.kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.kpi-change {
    font-size: 0.75rem;
    font-weight: 600;
}

.kpi-change.positive { color: var(--secondary-500); }
.kpi-change.negative { color: #ef4444; }

.kpi-sparkline {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    width: 48px;
    height: 20px;
    opacity: 0.7;
}

.kpi-period-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-secondary);
    flex-shrink: 0;
}

.kpi-period-selector input[type="date"] {
    padding: 0.375rem 0.5rem;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.75rem;
    width: 120px;
}

.kpi-period-selector span {
    color: var(--text-tertiary);
    font-size: 0.75rem;
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Analytics Card Base */
.analytics-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.analytics-card.full-width {
    grid-column: span 2;
}

.analytics-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-secondary);
}

.analytics-card .card-header h3 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-header-stat {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.card-header-stat .stat-label {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
}

.card-header-stat .stat-value {
    font-size: 0.9375rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.card-header-stat .stat-value.positive { color: var(--secondary-500); }
.card-header-stat .stat-value.negative { color: #ef4444; }

.analytics-card .card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Compact Chart Containers */
.chart-container-sm {
    height: 100px;
    margin-bottom: 0.75rem;
}

.chart-container-md {
    height: 140px;
    flex: 1;
}

.analytics-card canvas {
    max-height: 100%;
}

/* Financial Metrics */
.financial-metrics {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
}

.metric-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-row .metric-label {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.metric-row .metric-value {
    font-size: 1rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.metric-row .metric-value.income { color: var(--secondary-500); }
.metric-row .metric-value.expense { color: #ef4444; }

/* Production Summary */
.production-summary {
    display: flex;
    gap: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-secondary);
}

.production-stat {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.production-stat .stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.production-stat .stat-unit {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ROI List */
.roi-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.roi-item {
    display: grid;
    grid-template-columns: 1fr 100px 60px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.roi-item:not(:last-child) {
    border-bottom: 1px solid var(--border-secondary);
}

.roi-area {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.roi-bar-container {
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
}

.roi-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.roi-bar.positive { background: var(--secondary-500); }
.roi-bar.negative { background: #ef4444; }

.roi-value {
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.roi-value.positive { color: var(--secondary-500); }
.roi-value.negative { color: #ef4444; }

/* Cost Breakdown */
.cost-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cost-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.cost-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.cost-percent {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.cost-bar {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
}

.cost-bar-fill {
    height: 100%;
    background: var(--info);
    border-radius: 2px;
}

/* Trends Controls */
.trends-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.trends-metric-tabs {
    display: flex;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.trends-metric-tabs .tab {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    cursor: pointer;
    transition: all 0.15s ease;
}

.trends-metric-tabs .tab:hover {
    color: var(--text-primary);
}

.trends-metric-tabs .tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.select-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

/* Empty State */
.analytics-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-tertiary);
    font-size: 0.8125rem;
}

/* Analytics responsive */
@media (max-width: 1024px) {
    .analytics-kpi-strip {
        flex-wrap: wrap;
    }

    .kpi-item {
        flex-basis: calc(50% - 0.5rem);
    }

    .kpi-period-selector {
        flex-basis: 100%;
        border-left: none;
        border-top: 1px solid var(--border-secondary);
        padding-left: 0;
        padding-top: 0.75rem;
        justify-content: center;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .analytics-card.full-width {
        grid-column: span 1;
    }
}

@media (max-width: 640px) {
    .tasks-stats {
        grid-template-columns: 1fr;
    }

    .kpi-item {
        flex-basis: 100%;
    }

    .financial-metrics {
        flex-direction: column;
        gap: 0.5rem;
    }

    .production-summary {
        flex-direction: column;
        gap: 0.5rem;
    }

    .roi-item {
        grid-template-columns: 1fr 80px 50px;
    }

    .trends-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ==========================================
   ALERTS MODULE STYLES
   ========================================== */

.alerts-wrapper {
    position: relative;
}

.alerts-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    position: relative;
    transition: all 0.2s ease;
}

.alerts-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

.alerts-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: white;
    font-size: 0.688rem;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alerts-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 480px;
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-secondary);
}

.alerts-header h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-500);
    font-size: 0.813rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

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

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

.alerts-list {
    flex: 1;
    overflow-y: auto;
    max-height: 360px;
}

.alerts-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-secondary);
    transition: background 0.15s ease;
}

.alert-item:last-child {
    border-bottom: none;
}

.alert-item:hover {
    background: var(--bg-secondary);
}

.alert-item.unread {
    background: rgba(59, 130, 246, 0.05);
}

.alert-item.unread:hover {
    background: rgba(59, 130, 246, 0.08);
}

.alert-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    flex-shrink: 0;
}

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

.alert-item.warning .alert-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.alert-item.danger .alert-icon,
.alert-item.critical .alert-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.alert-content {
    flex: 1;
    min-width: 0;
}

.alert-message {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0 0 0.25rem 0;
}

.alert-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.alert-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.alert-item:hover .alert-actions {
    opacity: 1;
}

.alerts-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-secondary);
    display: flex;
    justify-content: center;
}

/* Alert settings modal */
.alert-settings {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-section h4 {
    font-size: 0.938rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.settings-desc {
    font-size: 0.813rem;
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
}

.threshold-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.threshold-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.threshold-item span:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

.threshold-value {
    font-size: 0.813rem;
    color: var(--text-secondary);
    margin: 0 auto 0 1rem;
}

.empty-text {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    padding: 1rem;
    text-align: center;
}

/* Alerts responsive */
@media (max-width: 480px) {
    .alerts-dropdown {
        position: fixed;
        top: 60px;
        left: 1rem;
        right: 1rem;
        width: auto;
        max-height: calc(100vh - 80px);
        z-index: 1001;
    }
}

/* ==========================================
   WEATHER FORECAST STYLES - Glassmorphism
   ========================================== */

.weather-forecast {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--weather-border-subtle);
}

.forecast-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--weather-text-muted);
    margin-bottom: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.forecast-days {
    display: flex;
    gap: 0.625rem;
}

.forecast-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.875rem 0.5rem;
    background: var(--weather-glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--weather-border-subtle);
    transition: all var(--transition-normal);
    cursor: default;
}

.forecast-day:hover {
    background: var(--weather-glass-bg-hover);
    border-color: var(--weather-border);
    transform: translateY(-2px);
    box-shadow:
        0 8px 24px -8px rgba(0, 0, 0, 0.15),
        0 4px 8px -4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .forecast-day:hover {
    box-shadow:
        0 8px 24px -8px rgba(0, 0, 0, 0.4),
        0 4px 8px -4px rgba(0, 0, 0, 0.3);
}

.forecast-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--weather-text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}

.forecast-icon {
    width: 44px;
    height: 44px;
    margin: 0.375rem 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    transition: transform var(--transition-fast);
}

.forecast-day:hover .forecast-icon {
    transform: scale(1.1);
}

.forecast-temps {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    font-size: 0.875rem;
    margin-bottom: 0.375rem;
}

.temp-high {
    font-size: 1rem;
    font-weight: 700;
    color: var(--weather-text-primary);
}

.temp-low {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--weather-text-muted);
}

.forecast-rain {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--weather-rain);
    margin-top: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: rgba(96, 165, 250, 0.15);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.forecast-day:hover .forecast-rain {
    background: rgba(96, 165, 250, 0.25);
}

.forecast-rain svg {
    width: 10px;
    height: 10px;
    opacity: 0.9;
}

/* Weather Widget Animations */
@keyframes weatherFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.weather-widget {
    animation: weatherFadeIn 0.4s ease-out;
}

.forecast-day {
    animation: weatherFadeIn 0.3s ease-out both;
}

.forecast-day:nth-child(1) { animation-delay: 0.05s; }
.forecast-day:nth-child(2) { animation-delay: 0.1s; }
.forecast-day:nth-child(3) { animation-delay: 0.15s; }
.forecast-day:nth-child(4) { animation-delay: 0.2s; }
.forecast-day:nth-child(5) { animation-delay: 0.25s; }

/* Browser Fallback for backdrop-filter */
@supports not (backdrop-filter: blur(16px)) {
    .weather-widget::before {
        background: rgba(226, 232, 240, 0.95);
    }

    [data-theme="dark"] .weather-widget::before {
        background: rgba(30, 41, 59, 0.95);
    }

    .forecast-day,
    .weather-detail {
        background: rgba(226, 232, 240, 0.9);
    }

    [data-theme="dark"] .forecast-day,
    [data-theme="dark"] .weather-detail {
        background: rgba(30, 41, 59, 0.9);
    }
}

@media (max-width: 640px) {
    .forecast-days {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0.5rem;
        margin: 0 -0.5rem;
        padding: 0 0.5rem 0.5rem;
    }

    .forecast-days::-webkit-scrollbar {
        display: none;
    }

    .forecast-day {
        min-width: 72px;
        flex: 0 0 auto;
        padding: 0.75rem 0.375rem;
    }

    .forecast-icon {
        width: 36px;
        height: 36px;
    }

    .forecast-temps {
        font-size: 0.8125rem;
        flex-direction: column;
        gap: 0.125rem;
    }

    .temp-high {
        font-size: 0.875rem;
    }

    .temp-low {
        font-size: 0.75rem;
    }
}

/* ==========================================
   DRYING OVERVIEW STYLES
   ========================================== */

.drying-overview {
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.drying-header {
    margin-bottom: 1rem;
}

.drying-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.drying-header h3 svg {
    width: 18px;
    height: 18px;
    color: #f59e0b;
}

.drying-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.drying-stat {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.drying-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.drying-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.drying-patios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.patio-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
    padding: 1rem;
    transition: all 0.2s ease;
}

.patio-card.active {
    border-color: var(--primary-300);
    background: rgba(59, 130, 246, 0.03);
}

.patio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.patio-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.patio-fill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
}

.patio-fill.low {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary-500);
}

.patio-fill.medium {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.patio-fill.high {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.patio-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.patio-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.patio-bar-fill.low {
    background: var(--secondary-500);
}

.patio-bar-fill.medium {
    background: #f59e0b;
}

.patio-bar-fill.high {
    background: #ef4444;
}

.patio-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.patio-lots {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.lot-tag {
    font-size: 0.688rem;
    padding: 0.125rem 0.375rem;
    background: var(--primary-100);
    color: var(--primary-700);
    border-radius: var(--radius-sm);
}

.lot-more {
    font-size: 0.688rem;
    color: var(--text-tertiary);
}

@media (max-width: 768px) {
    .drying-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .drying-stats {
        grid-template-columns: 1fr 1fr;
    }

    .drying-patios-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================== */
/* Organization List          */
/* ========================== */
.org-list-section {
    margin-bottom: 2rem;
}

.org-list-section .section-actions {
    margin-bottom: 1rem;
}

#organizations-table code {
    background: var(--neutral-100);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

[data-theme="dark"] #organizations-table code {
    background: var(--neutral-800);
}

#organizations-table tr.selected {
    background: var(--primary-50);
}

[data-theme="dark"] #organizations-table tr.selected {
    background: var(--primary-900);
}

/* Organization Switcher */
.org-switcher-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.org-switcher-select {
    flex: 1;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    max-width: 140px;
}

.org-switcher-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 2px var(--primary-100);
}

[data-theme="dark"] .org-switcher-select:focus {
    box-shadow: 0 0 0 2px var(--primary-900);
}

/* Organization Assignments */
.org-assignments-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.org-assignment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.org-assignment-item .org-name {
    flex: 1;
    font-weight: 500;
}

.org-assignment-item .btn-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.empty-hint {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    padding: 1rem;
    text-align: center;
}

.loading-state,
.error-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.error-state {
    color: var(--danger);
}

.mt-2 {
    margin-top: 0.5rem;
}

/* ========================== */
/* Organization Settings      */
/* ========================== */
.org-settings-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

.org-settings-card .card-header,
.org-members-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.org-settings-card .card-header h3,
.org-members-card .card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.org-settings-card .card-header h3 i,
.org-members-card .card-header h3 i {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--primary-600);
}

.org-settings-card .card-body,
.org-members-card .card-body {
    padding: 1.25rem;
}

.form-hint {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin: 0.5rem 0 1rem;
}

.form-hint i {
    width: 0.875rem;
    height: 0.875rem;
}

/* Password strength indicator */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 0.5rem;
}

.password-strength-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.2s ease;
}

.password-strength.weak .password-strength-bar:nth-child(1) {
    background: var(--danger);
}

.password-strength.fair .password-strength-bar:nth-child(-n+2) {
    background: var(--warning);
}

.password-strength.good .password-strength-bar:nth-child(-n+3) {
    background: var(--success);
}

.password-strength.strong .password-strength-bar {
    background: var(--success);
}

.password-strength-text {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.role-badge.role-admin {
    background: var(--danger-100);
    color: var(--danger-700);
}

.role-badge.role-manager {
    background: var(--warning-100);
    color: var(--warning-700);
}

.role-badge.role-worker {
    background: var(--primary-100);
    color: var(--primary-700);
}

.role-badge.role-viewer {
    background: var(--neutral-100);
    color: var(--neutral-700);
}

@media (max-width: 1024px) {
    .org-settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .org-settings-card .card-header,
    .org-members-card .card-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
}

/* ========================== */
/* Checkpoints & Backups      */
/* ========================== */
.recovery-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.recovery-checkpoints-card .card-header,
.recovery-backups-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.recovery-checkpoints-card .card-header h3,
.recovery-backups-card .card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.recovery-checkpoints-card .card-header h3 i,
.recovery-backups-card .card-header h3 i {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--primary-600);
}

.form-select-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-width: 140px;
}

.action-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.action-badge.action-create {
    background: var(--success-100);
    color: var(--success-700);
}

.action-badge.action-update {
    background: var(--primary-100);
    color: var(--primary-700);
}

.action-badge.action-delete {
    background: var(--danger-100);
    color: var(--danger-700);
}

.entity-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--neutral-100);
    color: var(--neutral-700);
    text-transform: capitalize;
}

.btn-icon.warning {
    color: var(--warning-600);
}

.btn-icon.warning:hover {
    background: var(--warning-100);
    color: var(--warning-700);
}

.btn-warning {
    background: var(--warning-600);
    color: white;
}

.btn-warning:hover {
    background: var(--warning-700);
}

.truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Checkpoint Detail Modal */
.checkpoint-detail {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.checkpoint-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: var(--neutral-50);
    border-radius: var(--radius-md);
}

.checkpoint-info .info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkpoint-info .label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
}

.checkpoint-states {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.state-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.state-panel h4 {
    margin: 0;
    padding: 0.75rem 1rem;
    background: var(--neutral-100);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.checkpoint-json {
    margin: 0;
    padding: 1rem;
    font-size: 0.75rem;
    background: var(--neutral-50);
    max-height: 200px;
    overflow: auto;
}

.text-muted {
    color: var(--text-tertiary);
    font-style: italic;
    padding: 1rem;
}

@media (max-width: 1024px) {
    .recovery-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .recovery-checkpoints-card .card-header,
    .recovery-backups-card .card-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .checkpoint-states {
        grid-template-columns: 1fr;
    }
}

/* ========================== */
/* Billing & Subscription     */
/* ========================== */
.billing-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

.billing-current-card .card-header,
.billing-plans-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.billing-current-card .card-header h3,
.billing-plans-card .card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.billing-current-card .card-header h3 i,
.billing-plans-card .card-header h3 i {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--primary-600);
}

.current-plan-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.plan-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.plan-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.plan-status-success {
    background: var(--success-100);
    color: var(--success-700);
}

.plan-status-warning {
    background: var(--warning-100);
    color: var(--warning-700);
}

.plan-status-danger {
    background: var(--danger-100);
    color: var(--danger-700);
}

.plan-status-neutral {
    background: var(--neutral-100);
    color: var(--neutral-700);
}

.plan-period {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.plan-period strong {
    color: var(--text-primary);
}

.feature-usage h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.75rem;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feature-item {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.feature-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.813rem;
}

.feature-name {
    color: var(--text-primary);
}

.feature-count {
    color: var(--text-secondary);
    font-weight: 500;
}

.feature-bar {
    height: 4px;
    background: var(--neutral-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.feature-bar-fill {
    height: 100%;
    background: var(--primary-500);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.feature-bar-fill.warning {
    background: var(--warning-500);
}

.feature-bar-fill.danger {
    background: var(--danger-500);
}

.billing-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Plans Grid */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.plan-card:hover {
    border-color: var(--primary-300);
}

.plan-card.current {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

.plan-card.popular {
    border-color: var(--warning-400);
}

.plan-badge {
    position: absolute;
    top: -12px;
    right: 16px;
    padding: 0.25rem 0.75rem;
    background: var(--warning-500);
    color: white;
    font-size: 0.688rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.plan-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.plan-title {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.plan-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
}

.price-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.price-period {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.plan-features {
    flex: 1;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.plan-features li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.plan-features li i {
    width: 1rem;
    height: 1rem;
    color: var(--success-600);
    flex-shrink: 0;
}

.plan-action {
    margin-top: auto;
}

.plan-action .btn {
    width: 100%;
}

@media (max-width: 1024px) {
    .billing-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .plans-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================== */
/* Loading & Skeleton States  */
/* ========================== */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--neutral-200) 25%,
        var(--neutral-100) 50%,
        var(--neutral-200) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
    width: 60%;
    margin-bottom: 0;
}

.skeleton-row {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.skeleton-cell {
    height: 1rem;
    flex: 1;
}

.skeleton-cell:first-child {
    flex: 0 0 20%;
}

.skeleton-cell:last-child {
    flex: 0 0 80px;
}

.skeleton-card {
    padding: 1.5rem;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.skeleton-title {
    height: 1.5rem;
    width: 40%;
    margin-bottom: 1rem;
}

.skeleton-metric {
    height: 2.5rem;
    width: 60%;
}

/* Loading spinner for buttons */
.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Table loading state */
.table-loading tbody {
    position: relative;
}

.table-loading tbody::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Empty state improvements */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-state i {
    width: 3rem;
    height: 3rem;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.938rem;
    margin-bottom: 0.5rem;
}

.empty-state .empty-hint {
    color: var(--text-tertiary);
    font-size: 0.813rem;
}

.empty-state .btn {
    margin-top: 1rem;
}

/* Data loading indicator */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    color: var(--text-secondary);
}

.loading-indicator::before {
    content: '';
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Inline loading for refreshing data */
.refreshing {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.refreshing::after {
    content: '';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================== */
/* Form Validation & Errors   */
/* ========================== */
.form-group.has-error .form-input,
.form-group.has-error .form-select {
    border-color: var(--danger-500);
    background-color: var(--danger-light);
}

.form-group.has-error .form-input:focus,
.form-group.has-error .form-select:focus {
    border-color: var(--danger-500);
    box-shadow: 0 0 0 3px var(--danger-light);
}

.form-group.has-error label {
    color: var(--danger-600);
}

.field-error {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--danger-600);
}

.field-error i {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
}

.form-group.has-success .form-input,
.form-group.has-success .form-select {
    border-color: var(--success-500);
}

.form-group.has-success .form-input:focus,
.form-group.has-success .form-select:focus {
    border-color: var(--success-500);
    box-shadow: 0 0 0 3px var(--success-light);
}

/* Error banner for API errors */
.error-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--danger-100);
    border: 1px solid var(--danger-500);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.error-banner i {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--danger-600);
    flex-shrink: 0;
}

.error-banner-content {
    flex: 1;
}

.error-banner-title {
    font-weight: 600;
    color: var(--danger-700);
    margin-bottom: 0.25rem;
}

.error-banner-message {
    font-size: 0.875rem;
    color: var(--danger-600);
}

.error-banner-dismiss {
    padding: 0.25rem;
    background: none;
    border: none;
    color: var(--danger-500);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.error-banner-dismiss:hover {
    background: var(--danger-200);
}

/* Retry button in error states */
.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.retry-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary-500);
    color: var(--primary-600);
}

.retry-btn i {
    width: 1rem;
    height: 1rem;
}

/* Warning/Info banners */
.warning-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--warning-100);
    border: 1px solid var(--warning-400);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.warning-banner i {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--warning-600);
    flex-shrink: 0;
}

.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--info-light);
    border: 1px solid var(--info);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.info-banner i {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--info);
    flex-shrink: 0;
}

/* ==========================================================================
   RESPONSIVE & MOBILE POLISH
   ========================================================================== */

/* Touch-friendly targets - minimum 44px */
@media (max-width: 768px) {
    /* Ensure touch targets meet 44px minimum */
    .btn,
    button,
    [role="button"],
    .tab-btn,
    .nav-link {
        min-height: 44px;
        min-width: 44px;
    }

    /* Increase form input touch targets */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="tel"],
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* Larger checkbox/radio for touch */
    input[type="checkbox"],
    input[type="radio"] {
        width: 22px;
        height: 22px;
    }
}

/* Small mobile (320px-480px) */
@media (max-width: 480px) {
    :root {
        --spacing-section: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    /* Stack form groups */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-row > .form-group {
        width: 100%;
    }

    /* Full-width buttons */
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Reduce table padding */
    .data-table th,
    .data-table td {
        padding: 0.5rem;
        font-size: 0.813rem;
    }

    /* Hide less important columns */
    .data-table .hide-mobile {
        display: none;
    }

    /* Cards stack full-width */
    .cards-grid,
    .stat-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Reduce card padding */
    .card {
        padding: 1rem;
    }

    /* Smaller headings */
    h1 {
        font-size: 1.5rem;
    }

    h2, .section-title {
        font-size: 1.25rem;
    }

    /* Stack header actions */
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .section-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Button groups wrap on mobile */
    .btn-group {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .btn-group .btn {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
    }

    /* Allow text wrapping in buttons on mobile */
    .section-header .btn,
    .btn-group .btn {
        white-space: normal;
        text-align: center;
        padding: 0.75rem 1rem;
    }

    /* Empty state text - allow wrapping */
    .empty-state p,
    .empty-message,
    [class*="no-data"],
    .data-table td:only-child {
        white-space: normal !important;
        word-break: break-word;
        text-align: center;
    }

    /* Table mobile improvements */
    .data-table th,
    .data-table td {
        white-space: normal;
        word-break: break-word;
    }

    .data-table .actions-col {
        min-width: 60px;
    }

    /* Compact column headers on mobile */
    .data-table th {
        font-size: 0.5625rem;
        padding: 0.375rem 0.25rem;
        letter-spacing: 0.02em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 70px;
    }

    .data-table td {
        padding: 0.375rem 0.25rem;
        font-size: 0.75rem;
    }

    /* Allow table horizontal scroll on mobile */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tabs scroll horizontally */
    .tab-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
    }

    .tab-nav {
        min-width: max-content;
    }

    .tab-btn {
        white-space: nowrap;
        padding: 0.75rem 1rem;
    }
}

/* Standard mobile (481px-767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet (768px-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Sidebar collapses to icons */
    .sidebar.collapsed {
        width: 64px;
    }

    .sidebar.collapsed .nav-label,
    .sidebar.collapsed .sidebar-header h2 {
        display: none;
    }
}

/* Full-screen modals on mobile */
@media (max-width: 640px) {
    .modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        margin: 0;
    }

    .modal-header {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg-surface);
        border-radius: 0;
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
    }

    .modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--bg-surface);
        border-top: 1px solid var(--border);
        padding: 1rem;
    }

    .modal-footer .btn {
        flex: 1;
    }
}

/* Swipe-friendly navigation hint */
.swipe-hint {
    display: none;
}

@media (max-width: 768px) {
    .swipe-hint {
        display: block;
        text-align: center;
        color: var(--text-muted);
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

/* Mobile bottom navigation */
.mobile-nav {
    display: none;
}

@media (max-width: 768px) {
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-surface);
        border-top: 1px solid var(--border);
        padding: 0.5rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
        z-index: 100;
        gap: 0.25rem;
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        padding: 0.5rem;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.625rem;
        border-radius: var(--radius-md);
        transition: all 0.2s ease;
    }

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

    .mobile-nav-item i {
        width: 1.25rem;
        height: 1.25rem;
    }

    /* Add padding to main content for bottom nav */
    .main-content {
        padding-bottom: calc(4rem + env(safe-area-inset-bottom));
    }

    /* Hide desktop sidebar */
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 200;
        height: 100vh;
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Mobile sidebar overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
    }

    .sidebar-overlay.visible {
        display: block;
    }
}

/* Pull-to-refresh indicator */
.pull-to-refresh {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    color: var(--text-muted);
}

.pull-to-refresh.active {
    display: flex;
}

.pull-to-refresh i {
    animation: spin 1s linear infinite;
}

/* Table responsive wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .table-responsive {
        margin: 0 -1rem;
        padding: 0 1rem;
        width: calc(100% + 2rem);
    }

    /* Card-style table on mobile */
    .data-table.card-mobile {
        display: block;
    }

    .data-table.card-mobile thead {
        display: none;
    }

    .data-table.card-mobile tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .data-table.card-mobile tr {
        display: block;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 1rem;
    }

    .data-table.card-mobile td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid var(--border);
    }

    .data-table.card-mobile td:last-child {
        border-bottom: none;
    }

    .data-table.card-mobile td::before {
        content: attr(data-label);
        font-weight: 500;
        color: var(--text-secondary);
        margin-right: 1rem;
    }

    .data-table.card-mobile td.actions-col {
        justify-content: flex-end;
        padding-top: 0.75rem;
        margin-top: 0.25rem;
    }

    .data-table.card-mobile td.actions-col::before {
        display: none;
    }
}

/* =============================================
   SEARCH INPUT WRAPPER
   ============================================= */
.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 180px;
    max-width: 300px;
}

.search-input-wrapper svg {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input-wrapper .form-input {
    padding-left: calc(var(--space-3) + 16px + var(--space-2));
}

/* Search/Filter Group */
.search-filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

@media (max-width: 640px) {
    .search-filter-group {
        width: 100%;
    }

    .search-input-wrapper {
        min-width: 100%;
        max-width: none;
    }

    .search-filter-group .form-select {
        flex: 1;
    }
}

/* =============================================
   SORTABLE TABLE HEADERS
   ============================================= */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
    white-space: nowrap;
}

.data-table th.sortable:hover {
    background: var(--bg-hover);
}

.data-table th.sortable .sort-icon {
    display: inline-flex;
    vertical-align: middle;
    width: 14px;
    height: 14px;
    margin-left: var(--space-1);
    opacity: 0.3;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.data-table th.sortable:hover .sort-icon {
    opacity: 0.6;
}

.data-table th.sortable.asc .sort-icon,
.data-table th.sortable.desc .sort-icon {
    opacity: 1;
    color: var(--primary-600);
}

.data-table th.sortable.desc .sort-icon {
    transform: rotate(180deg);
}

/* =============================================
   ADMIN TABLES MOBILE CARD VIEW
   ============================================= */
@media (max-width: 768px) {
    #users-table,
    #org-members-table {
        display: block;
    }

    #users-table thead,
    #org-members-table thead {
        display: none;
    }

    #users-table tbody,
    #org-members-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    #users-table tr,
    #org-members-table tr {
        display: block;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: 1rem;
    }

    #users-table td,
    #org-members-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
        border-bottom: 1px solid var(--border-light);
    }

    #users-table td:last-child,
    #org-members-table td:last-child {
        border-bottom: none;
    }

    #users-table td::before,
    #org-members-table td::before {
        content: attr(data-label);
        font-weight: 500;
        font-size: 0.75rem;
        color: var(--text-tertiary);
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }

    #users-table td.actions-col,
    #org-members-table td.actions-col {
        justify-content: flex-end;
        padding-top: 0.75rem;
        margin-top: 0.25rem;
    }

    #users-table td.actions-col::before,
    #org-members-table td.actions-col::before {
        display: none;
    }
}

/* =============================================
   MOBILE MODAL FULL-SCREEN (Fixed)
   ============================================= */
@media (max-width: 640px) {
    .modal-container {
        max-width: 100%;
        max-height: 100%;
        width: 100%;
        height: 100%;
        margin: 0;
    }

    .modal-card {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .modal:not(.hidden) .modal-card {
        transform: none;
    }

    .modal .modal-header {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg-surface);
    }

    .modal .modal-body {
        flex: 1;
        overflow-y: auto;
        padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
    }
}

/* Safe area handling for notched devices */
@supports (padding: max(0px)) {
    .main-content {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .sidebar {
        padding-left: env(safe-area-inset-left);
    }

    .header {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Landscape mobile adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        max-height: 95vh;
    }

    .login-wrapper {
        padding: 1rem;
    }

    .login-header {
        padding: 1rem 0;
    }

    .login-header .logo-icon {
        width: 48px;
        height: 48px;
    }
}

/* High-resolution displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card,
    .modal-content,
    .dropdown-menu {
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.06);
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .skeleton::after {
        animation: none;
    }
}

/* ==========================================================================
   ACCESSIBILITY (a11y)
   ========================================================================== */

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-600);
    color: white;
    padding: 0.75rem 1.5rem;
    z-index: 1000;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
    top: 0;
}

/* Enhanced focus states for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* Button focus states */
.btn:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--primary-100);
}

/* Input focus states */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* Tab focus states */
.tab-btn:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: -2px;
    background: var(--bg-hover);
}

/* Link focus states */
a:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Card/clickable area focus */
.card:focus-visible,
.stat-card:focus-visible,
.clickable:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    box-shadow: var(--shadow-lg);
}

/* Modal focus trap indicator */
.modal-content:focus {
    outline: none;
}

/* Focus within for composite widgets */
.dropdown:focus-within .dropdown-trigger,
.select-wrapper:focus-within {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border: #000;
        --text-primary: #000;
        --text-secondary: #333;
    }

    .btn-primary {
        border: 2px solid #000;
    }

    .btn-secondary {
        border: 2px solid #000;
    }

    input,
    select,
    textarea {
        border-width: 2px;
    }

    .card {
        border: 2px solid #000;
    }
}

/* Live region styles for announcements */
.live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicator for table rows */
.data-table tbody tr:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: -2px;
    background: var(--primary-50);
}

/* Make sure interactive elements have visible hover/focus states */
.nav-item:focus-visible,
.sidebar-nav a:focus-visible {
    background: var(--bg-hover);
    outline: 2px solid var(--primary-500);
    outline-offset: -2px;
}

/* Dropdown menu keyboard navigation */
.dropdown-menu [role="menuitem"]:focus-visible {
    background: var(--primary-50);
    outline: none;
}

/* Better disabled state visibility */
[disabled],
.disabled,
[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Error state for screen readers */
[aria-invalid="true"] {
    border-color: var(--danger-500);
}

/* Required field indicator */
.form-label .required,
label .required {
    color: var(--danger-500);
    margin-left: 0.25rem;
}

/* Ensure sufficient color contrast for text */
.text-muted {
    color: var(--text-secondary); /* 4.5:1 contrast ratio minimum */
}

/* Tooltip accessibility */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--neutral-900);
    color: white;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 100;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus::after {
    opacity: 1;
    visibility: visible;
}

/* Ensure icon buttons have adequate touch targets and labels */
.icon-btn {
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--bg-hover);
}

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

/* Keyboard shortcuts help dialog */
.keyboard-shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shortcut-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.shortcut-row kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.25rem 0.5rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--neutral-100);
    border: 1px solid var(--neutral-300);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 0 var(--neutral-400);
}

.shortcut-row span {
    color: var(--text-secondary);
}

/* =============================================
   FLOATING ACTION BUTTON (FAB)
   ============================================= */

/* Transform quick-add button into a FAB on mobile */
@media (max-width: 768px) {
    /* Header actions container becomes invisible but keeps button in DOM */
    .header-actions {
        position: static;
    }

    #quick-add-btn {
        position: fixed !important;
        bottom: calc(var(--mobile-nav-height) + var(--space-4) + env(safe-area-inset-bottom));
        right: var(--space-4);
        width: 56px;
        height: 56px;
        padding: 0;
        border-radius: 50%;
        background: var(--primary-600);
        box-shadow: var(--shadow-lg), 0 4px 12px rgba(37, 99, 235, 0.35);
        z-index: 90;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    #quick-add-btn:hover {
        background: var(--primary-700);
        transform: scale(1.05);
    }

    #quick-add-btn:active {
        transform: scale(0.95);
    }

    #quick-add-btn .desktop-only {
        display: none !important;
    }

    #quick-add-btn i,
    #quick-add-btn svg {
        width: 24px;
        height: 24px;
        color: white;
    }

    /* Quick add menu appears above the FAB */
    .quick-add-menu {
        position: fixed !important;
        bottom: calc(var(--mobile-nav-height) + 56px + var(--space-6) + env(safe-area-inset-bottom)) !important;
        right: var(--space-4) !important;
        left: auto !important;
        top: auto !important;
        min-width: 200px;
    }
}

/* =============================================
   PULL-TO-REFRESH
   ============================================= */

.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    pointer-events: none;
    transform: translateY(-60px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.pull-refresh-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-primary);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.pull-refresh-arrow,
.pull-refresh-spinner {
    width: 20px;
    height: 20px;
    color: var(--primary-600);
    transition: transform 0.2s ease;
}

.pull-refresh-spinner {
    display: none;
    animation: spin 1s linear infinite;
}

.pull-refresh-indicator.refreshing .pull-refresh-arrow {
    display: none;
}

.pull-refresh-indicator.refreshing .pull-refresh-spinner {
    display: block;
}

.pull-refresh-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

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

/* =============================================
   SWIPE GESTURES
   ============================================= */

.swipe-item {
    position: relative;
    overflow: hidden;
}

.swipe-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
}

.swipe-content {
    flex: 1;
    background: var(--bg-primary);
    transition: transform 0.3s ease;
    z-index: 1;
}

.swipe-actions {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.swipe-actions-left {
    left: 0;
    justify-content: flex-start;
    padding-left: 1rem;
}

.swipe-actions-right {
    right: 0;
    justify-content: flex-end;
    padding-right: 1rem;
}

.swipe-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.swipe-action i,
.swipe-action svg {
    width: 20px;
    height: 20px;
}

.swipe-action span {
    font-size: 0.75rem;
    font-weight: 500;
}

.swipe-action-edit {
    color: var(--primary-600);
    background: var(--primary-50);
}

.swipe-action-edit:active {
    background: var(--primary-100);
    transform: scale(0.95);
}

.swipe-action-delete {
    color: var(--danger-600);
    background: var(--danger-100);
}

.swipe-action-delete:active {
    background: var(--danger-200);
    transform: scale(0.95);
}

/* Dark theme swipe actions */
[data-theme="dark"] .swipe-action-edit {
    color: var(--primary-400);
    background: rgba(52, 211, 153, 0.15);
}

[data-theme="dark"] .swipe-action-delete {
    color: var(--danger-400);
    background: rgba(239, 68, 68, 0.15);
}

/* =============================================
   PWA INSTALL & UPDATE BANNERS
   ============================================= */

.pwa-banner {
    position: fixed;
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    left: var(--space-4);
    right: var(--space-4);
    max-width: 480px;
    margin: 0 auto;
    z-index: 10000;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    transform: translateY(calc(100% + 2rem));
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.pwa-banner.visible {
    transform: translateY(0);
    opacity: 1;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.pwa-banner-icon {
    flex-shrink: 0;
}

.pwa-banner-icon img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
}

.pwa-banner-icon i,
.pwa-banner-icon svg {
    width: 32px;
    height: 32px;
    color: var(--primary-600);
}

.pwa-banner-text {
    flex: 1;
    min-width: 0;
}

.pwa-banner-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.pwa-banner-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.pwa-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.pwa-banner-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.pwa-banner-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.pwa-banner-close i,
.pwa-banner-close svg {
    width: 16px;
    height: 16px;
}

/* Update banner specific */
.pwa-update-banner {
    bottom: auto;
    top: calc(var(--space-4) + env(safe-area-inset-top));
    transform: translateY(calc(-100% - 2rem));
}

.pwa-update-banner.visible {
    transform: translateY(0);
}

/* Mobile adjustments for banners */
@media (max-width: 768px) {
    .pwa-banner {
        left: var(--space-3);
        right: var(--space-3);
        bottom: calc(var(--mobile-nav-height) + var(--space-3) + env(safe-area-inset-bottom));
    }

    .pwa-banner-content {
        flex-wrap: wrap;
    }

    .pwa-banner-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }

    .pwa-update-banner {
        bottom: auto;
        top: calc(var(--header-height) + var(--space-3));
    }
}

/* ===========================
   Keyboard Shortcuts
   =========================== */

/* Shortcut indicator (G + ...) */
.shortcut-indicator {
    position: fixed;
    bottom: calc(var(--mobile-nav-height, 0px) + 80px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-4);
    box-shadow: var(--shadow-lg);
    font-family: ui-monospace, monospace;
    font-size: 1rem;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.shortcut-indicator.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.shortcut-indicator .shortcut-hint {
    color: var(--text-muted);
    font-weight: 400;
}

/* Nav shortcut hints */
.nav-shortcut-hint {
    display: none;
    position: absolute;
    right: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 0.35rem;
    font-size: 0.65rem;
    font-family: ui-monospace, monospace;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar:not(.collapsed) .nav-item:hover .nav-shortcut-hint {
    display: block;
    opacity: 1;
}

/* Shortcuts help overlay */
.shortcuts-help {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 9999;
    padding: var(--space-4);
}

.shortcuts-help.visible {
    opacity: 1;
    visibility: visible;
}

.shortcuts-help.hidden {
    display: none;
}

.shortcuts-help-content {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.shortcuts-help.visible .shortcuts-help-content {
    transform: scale(1);
}

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

.shortcuts-help-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

.shortcuts-help-close {
    background: transparent;
    border: none;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.shortcuts-help-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.shortcuts-section {
    padding: var(--space-4);
}

.shortcuts-section:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.shortcuts-section h4 {
    margin: 0 0 var(--space-3) 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-2);
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
}

.shortcut-keys {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.shortcut-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .shortcut-indicator {
        bottom: calc(var(--mobile-nav-height) + 20px + env(safe-area-inset-bottom));
    }

    .shortcuts-help-content {
        max-height: 70vh;
    }

    .shortcuts-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-shortcut-hint {
        display: none !important;
    }
}
