/* --- 1. Variables & Base --- */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --dark: #1e293b;
    --dark-sidebar: #0f172a;
    --light-bg: #f8f9fa;
    --border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #9ca3af; /* Lighter grey as requested */
    --sidebar-width: 260px;
    --header-height: 70px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
}

/* --- 2. Layout Structure --- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: all 0.3s ease;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1045;
}
.sidebar-overlay.active { display: block; }

/* --- 3. Sidebar Navigation --- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    background: var(--dark-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: transform 0.3s ease-in-out;
}

.brand { 
    padding: 2rem 1.5rem;
    font-size: 1.5rem; 
    font-weight: 800; 
    color: white; 
    letter-spacing: -0.025em; 
}
.brand span { color: var(--primary); }

.sidebar-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    padding: 0 1.5rem;
    margin: 1.5rem 0 0.5rem 0;
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    gap: 12px;
}

.nav-link i { width: 20px; text-align: center; margin-right: 0 !important; } /* Fix icon spacing */
.nav-link:hover, .nav-link.active { 
    background: rgba(255, 255, 255, 0.05); 
    color: white; 
    border-left: 3px solid var(--primary);
}

/* --- 4. Mobile Top Bar --- */
.mobile-nav {
    display: none;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1040;
    align-items: center;
    justify-content: space-between;
}

.mobile-nav .brand { padding: 0; line-height: 1; color: var(--dark-sidebar); }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 20px; margin-top: var(--header-height); }
    .mobile-nav { display: flex; }
}

/* --- 5. FIXED FILTER BARS --- */
.filter-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

/* Base row logic */
.filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end; /* Snaps everything to the bottom baseline */
    gap: 12px;
}

.filter-item {
    flex: 1;
    min-width: 140px;
}

/* Fixed width for the reset/action buttons so they don't grow */
.filter-item-sm {
    flex: 0 0 44px; 
}

.filter-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 8px; /* Space between label and input */
    letter-spacing: 0.05em;
    line-height: 1;
}

/* Force every input, select, and button to be EXACTLY the same height */
.filter-control, 
.filter-btn,
.filter-row .btn {
    height: 44px !important;
    border-radius: 8px !important;
    border: 1px solid var(--border);
    width: 100%;
    padding: 0 12px;
    background-color: white;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

/* Mobile stacking */
@media (max-width: 991px) {
    .filter-item { flex: 1 1 45%; }
    .filter-item-sm { flex: 1 1 100%; }
}

/* --- 6. Cards & UI Components --- */
.card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
}
.stat-card.clickable:hover { transform: translateY(-3px); border-color: var(--primary); }
.stat-card .value { font-size: 1.75rem; font-weight: 700; color: var(--dark); margin-top: 5px; }

/* Tabs */
.nav-tabs { border-bottom: 1px solid var(--border); }
.nav-tabs .nav-link {
    color: var(--text-muted);
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 500;
}
.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    background: none;
}

/* --- 7. Table & Stackable logic --- */
.table { width: 100%; border-collapse: collapse; }
.table th { 
    text-align: left; padding: 1rem; 
    border-bottom: 2px solid var(--border); 
    font-size: 0.7rem; text-transform: uppercase; 
    color: #64748b; font-weight: 700; 
}
.table td { padding: 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }

.hover-row:hover { background-color: #f8fafc !important; cursor: pointer; }

@media (max-width: 767.98px) {
    .stackable thead { display: none; }
    .stackable tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 1rem;
        padding: 10px;
        background: white;
    }
    .stackable td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none !important;
        padding: 8px 5px !important;
        text-align: right;
    }
    .stackable td::before {
        content: attr(data-label);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.6rem;
        color: var(--text-muted);
    }
    .stackable .btn-group { width: 100%; }
}

/* --- 8. Utilities --- */
.text-muted { color: var(--text-muted) !important; }
.cursor-pointer { cursor: pointer; }
.transition-icon { transition: transform 0.2s; }
.progress { background-color: #f1f5f9; overflow: hidden; }

/* --- FIXED AUTH / LOGIN STYLES --- */
.auth-wrapper {
    background-color: #0f172a; /* Deep navy background */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-card .brand {
    font-size: 2.25rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.5rem;
    color: #1e293b;
    letter-spacing: -1.5px;
    display: block;
}

.auth-card .brand span {
    color: #6366f1;
}

/* Forces Labels to sit ABOVE inputs */
.auth-card .form-label {
    display: block !important; 
    width: 100%;
    font-weight: 600;
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 8px;
    text-align: left;
}

/* Makes Inputs look modern and fill the width */
.auth-card .form-control {
    display: block !important;
    width: 100% !important;
    height: 50px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background-color: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    transition: all 0.2s ease;
}

.auth-card .form-control:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background-color: #ffffff;
}

/* Professional Purple Button */
.auth-card .btn-primary {
    display: flex !important;
    width: 100% !important;
    height: 54px;
    background-color: #6366f1;
    color: white !important;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 12px;
    border: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-card .btn-primary:hover {
    background-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}