:root {
    --primary: #31bed0;
    --primary-dark: #29a8b9;
    --primary-light: #e6f7f9;
    --secondary: #4b8fbc;
    --dark: #0f172a;
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --white: #ffffff;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    --sidebar-width: 260px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--slate-50);
    color: var(--slate-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--slate-900);
    color: var(--white);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header i {
    color: var(--primary);
    font-size: 1.5rem;
}

.sidebar-header span {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.sidebar-menu {
    flex: 1;
    padding: 0 1rem;
    overflow-y: auto;
}

.menu-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--slate-500);
    letter-spacing: 0.05em;
    margin: 1.5rem 0 0.5rem 0.75rem;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--slate-400);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
}

.menu-link:hover {
    background-color: var(--slate-800);
    color: var(--white);
}

.menu-link.active {
    background-color: var(--primary);
    color: var(--white);
}

.menu-link i {
    width: 20px;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--slate-800);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2.5rem;
}

/* Header Nav */
.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-title h1 {
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--slate-900);
}

.page-title p {
    color: var(--slate-500);
    font-size: 0.95rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--slate-200);
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--white);
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--slate-800);
}

.card-body {
    padding: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    height: 42px;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--slate-300);
    font-size: 0.95rem;
    color: var(--slate-900);
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: var(--white);
    display: block;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
}

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

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

.btn-outline {
    border-color: var(--slate-300);
    background-color: var(--white);
    color: var(--slate-700);
}

.btn-outline:hover {
    background-color: var(--slate-50);
    border-color: var(--slate-400);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.modern-table th {
    background-color: var(--slate-50);
    padding: 0.875rem 1.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--slate-600);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--slate-200);
}

.modern-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--slate-100);
    color: var(--slate-700);
    vertical-align: middle;
}

.modern-table tr:hover td {
    background-color: var(--slate-50);
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending { background-color: #fef3c7; color: #92400e; }
.badge-submitted { background-color: #dcfce7; color: #166534; }
.badge-reviewed { background-color: #e0f2fe; color: #075985; }
.badge-late { background-color: #fee2e2; color: #991b1b; }

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-data h3 {
    font-size: 0.8rem;
    color: var(--slate-500);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-data .value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--slate-900);
}

/* Mobile Navigation Bar (TOP) */
.mobile-header {
    display: none; /* Hidden on Desktop */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--slate-900);
    color: white;
    z-index: 1000;
    padding: 0 1.5rem;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--slate-800);
}

.mobile-toggle {
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .mobile-header {
        display: flex;
    }

    .sidebar {
        left: -100%; /* Hide sidebar off-screen */
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
        top: 60px;
        height: calc(100vh - 60px);
        box-shadow: 20px 0 50px rgba(0,0,0,0.3);
        z-index: 999;
    }
    
    .sidebar.show {
        left: 0; /* Slide in when .show class is added via JS */
    }

    .sidebar-header {
        display: none !important; /* Hide redundant logo on mobile */
    }

    .main-content {
        margin-left: 0 !important;
        width: 100%;
        padding: 5rem 0.75rem 2rem 0.75rem !important; /* Slightly tighter edges */
    }

    /* Hide sidebar text if NOT in mobile toggle mode? No, on mobile we want full sidebar when open. */
    .sidebar.show .sidebar-header span, 
    .sidebar.show .menu-group-label, 
    .sidebar.show .menu-link span {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .header-nav {
        margin-bottom: 1.25rem;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    .hide-mobile {
        display: none !important;
    }
    
    .page-title h1, h1 {
        font-size: 1.35rem !important;
        letter-spacing: -0.5px !important;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem 1.25rem !important;
    }

    .card-body {
        padding: 1rem !important;
    }

    .stat-card {
        padding: 1rem !important;
        gap: 0.75rem !important;
    }
    
    .stat-icon {
        width: 38px !important;
        height: 38px !important;
        font-size: 1rem !important;
        border-radius: 10px !important;
    }
    
    .stat-data h3 {
        font-size: 0.7rem !important;
    }
    
    .stat-data .value {
        font-size: 1.25rem !important;
    }

    /* Transform Tables into Mobile Cards */
    .table-responsive {
        border: none;
    }
    
    .modern-table, .modern-table tbody, .modern-table tr, .modern-table td {
        display: block;
        width: 100%;
    }
    
    .modern-table thead {
        display: none; /* Hide confusing horizontal headers */
    }
    
    .modern-table tr {
        margin-bottom: 1.25rem;
        border: 1px solid var(--slate-200);
        border-radius: var(--radius-md);
        padding: 1.25rem;
        background: var(--white);
        box-shadow: var(--shadow-sm);
    }
    
    .modern-table td {
        border: none;
        padding: 0.5rem 0;
        text-align: left !important;
        position: relative;
    }
    
    .modern-table td[style*="text-align: right"], 
    .modern-table td:last-child {
        text-align: left !important;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px dashed var(--slate-200);
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .btn {
        width: 100%; /* Full width buttons on mobile */
        justify-content: center;
    }
    
    .btn.badge {
        width: auto;
    }
}

/* --- Global Responsive Layout Utilities --- */
.responsive-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    align-items: flex-end;
}

.responsive-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
}

.responsive-grid-dept {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 1rem;
    align-items: flex-end;
}

.responsive-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1.5rem;
}

/* Tablet Overrides */
@media (max-width: 1024px) {
    .responsive-grid-2 {
        gap: 1.5rem;
    }
}

/* Mobile Overrides */
@media (max-width: 768px) {
    .responsive-grid-3,
    .responsive-grid-2,
    .responsive-grid-dept {
        grid-template-columns: 1fr !important;
        gap: 1rem;
        align-items: stretch;
    }

    .responsive-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .responsive-header > div {
        width: 100%;
        text-align: left !important;
    }
}
