* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Modern Color Palette - EP-FIN Purple Theme */
    --primary-color: #764ba2;
    --primary-dark: #5b21b6;
    --primary-light: #e9d5ff;
    --primary-gradient: linear-gradient(135deg, #764ba2 0%, #9333ea 100%);
    
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --success-light: #d1fae5;
    --danger-color: #ef4444;
    --danger-light: #fee2e2;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --info-color: #3b82f6;
    --info-light: #dbeafe;
    
    /* Background Colors */
    --bg-color: #f8fafc;
    --bg-secondary: #f1f5f9;
    --card-bg: #ffffff;
    --card-hover: #fafbfc;
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    
    /* Border Colors */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --border-dark: #cbd5e1;
    
    /* Layout */
    --sidebar-width: 280px;
    --finflow-radius: 18px;
    --finflow-gray: #f5f7ff;
    --finflow-gray-light: #f5f7ff;
    --finflow-gray-medium: #e6e9f4;
    --header-height: 80px;
    --nav-collapsed-width: 108px;
    --nav-expanded-width: 246px;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --finflow-gray: #0f172a;
    /* Background Colors - Dark Theme */
    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --card-bg: #1e293b;
    --card-hover: #334155;
    
    /* Text Colors - Dark Theme */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    
    /* Border Colors - Dark Theme */
    --border-color: #334155;
    --border-light: #1e293b;
    --border-dark: #475569;
    
    /* Keep primary colors but adjust for dark mode */
    --primary-light: #3b1f5f;
    --success-light: #064e3b;
    --danger-light: #7f1d1d;
    --warning-light: #78350f;
    --info-light: #1e3a8a;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--finflow-gray, var(--bg-color));
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    /* PWA Safe Area Support */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* PWA Standalone Mode */
@media all and (display-mode: standalone) {
    body {
        /* App-like experience when installed */
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }
    
    .header {
        padding-top: calc(24px + env(safe-area-inset-top));
    }
    
    .main-content {
        padding-top: calc(32px + env(safe-area-inset-top));
    }
}

/* Login Page */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #f8faff 0%, #eef2ff 100%);
    padding: 32px 16px;
}

[data-theme="dark"] .auth-shell {
    background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
}

.auth-card {
    width: min(480px, 100%);
    background: #ffffff;
    border-radius: 32px;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.1);
    padding: 48px 42px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(118, 75, 162, 0.15), transparent 60%);
    pointer-events: none;
}

.auth-avatar {
    width: 82px;
    height: 82px;
    border-radius: 24px;
    background: linear-gradient(135deg, #f4f4f8 0%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.8), 0 8px 20px rgba(15, 23, 42, 0.08);
}

.auth-avatar-icon {
    filter: drop-shadow(0 4px 8px rgba(118, 75, 162, 0.2));
}

.auth-title {
    text-align: center;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #0f172a;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.auth-subtitle {
    text-align: center;
    font-size: 15px;
    color: #64748b;
    letter-spacing: 0.2px;
    margin-top: -12px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-field label {
    font-weight: 600;
    font-size: 13px;
    color: #1f2937;
    letter-spacing: 0.4px;
}

.auth-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 18px;
    padding: 16px 18px;
    background: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.3);
    transition: all 0.25s ease;
}

.auth-input-wrapper:focus-within {
    border-color: #7c3aed;
    box-shadow: 0 16px 32px rgba(124, 58, 237, 0.12);
    background: #ffffff;
}

.auth-input-wrapper input,
.auth-input-wrapper select {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 16px;
    color: #0f172a;
    font-family: 'Inter', sans-serif;
}

.auth-input-wrapper input::placeholder {
    color: #cbd5f5;
}

.auth-input-wrapper input:focus,
.auth-input-wrapper select:focus {
    outline: none;
}

.auth-input-password {
    position: relative;
}

.auth-toggle-password {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 18px;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.25s ease;
}

.auth-toggle-password:hover {
    color: #6366f1;
}

.auth-toggle-password .hide {
    display: none;
}

.auth-toggle-password.active .show {
    display: none;
}

.auth-toggle-password.active .hide {
    display: inline;
}

.auth-submit {
    width: 100%;
    border: none;
    border-radius: 20px;
    padding: 18px 0;
    font-size: 17px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 18px 40px rgba(99, 102, 241, 0.25);
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 40px rgba(99, 102, 241, 0.35);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-footer {
    display: flex;
    justify-content: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 14px;
}

.auth-footer a {
    color: #6366f1;
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Dark Mode Footer Styles */
[data-theme="dark"] .auth-footer {
    color: var(--text-secondary);
}

[data-theme="dark"] .auth-footer a {
    color: var(--primary-color);
}

[data-theme="dark"] .auth-footer a:hover {
    color: var(--primary-light);
}

[data-theme="dark"] footer {
    background: var(--bg-secondary) !important;
    border-top-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] footer p {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] footer::before {
    background: linear-gradient(90deg, transparent, rgba(118, 75, 162, 0.65), transparent) !important;
}

[data-theme="dark"] .store-footer {
    background: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
    border-top-color: var(--border-color) !important;
}

.auth-field small {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .auth-card {
        padding: 36px 26px;
        border-radius: 24px;
    }

    .auth-title {
        font-size: 28px;
    }
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-color);
}

/* FinFlow-Style Sidebar */
.finflow-sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 35px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1001;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.03);
    overflow: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 30px 35px;
    text-decoration: none;
    color: var(--text-primary);
}

.sidebar-logo-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-logo-img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    padding: 4px;
}

.sidebar-logo-text {
    font-weight: 700;
    font-size: 20px;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 16px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    border-radius: 12px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.sidebar-nav-item i {
    margin-right: 15px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-nav-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    transform: translateX(5px);
}

.sidebar-nav-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
}

.sidebar-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 20px 20px 8px;
    margin-top: 8px;
}

.sidebar-section:first-of-type {
    margin-top: 0;
    padding-top: 8px;
}

.sidebar-logout {
    margin-top: auto;
}

.sidebar-premium {
    background: linear-gradient(135deg, #8b5cf6, var(--primary-color));
    margin: 0 25px 25px;
    border-radius: var(--finflow-radius);
    padding: 25px;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(118, 75, 162, 0.3);
}

.sidebar-premium::before {
    content: "";
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    bottom: -100px;
    right: -100px;
}

.sidebar-premium h3 {
    font-size: 18px;
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}

.sidebar-premium-btn {
    background: #fff;
    color: var(--primary-color);
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    display: inline-block;
    position: relative;
    z-index: 1;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: all 0.25s ease;
}

.sidebar-premium-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    background: #fff;
    color: var(--primary-color);
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* Sidebar Admin dropdown */
.sidebar-dropdown {
    margin-bottom: 4px;
}

.sidebar-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 15px;
    border-radius: 12px;
    border: none;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    background: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.sidebar-dropdown-trigger:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-dropdown-trigger.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 3px solid var(--primary-color);
}

.sidebar-dropdown-trigger .sidebar-dropdown-chevron {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.25s ease;
}

.sidebar-dropdown.open .sidebar-dropdown-chevron {
    transform: rotate(180deg);
}

.sidebar-dropdown-menu {
    padding-left: 24px;
    margin-top: 4px;
    margin-bottom: 8px;
    border-left: 2px solid var(--border-color);
    margin-left: 18px;
    max-height: 280px;
    overflow-y: auto;
}

.sidebar-dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.2s ease;
}

.sidebar-dropdown-item i {
    margin-right: 12px;
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.sidebar-dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}

/* Profile dropdown in header */
.finflow-profile-wrap {
    position: relative;
}

.finflow-profile-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    font-family: inherit;
}

.finflow-profile-trigger:hover {
    border-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(118, 75, 162, 0.15);
}

.finflow-profile-chevron {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.finflow-profile-wrap.open .finflow-profile-chevron {
    transform: rotate(180deg);
}

.finflow-profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    border: 1px solid var(--border-color);
    padding: 8px;
    z-index: 1000;
    display: none;
}

.finflow-profile-dropdown.show {
    display: block;
}

.finflow-profile-dropdown a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.finflow-profile-dropdown a:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.finflow-profile-dropdown a i {
    width: 18px;
    text-align: center;
    opacity: 0.8;
}

/* Dashboard widgets */
.dashboard-widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.widget-expiring-soon {
    /* Uses card-accent-warning for border */
}

.dashboard-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

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

@media (max-width: 600px) {
    .dashboard-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Quick Actions - shared across dashboard and other pages */
.quick-actions-section .card-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.quick-action-card {
    text-decoration: none;
    padding: 24px 20px;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: var(--finflow-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: block;
}

.quick-action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.quick-action-card .qa-icon {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
}

.quick-action-card .qa-label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.quick-action-card.qa-primary { border-top-color: var(--primary-color); }
.quick-action-card.qa-primary .qa-icon { color: var(--primary-color); }
.quick-action-card.qa-success { border-top-color: var(--success-color); }
.quick-action-card.qa-success .qa-icon { color: var(--success-color); }
.quick-action-card.qa-info { border-top-color: var(--info-color); }
.quick-action-card.qa-info .qa-icon { color: var(--info-color); }
.quick-action-card.qa-warning { border-top-color: var(--warning-color); }
.quick-action-card.qa-warning .qa-icon { color: var(--warning-color); }

.widget-expiring-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.widget-expiring-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.widget-expiring-icon {
    font-size: 28px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.widget-expiring-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.widget-expiring-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.widget-expiring-viewall {
    flex-shrink: 0;
}

.widget-expiring-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
}

.widget-expiring-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-fast);
}

.widget-expiring-item:hover {
    background: var(--card-hover);
    border-color: var(--warning-color);
    box-shadow: var(--shadow-sm);
}

.widget-expiring-item-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.widget-expiring-username {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.widget-expiring-server {
    font-size: 12px;
    color: var(--text-secondary);
}

.widget-expiring-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.widget-expiring-days {
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.widget-days-critical {
    background: var(--danger-light);
    color: var(--danger-color);
}

.widget-days-soon {
    background: var(--warning-light);
    color: var(--warning-color);
}

.widget-days-ok {
    background: var(--info-light);
    color: var(--info-color);
}

.widget-expiring-date {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
    min-height: 100vh;
    animation: fadeIn 0.4s ease-out;
    max-width: 1800px;
}

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

/* FinFlow Header */
.finflow-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.finflow-mobile-toggle {
    display: none;
    background: var(--primary-color);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.finflow-welcome {
    flex: 1;
}

.finflow-greeting {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 8px;
}

.finflow-title {
    font-size: 30px;
    font-weight: 700;
    background: linear-gradient(90deg, var(--text-primary), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.finflow-header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.finflow-icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.finflow-icon-btn:hover {
    transform: translateY(-3px);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.finflow-notification-bell {
    background: var(--card-bg);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    position: relative;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    transition: all 0.2s;
}

.finflow-notification-bell:hover {
    transform: translateY(-3px);
    color: var(--primary-color);
}

.finflow-notification-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    background: var(--danger-color);
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

.finflow-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    padding: 8px 16px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

.finflow-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
}

.finflow-search {
    background: var(--card-bg);
    border-radius: 50px;
    padding: 12px 25px;
    display: flex;
    align-items: center;
    width: 280px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
}

.finflow-search:focus-within {
    box-shadow: 0 5px 15px rgba(118, 75, 162, 0.2);
}

.finflow-search i {
    color: var(--text-muted);
    font-size: 16px;
    margin-right: 12px;
}

.finflow-search input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 15px;
    color: var(--text-primary);
    background: transparent;
}

.finflow-search input::placeholder {
    color: var(--text-muted);
}

/* Legacy header compatibility */
.header {
    background: var(--card-bg);
    padding: 24px 32px;
    margin: -40px -40px 32px -40px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 32px;
    color: var(--text-primary);
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Cards - FinFlow UI */
.card {
    background: var(--card-bg);
    border-radius: var(--finflow-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    padding: 28px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card-accent-primary { border-top-color: var(--primary-color); }
.card-accent-success { border-top-color: var(--success-color); }
.card-accent-info { border-top-color: var(--info-color); }
.card-accent-warning { border-top-color: var(--warning-color); }
.card-accent-danger { border-top-color: var(--danger-color); }

.card:hover {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h2 {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h2 .card-icon {
    font-size: 20px;
    opacity: 0.9;
}

.card-header h2 .card-icon.text-primary { color: var(--primary-color); }
.card-header h2 .card-icon.text-success { color: var(--success-color); }
.card-header h2 .card-icon.text-info { color: var(--info-color); }
.card-header h2 .card-icon.text-warning { color: var(--warning-color); }
.card-header h2 .card-icon.text-danger { color: var(--danger-color); }

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.2px;
}

.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 15px;
    transition: all var(--transition-base);
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
    transform: translateY(-1px);
}

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

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
    appearance: none;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    line-height: 1.6;
}

.form-group small {
    display: block;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

/* Checkboxes */
input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    transition: all var(--transition-base);
}

input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

input[type="checkbox"]:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    text-align: center;
    box-shadow: var(--shadow-sm);
    letter-spacing: -0.2px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

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

.btn-success:hover {
    background: #059669;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

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

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

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

.btn-warning:hover {
    background: #d97706;
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4);
}

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

.btn-info:hover {
    background: #2563eb;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.btn-sm {
    padding: 10px 18px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

table th,
table td {
    padding: 18px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

table th {
    background: var(--bg-color);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    position: sticky;
    top: 0;
    z-index: 10;
}

table td {
    color: var(--text-primary);
    font-size: 14px;
}

table tr:last-child td {
    border-bottom: none;
}

table tr {
    transition: all var(--transition-fast);
}

table tr:hover {
    background: var(--primary-light);
}

table tr:hover td {
    background: var(--primary-light);
}

table a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-base);
}

table a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 18px 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-left: 4px solid;
    box-shadow: var(--shadow-sm);
    animation: slideIn 0.3s ease-out;
}

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

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border-left-color: var(--success-color);
}

.alert-danger,
.alert-error {
    background: var(--danger-light);
    color: #991b1b;
    border-left-color: var(--danger-color);
}

.alert-info {
    background: var(--info-light);
    color: #1e40af;
    border-left-color: var(--info-color);
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-left-color: var(--warning-color);
}

/* Stats Cards - FinFlow Style */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
    margin-bottom: 32px;
}

.finflow-transfer-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

@media (max-width: 1024px) {
    .finflow-transfer-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .finflow-transfer-cards {
        grid-template-columns: 1fr;
    }
}

/* FinFlow Dashboard Layout */
.finflow-dashboard-container {
    display: grid;
    grid-template-columns: 3fr 1.2fr;
    gap: 30px;
    margin-bottom: 30px;
}

.finflow-dashboard-main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.finflow-dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

@media (max-width: 1200px) {
    .finflow-dashboard-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .finflow-promo-card {
        flex-direction: column;
        text-align: center;
    }
    .finflow-promo-info {
        max-width: 100%;
    }
    .finflow-credit-card {
        width: 100%;
        max-width: 280px;
        transform: none;
    }
}

/* FinFlow Promo Card */
.finflow-promo-card {
    background: linear-gradient(135deg, var(--primary-light), #e9e0f5);
    border-radius: var(--finflow-radius);
    padding: 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.finflow-promo-card::before {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), transparent);
    border-radius: 50%;
    top: -150px;
    right: -150px;
}

.finflow-promo-info {
    max-width: 55%;
    z-index: 1;
}

.finflow-promo-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(90deg, var(--text-primary), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.finflow-promo-desc {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 15px;
    line-height: 1.6;
}

.finflow-promo-btn {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 12px 28px;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 8px 15px rgba(118, 75, 162, 0.3);
    transition: all 0.3s;
}

.finflow-promo-btn:hover {
    transform: translateY(-3px);
    opacity: 0.95;
}

.finflow-credit-card {
    background: linear-gradient(135deg, #8b5cf6, var(--primary-color));
    width: 280px;
    height: 170px;
    border-radius: 18px;
    padding: 22px;
    color: #fff;
    position: relative;
    box-shadow: 0 15px 30px rgba(118, 75, 162, 0.3);
    transform: rotate(5deg);
}

.finflow-card-brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.finflow-card-type {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
}

.finflow-card-logo {
    display: flex;
    gap: 5px;
}

.finflow-card-logo span {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
}

.finflow-card-logo span:last-child {
    opacity: 0.7;
    transform: translateX(-6px);
}

.finflow-card-number {
    font-size: 16px;
    letter-spacing: 2px;
    margin-bottom: 16px;
}

.finflow-card-details {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.finflow-card-details small {
    opacity: 0.8;
}

/* FinFlow Savings / Monthly Revenue */
.finflow-savings-card {
    background: var(--card-bg);
    border-radius: var(--finflow-radius);
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.finflow-savings-title {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.finflow-savings-title::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    margin-right: 10px;
}

.finflow-savings-amount {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(45deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.finflow-time-filter {
    margin-bottom: 16px;
}

.finflow-time-option {
    padding: 6px 14px;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.finflow-time-option.active {
    background: var(--primary-color);
    color: #fff;
}

.finflow-chart-placeholder {
    height: 80px;
}

/* FinFlow Plan Card */
.finflow-plan-card {
    background: linear-gradient(135deg, #5a3a7a, var(--primary-color));
    color: #fff;
    border-radius: var(--finflow-radius);
    padding: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.finflow-plan-title {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.finflow-plan-status {
    font-size: 22px;
    font-weight: 700;
}

.finflow-plan-progress {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.finflow-transfer-card {
    background: var(--card-bg);
    border-radius: var(--finflow-radius);
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.finflow-transfer-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.finflow-transfer-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 0;
    background: var(--primary-color);
    transition: height 0.3s ease;
}

.finflow-transfer-card:hover::before {
    height: 100%;
}

.finflow-transfer-card .card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 20px;
    transition: all 0.3s ease;
}

.finflow-transfer-card:hover .card-icon {
    transform: scale(1.1);
    background: var(--primary-color);
    color: #fff;
}

.finflow-transfer-card .card-title {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.finflow-transfer-card .card-amount {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(45deg, var(--text-primary), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--finflow-radius);
    padding: 28px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.stat-card.card-accent-success { border-top-color: var(--success-color); }
.stat-card.card-accent-info { border-top-color: var(--info-color); }
.stat-card.card-accent-warning { border-top-color: var(--warning-color); }
.stat-card.card-accent-danger { border-top-color: var(--danger-color); }

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    margin-bottom: 16px;
    font-weight: 600;
    letter-spacing: 0.8px;
}

.stat-card .value,
.stat-card .stat-value {
    font-size: 42px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}

.badge-info {
    background: var(--info-light);
    color: #1e40af;
}

/* Enhanced Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 600;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 15px;
    margin: 0;
}

/* Utility Classes */
.text-secondary {
    color: var(--text-secondary);
}

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

.text-danger {
    color: var(--danger-color);
}

.text-success {
    color: var(--success-color);
}

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

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-top: 20px;
}

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

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: var(--primary-color);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.mobile-menu-toggle:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive */
/* Tablet: 769px - 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        padding: 24px;
        padding-top: calc(24px + env(safe-area-inset-top));
    }
    
    .header {
        margin: -24px -24px 24px -24px;
        padding: 20px 24px;
        padding-left: calc(24px + env(safe-area-inset-left));
    }
    
    .card {
        padding: 24px;
    }
    
    .dashboard-widgets-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 20px;
    }
    
}

@media (max-width: 1024px) {
    .main-content {
        padding: 24px;
    }
    
    .header {
        margin: -24px -24px 24px -24px;
        padding: 20px 24px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 20px;
    }
    
    .user-info {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 900px) {
    .finflow-search {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .finflow-mobile-toggle {
        display: flex;
    }
    .finflow-search {
        display: none;
    }
    
    /* Mobile: sidebar as slide-out overlay */
    .finflow-sidebar {
        width: min(300px, 92vw);
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }
    
    .finflow-sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
    }
    
    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
        position: fixed;
        width: 100%;
    }
    
    .sidebar-overlay {
        display: block;
        pointer-events: none;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        transition: opacity 0.35s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
        pointer-events: auto;
    }
    
    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: calc(16px + env(safe-area-inset-top));
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
        min-height: 100vh;
        min-height: 100dvh;
    }
    
    .header {
        margin: -16px -16px 20px -16px;
        padding: 14px 16px;
        padding-left: calc(16px + env(safe-area-inset-left));
        padding-top: calc(14px + env(safe-area-inset-top));
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 100;
        min-height: 56px;
    }
    
    .header h1 {
        font-size: 20px;
        flex: 1;
        min-width: 0;
        line-height: 1.3;
    }
    
    .user-info {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 12px;
        flex-wrap: wrap;
    }
    
    .user-info > a,
    .user-info > div {
        width: auto;
        min-height: 44px;
        justify-content: center;
    }
    
    .dashboard-widgets-grid {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 20px;
    }
    
    .widget-expiring-header {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .widget-expiring-item {
        padding: 12px 14px;
    }
    
    .cta-bar {
        padding: 14px 16px !important;
    }
    
    .cta-bar .btn {
        min-height: 48px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-card .value {
        font-size: 32px;
    }
    
    .card {
        padding: 20px;
        border-radius: var(--radius);
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .card-header h2 {
        font-size: 20px;
        line-height: 1.3;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -20px;
        padding: 0 20px;
    }
    
    table {
        min-width: 600px;
        font-size: 14px;
    }
    
    table th,
    table td {
        padding: 12px 8px;
    }

    /* Responsive tables: card layout on mobile */
    .table-responsive-cards.table-container {
        overflow-x: visible;
        margin: 0;
        padding: 0;
        border: none;
    }
    .table-responsive-cards table {
        min-width: 0;
    }
    .table-responsive-cards thead {
        display: none;
    }
    .table-responsive-cards tbody tr {
        display: block;
        margin-bottom: 16px;
        padding: 16px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        background: var(--bg-secondary);
        box-shadow: var(--shadow-xs);
    }
    .table-responsive-cards tbody tr:hover {
        background: var(--bg-secondary);
    }
    .table-responsive-cards td {
        display: block;
        padding: 10px 0;
        border: none;
        border-bottom: 1px solid var(--border-light);
    }
    .table-responsive-cards td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    .table-responsive-cards td:first-child {
        padding-top: 0;
    }
    .table-responsive-cards td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--text-secondary);
        display: block;
        margin-bottom: 4px;
    }
    .table-responsive-cards td .btn,
    .table-responsive-cards td form {
        margin-top: 8px;
    }
    .table-responsive-cards td .badge {
        margin-right: 4px;
    }

    .cta-bar .btn {
        width: 100%;
        min-width: 0;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px 16px;
    }
    
    /* Duration input grid - stack on mobile */
    .form-group > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
        justify-content: center;
    }
    
    /* Keep inline buttons from becoming full width */
    form .btn,
    .card-header .btn,
    .btn-group .btn,
    .btn-sm {
        width: auto;
        min-width: auto;
    }
    
    .btn-sm {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    /* Inline forms */
    form[style*="inline"] .btn,
    form[style*="display: inline"] .btn {
        width: auto;
        display: inline-block;
    }
    
    /* Login Page Mobile */
    .login-box {
        width: 100%;
        max-width: 100%;
        margin: 20px;
        padding: 30px 24px;
    }
    
    /* Store Page Mobile */
    .store-background,
    .bg-animation {
        position: fixed;
    }
    
    .store-hero,
    .hero-section {
        padding: 40px 20px !important;
        text-align: center;
    }
    
    .store-hero h1,
    .hero-section h1 {
        font-size: 32px !important;
        line-height: 1.2;
    }
    
    .store-hero p,
    .hero-section p {
        font-size: 16px !important;
    }
    
    .products-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 20px !important;
    }
    
    .product-card {
        padding: 24px !important;
        margin: 0 !important;
    }
    
    .product-header {
        padding: 24px 20px 20px !important;
    }
    
    .product-body {
        padding: 20px !important;
    }
    
    .product-name {
        font-size: 24px !important;
    }
    
    .price-amount {
        font-size: 36px !important;
    }
    
    .product-button {
        padding: 16px 24px !important;
        font-size: 16px !important;
    }
    
    /* Dashboard Mobile */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Badges Mobile */
    .badge {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    /* Alert Mobile */
    .alert {
        padding: 16px;
        font-size: 14px;
        line-height: 1.5;
    }
    
    /* Empty State Mobile */
    .empty-state {
        padding: 40px 20px;
    }
    
    .empty-state h3 {
        font-size: 20px;
    }
    
    .sidebar-nav-item {
        padding: 16px 20px;
        font-size: 15px;
        min-height: 48px;
    }
    
    .sidebar-logo-text {
        font-size: 16px;
    }
    
    .card {
        padding: 20px;
    }
    
    .card:hover {
        transform: none;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 12px;
    }
    
    .header {
        margin: -12px -12px 16px -12px;
        padding: 12px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .card {
        padding: 16px;
    }
    
    .card-header h2 {
        font-size: 18px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-card .value {
        font-size: 28px;
    }
    
    .stat-card h3 {
        font-size: 14px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .form-control {
        padding: 10px 14px;
        font-size: 16px;
    }
    
    table {
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 10px 6px;
    }
    
    .login-box {
        padding: 24px 20px;
    }
    
    .store-hero h1 {
        font-size: 28px;
    }
    
    .product-card {
        padding: 20px;
    }
    
    .product-price {
        font-size: 32px;
    }
    
    /* Additional Mobile Optimizations */
    .card-header {
        flex-wrap: wrap;
    }
    
    .card-header .btn {
        width: auto;
        min-width: auto;
    }
    
    /* Modal Mobile */
    #editModal > div {
        width: 95%;
        max-width: 95%;
        padding: 20px;
        max-height: 95vh;
    }
    
    /* Form Grid Mobile */
    .form-grid > div[style*="grid-column: span"] {
        grid-column: span 1 !important;
    }
    
    /* Stats Grid Mobile */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* User Info Mobile */
    .user-info {
        flex-direction: column;
    }
    
    /* Button Groups Mobile */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin: 4px 0;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation; /* Enable fast tap */
        -webkit-tap-highlight-color: rgba(118, 75, 162, 0.2);
    }
    
    .menu-item {
        min-height: 48px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(118, 75, 162, 0.2);
    }
    
    /* Ensure all interactive elements are tappable */
    a, button, .btn, .menu-item, input, textarea, select {
        touch-action: manipulation;
        cursor: pointer;
    }
    
    /* Remove hover effects on touch devices */
    .menu-item:hover {
        transform: none;
    }
    
    /* Better tap feedback */
    .btn:active,
    .menu-item:active,
    a:active {
        transform: scale(0.98);
        opacity: 0.8;
    }
    
    /* Larger form inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        touch-action: manipulation;
    }
    
    /* Better checkbox/radio */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
        touch-action: manipulation;
    }
}

/* Landscape phone optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 12px 16px;
        padding-top: calc(12px + env(safe-area-inset-top));
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .main-content {
        padding: 12px;
        padding-top: calc(12px + env(safe-area-inset-top));
    }
    
    .card {
        padding: 16px;
    }
    
    .navbar--nationbuilder {
        padding-top: calc(0px + env(safe-area-inset-top));
    }
}

/* Tablet Optimization (iPad, etc.) */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-content {
        margin-left: var(--sidebar-width);
        padding: 28px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large Tablet / Small Desktop */
@media (min-width: 1025px) and (max-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* App-like touch feedback */
@media (max-width: 768px) {
    button:active,
    .btn:active,
    a:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    /* Prevent text selection on buttons for app-like feel */
    button,
    .btn {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
    }
    
    /* Better touch targets */
    .nav-link:active {
        transform: scale(0.98);
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* Prevent pull-to-refresh on mobile (app-like) */
@media (max-width: 768px) {
    body {
        overscroll-behavior-y: contain;
    }
}

/* Print Styles */
@media print {
    .navbar--nationbuilder,
    .header,
    .btn {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Animation Utilities */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.4s ease-out;
}
