:root {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-color: #0f172a;
    --text-muted: #64748b;
    --primary-color: #f97316;
    /* Warm Orange */
    --primary-gradient: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
    /* Orange to Red */
    --accent-color: #f59e0b;
    /* Amber */
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --glass-border: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] {
    --bg-color: #020617;
    --card-bg: rgba(15, 23, 42, 0.8);
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #1e293b;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    --glass-border: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
}

body {
    margin: 0;
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(249, 115, 22, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(239, 68, 68, 0.05) 0px, transparent 50%);
    min-height: 100vh;
}

/* Sidebar Refinement */
.sidebar {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
}

.nav-links a {
    padding: 0.875rem 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--primary-gradient);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.logo-container h2 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    font-size: 1.6rem;
    font-weight: 900;
}

.slogan {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 5px;
    letter-spacing: 0.5px;
    font-style: italic;
}

/* Layout spacing optimization */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.content {
    padding: 2rem;
}

.header {
    margin-bottom: 2rem;
}

/* Glass & Cards */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
}

.card {
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* Footer */
.main-footer {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Sidebar Navigation Refinement */
.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.nav-item:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

/* Period Picker Pills */
.period-picker {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.4rem;
    border-radius: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.period-btn {
    padding: 0.6rem 1.25rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.period-btn:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.period-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Sticky Mobile Nav */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    height: 70px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(25px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 9999;
    /* Force visibility */
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 600;
}

.mobile-nav-item.active {
    color: var(--primary-color);
}

.mobile-nav-item i {
    font-size: 1.2rem;
}

/* Logo & Footer Refinement */
.logo-container img {
    width: 200px !important;
    height: 200px !important;
    border-radius: 32px !important;
}

.slogan {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 800;
    margin-top: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.4;
}

/* Stat Cards Refinement */
.stat-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-left-width: 8px !important;
    /* Thick as per screenshot */
    border-left-style: solid !important;
}

.stat-card span[style*="font-size: 0.875rem"] {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 800 !important;
    opacity: 0.8;
}

.trend-up,
.trend-down {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 700;
}

.trend-up {
    color: var(--success-color);
}

.trend-down {
    color: var(--danger-color);
}

/* Sidebar Footer & Logout */
.sidebar-footer {
    background: rgba(0, 0, 0, 0.02);
    margin-top: auto;
    /* Push to bottom if space allows */
}

.logout-link:hover {
    color: #ff3333 !important;
    transform: translateX(3px);
}

.logout-link i {
    transition: transform 0.3s ease;
}

.logout-link:hover i {
    transform: scale(1.2);
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none !important;
    }

    .mobile-header {
        display: flex !important;
    }

    .content {
        padding: 1.25rem !important;
        margin-bottom: 90px;
    }

    .mobile-nav {
        display: flex;
    }

    /* Table Mobile Fixes */
    table th,
    table td {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.85rem !important;
    }

    .stat-card {
        padding: 1.25rem !important;
        border-left-width: 4px !important;
        /* Thinner on mobile to save space */
    }

    .card {
        padding: 1.25rem !important;
    }

    /* Better touch targets for buttons */
    td a i {
        padding: 8px;
        font-size: 1.2rem !important;
    }
}