/* ══════════════════════════════════════════════════════════════════════════
   DARKER BLACK - Complete Stylesheet (FIXED)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 1. ANTI-FLASH & GLOBAL RESET ──────────────────────────────────────── */
html {
    background-color: #050505;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    line-height: 1.5;
}

/* ── 2. DESIGN TOKENS ───────────────────────────────────────────────────── */
:root {
    /* Colors */
    --bg-deep: #050505;
    --bg-surface: #121212;
    --bg-elevated: #1a1a1a;
    --bg-hover: #1e1e1e;
    --bg-input: #000000;
    --accent-blue: #2979ff;
    --accent-blue-dim: #1c54b3;
    --accent-blue-glow: rgba(41, 121, 255, 0.3);
    --accent-blue-subtle: rgba(41, 121, 255, 0.08);
    --accent-blue-light: rgba(41, 121, 255, 0.15);
    --accent-green: #4caf50;
    --text-main: #e0e0e0;
    --text-sec: #888888;
    --text-muted: #666666;
    --border-subtle: #333333;
    --border-light: #444444;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --info: #2196f3;

    /* Dimensions - UPDATED */
    --nav-width-collapsed: 80px;
    --nav-width-expanded: 260px;
    --nav-width-mobile: 280px;
    --nav-icon-size: 44px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --header-height: 60px;

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

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.65);
    --shadow-nav: 4px 0 25px rgba(0, 0, 0, 0.8);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    --transition-bounce: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── 3. TYPOGRAPHY ──────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text-main);
    line-height: 1.3;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; margin-bottom: 1rem; }
h3 { font-size: 0.95rem; color: var(--text-sec); font-weight: 500; }

p {
    color: var(--text-sec);
    line-height: 1.6;
    margin: 0;
}

small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-blue-dim);
}

/* ── 4. LAYOUT ──────────────────────────────────────────────────────────── */
#app-container {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
}

main {
    padding: calc(var(--header-height) + 1rem) 1rem 2rem 1rem;
    padding-bottom: calc(2rem + var(--safe-area-bottom));
    min-height: 100vh;
    min-height: 100dvh;
    transition: margin-left var(--transition-bounce);
}

section {
    max-width: 1400px;
    margin: 0 auto;
}

/* ── 5. HAMBURGER BUTTON ────────────────────────────────────────────────── */
#hamburger {
    position: fixed;
    top: var(--safe-area-top, 0);
    left: var(--safe-area-left, 0);
    z-index: 1100;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-top: none;
    border-left: none;
    border-radius: 0 0 var(--radius-md) 0;
    width: 56px;
    height: 56px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), transform var(--transition-fast);
    padding: 0;
    outline: none;
}

#hamburger:hover {
    background: var(--bg-elevated);
}

#hamburger:active {
    transform: scale(0.95);
}

#hamburger:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 20px;
    position: relative;
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all var(--transition-bounce);
    position: absolute;
    left: 0;
}

.hamburger-icon span:nth-child(1) { top: 0; }
.hamburger-icon span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.hamburger-icon span:nth-child(3) { bottom: 0; }

/* Hamburger X animation */
#hamburger.active .hamburger-icon span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

#hamburger.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

#hamburger.active .hamburger-icon span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* ── 6. NAVIGATION - MOBILE FIRST (UPDATED) ─────────────────────────────── */
#smart-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--nav-width-mobile);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform var(--transition-bounce), width var(--transition-bounce);
    box-shadow: var(--shadow-nav);
    padding-top: var(--safe-area-top);
    padding-left: var(--safe-area-left);
    overflow-y: auto;
    overflow-x: hidden;
}

#smart-nav.active {
    transform: translateX(0);
}

/* Scrollbar styling */
#smart-nav::-webkit-scrollbar {
    width: 4px;
}

#smart-nav::-webkit-scrollbar-track {
    background: transparent;
}

#smart-nav::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

/* Nav Header */
.nav-header {
    display: flex;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    gap: 0.75rem;
    flex-shrink: 0;
    min-height: 72px;
}

.nav-logo {
    font-size: 1.8rem;
    color: var(--accent-blue);
    line-height: 1;
    width: var(--nav-icon-size);
    height: var(--nav-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--accent-blue-subtle);
    border-radius: var(--radius-sm);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-fast), width var(--transition-fast);
}

/* Nav Links Container */
.nav-links {
    flex: 1;
    padding: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Nav Item - Base */
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    color: var(--text-sec);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: 0.75rem;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    min-height: 52px;
}

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

.nav-item.active {
    color: var(--accent-blue);
    background-color: var(--accent-blue-light);
}

/* Nav Icon - FIXED SIZE */
.nav-icon {
    font-size: 1.3rem;
    width: var(--nav-icon-size);
    height: var(--nav-icon-size);
    min-width: var(--nav-icon-size);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.nav-item:hover .nav-icon {
    background: var(--border-subtle);
}

.nav-item.active .nav-icon {
    background: var(--accent-blue-subtle);
}

/* Nav Label */
.nav-label {
    font-size: 0.95rem;
    font-weight: 500;
    overflow: hidden;
    transition: opacity var(--transition-fast), width var(--transition-fast);
}

/* Nav Footer */
.nav-footer {
    border-top: 1px solid var(--border-subtle);
    padding: 0.5rem 0;
    margin-top: auto;
    padding-bottom: calc(0.5rem + var(--safe-area-bottom));
    flex-shrink: 0;
}

.nav-footer .nav-item:hover {
    color: var(--danger);
    background-color: rgba(244, 67, 54, 0.08);
}

.nav-footer .nav-item:hover .nav-icon {
    background: rgba(244, 67, 54, 0.15);
}

/* ── 7. OVERLAY ─────────────────────────────────────────────────────────── */
#nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 1040;
    pointer-events: none;
    transition: background var(--transition-bounce);
    -webkit-backdrop-filter: blur(0px);
    backdrop-filter: blur(0px);
}

#nav-overlay.active {
    background: rgba(0, 0, 0, 0.6);
    pointer-events: auto;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

/* ── 8. PAGE HEADER ─────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-left: 3.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent-blue);
    background: var(--accent-blue-subtle);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(41, 121, 255, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* ── 9. CARDS ───────────────────────────────────────────────────────────── */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-normal);
}

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

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    font-size: 1.75rem;
    background: var(--accent-blue-subtle);
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(41, 121, 255, 0.15);
}

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

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0.25rem 0;
    line-height: 1.2;
}

.stat-change {
    font-size: 0.85rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }
.stat-change.neutral { color: var(--text-sec); }

/* ── 10. CHART ──────────────────────────────────────────────────────────── */
.chart-section {
    margin-bottom: 2rem;
}

.chart-card {
    padding: 1.5rem 1rem;
}

.chart-placeholder {
    width: 100%;
    height: 120px;
    background: linear-gradient(180deg, rgba(41, 121, 255, 0.08) 0%, transparent 100%);
    border-bottom: 2px solid var(--accent-blue);
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 0 0.5rem 0.5rem;
    gap: 0.5rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.chart-placeholder .bar {
    flex: 1;
    max-width: 40px;
    background: linear-gradient(180deg, var(--accent-blue) 0%, var(--accent-blue-dim) 100%);
    border-radius: 4px 4px 0 0;
    height: var(--height, 50%);
    transition: height 0.5s ease, opacity var(--transition-fast);
    opacity: 0.75;
    cursor: pointer;
}

.chart-placeholder .bar:hover {
    opacity: 1;
}

.chart-labels {
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0.5rem 0;
    gap: 0.5rem;
}

.chart-labels span {
    flex: 1;
    max-width: 40px;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.chart-caption {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-sec);
}

/* ── 11. ACTIVITY LIST ──────────────────────────────────────────────────── */
.activity-section {
    margin-bottom: 2rem;
}

.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-item:first-child {
    padding-top: 0;
}

.activity-icon {
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.activity-title {
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.15rem;
}

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

.activity-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.activity-badge.success {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success);
}

.activity-badge.warning {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning);
}

.activity-badge.info {
    background: rgba(33, 150, 243, 0.15);
    color: var(--info);
}

.activity-badge.danger {
    background: rgba(244, 67, 54, 0.15);
    color: var(--danger);
}

/* ── 12. FORM ELEMENTS ──────────────────────────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
textarea,
select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

/* Buttons */
button:not(#hamburger) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--accent-blue);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    outline: none;
}

button:not(#hamburger):hover {
    background-color: var(--accent-blue-dim);
}

button:not(#hamburger):active {
    transform: scale(0.98);
}

button:not(#hamburger):focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

button.btn-secondary {
    background-color: var(--accent-blue-glow) !important;
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
}

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

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

button.btn-danger:hover {
    background-color: #d32f2f;
}

button.btn-full {
    width: 100%;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.button-group .btn {
    width: 100%;
}


/* Toggle Switch */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

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

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--border-subtle);
    transition: var(--transition-normal);
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition-normal);
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

input:checked + .slider {
    background-color: var(--accent-blue);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

input:focus-visible + .slider {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* ── 13. LOGIN PAGE ─────────────────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    padding-top: calc(1.5rem + var(--safe-area-top));
    padding-bottom: calc(1.5rem + var(--safe-area-bottom));
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem 1.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

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

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form input {
    margin-bottom: 0;
}

.login-msg {
    text-align: center;
    font-size: 0.85rem;
    min-height: 1.5rem;
    margin-top: 0.5rem;
}

/* ── 14. SETTINGS PAGE ──────────────────────────────────────────────────── */
.settings-section {
    margin-bottom: 2rem;
}

.settings-card {
    margin-bottom: 1rem;
}

.settings-card h3 {
    color: var(--text-main);
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-dim));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.profile-details h4 {
    color: var(--text-main);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.profile-details p {
    font-size: 0.85rem;
}

/* ── 15. UTILITIES ──────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden { display: none !important; }
.visible { display: block; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 16. TABLET (≥768px) - FIXED DESKTOP NAV ────────────────────────────── */
@media (min-width: 768px) {
    
    /* ─── HIDE MOBILE ELEMENTS ────────────────────────────────────────── */
    #hamburger {
        display: none;
    }

    #nav-overlay {
        display: none;
    }

    /* ─── COLLAPSED NAV - DEFAULT STATE ───────────────────────────────── */
    #smart-nav {
        transform: translateX(0);
        width: var(--nav-width-collapsed);
        overflow: visible;
    }

    /* Expand on hover */
    #smart-nav:hover {
        width: var(--nav-width-expanded);
    }

    /* ─── COLLAPSED: Hide text ────────────────────────────────────────── */
    #smart-nav .nav-label {
        opacity: 0;
        width: 0;
        overflow: hidden;
    }

    #smart-nav .nav-brand {
        opacity: 0;
        width: 0;
        overflow: hidden;
    }

    /* ─── COLLAPSED: Center header ────────────────────────────────────── */
    #smart-nav .nav-header {
        justify-content: center;
        padding: 0.875rem;
        gap: 0;
    }

    /* ─── COLLAPSED: Center nav items ─────────────────────────────────── */
    #smart-nav .nav-item {
        justify-content: center;
        padding: 0.375rem;
        margin: 0.25rem 0.875rem;
        gap: 0;
    }

    /* ─── EXPANDED: Show text ─────────────────────────────────────────── */
    #smart-nav:hover .nav-label {
        opacity: 1;
        width: auto;
    }

    #smart-nav:hover .nav-brand {
        opacity: 1;
        width: auto;
    }

    /* ─── EXPANDED: Restore header ────────────────────────────────────── */
    #smart-nav:hover .nav-header {
        justify-content: flex-start;
        padding: 1.25rem;
        gap: 0.75rem;
    }

    /* ─── EXPANDED: Restore nav items ─────────────────────────────────── */
    #smart-nav:hover .nav-item {
        justify-content: flex-start;
        padding: 0.5rem 1rem;
        margin: 0.125rem 0.5rem;
        gap: 0.75rem;
    }

    /* ─── MAIN CONTENT ────────────────────────────────────────────────── */
    main {
        margin-left: var(--nav-width-collapsed);
        padding: 2rem 2.5rem;
        padding-bottom: calc(2rem + var(--safe-area-bottom));
    }

    .page-header {
        padding-left: 0;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .stat-value {
        font-size: 2rem;
    }

    .chart-placeholder {
        height: 160px;
    }

    .chart-labels span {
        font-size: 0.8rem;
    }

    .login-card {
        max-width: 420px;
        padding: 2.5rem 2rem;
    }

    .button-group {
        flex-direction: row;
        gap: 1rem;
    }
    
    .button-group .btn {
        flex: 1;
        width: auto;
    }
}

/* ── 17. DESKTOP (≥1024px) ──────────────────────────────────────────────── */
@media (min-width: 1024px) {
    main {
        padding: 2.5rem 3rem;
    }

    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.6rem; }

    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .card {
        padding: 1.5rem;
    }

    .stat-icon {
        width: 56px;
        height: 56px;
        font-size: 2rem;
    }

    .stat-value {
        font-size: 2.25rem;
    }

    .chart-placeholder {
        height: 180px;
    }

    .chart-card {
        padding: 2rem 1.5rem;
    }

    .login-card {
        max-width: 450px;
        padding: 3rem 2.5rem;
        box-shadow: var(--shadow-lg);
    }
}

/* ── 18. WIDE DESKTOP (≥1280px) ─────────────────────────────────────────── */
@media (min-width: 1280px) {
    main {
        padding: 3rem 4rem;
    }

    .card {
        padding: 1.75rem;
    }

    .stat-value {
        font-size: 2.5rem;
    }

    .chart-placeholder {
        height: 200px;
    }

    .login-card {
        max-width: 480px;
        padding: 3.5rem 3rem;
    }
}

/* ── 19. ULTRA WIDE (≥1536px) ───────────────────────────────────────────── */
@media (min-width: 1536px) {
    main {
        padding: 3.5rem 5rem;
        max-width: 1600px;
        margin-left: auto;
        margin-right: auto;
        padding-left: calc(var(--nav-width-collapsed) + 5rem);
    }

    .dashboard-grid {
        gap: 2rem;
    }

    .card {
        padding: 2rem;
    }
}

/* ── 20. ACCESSIBILITY ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-blue);
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 0;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --border-subtle: #555555;
        --text-sec: #aaaaaa;
    }
    
    .card {
        border-width: 2px;
    }
}

/* ── 21. ANIMATIONS ─────────────────────────────────────────────────────── */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

.chart-placeholder .bar {
    animation: growBar 0.6s ease-out forwards;
    animation-delay: calc(var(--i, 0) * 0.08s);
}

.chart-placeholder .bar:nth-child(1) { --i: 1; }
.chart-placeholder .bar:nth-child(2) { --i: 2; }
.chart-placeholder .bar:nth-child(3) { --i: 3; }
.chart-placeholder .bar:nth-child(4) { --i: 4; }
.chart-placeholder .bar:nth-child(5) { --i: 5; }
.chart-placeholder .bar:nth-child(6) { --i: 6; }
.chart-placeholder .bar:nth-child(7) { --i: 7; }

@keyframes growBar {
    from {
        height: 0;
        opacity: 0;
    }
    to {
        height: var(--height, 50%);
        opacity: 0.75;
    }
}

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

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

/* ── 22. PRINT STYLES ───────────────────────────────────────────────────── */
@media print {
    #smart-nav,
    #hamburger,
    #nav-overlay {
        display: none !important;
    }

    main {
        margin-left: 0 !important;
        padding: 1rem !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }

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

    .page-header {
        padding-left: 0 !important;
    }
}