:root {
    --sidebar-width: 240px;
    --primary: #1f4e96;
    --primary-dark: #163a71;
    --sidebar-bg: #1b2a47;
    --sidebar-hover: #2a3d63;
}

* { box-sizing: border-box; }

body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #f3f5f9; }

.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cfd8e5;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 18px 20px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand i { margin-right: 8px; color: #ffd166; }
.sidebar-nav { padding: 10px 0; }
.sidebar-nav .nav-link {
    display: block;
    padding: 9px 20px;
    color: #cfd8e5;
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
}
.sidebar-nav .nav-link i { width: 20px; margin-right: 6px; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: #ffd166;
}
.sidebar-nav .nav-heading {
    padding: 14px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7e8aa0;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: #fff;
    padding: 10px 20px;
    border-bottom: 1px solid #e5e9f0;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.content { padding: 22px; flex: 1; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.page-header h1 { font-size: 22px; font-weight: 600; margin: 0; color: #1b2a47; }

.card-stat {
    border-radius: 10px;
    padding: 18px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 14px;
}
.card-stat .stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff;
}
.card-stat .stat-icon.blue   { background: linear-gradient(135deg, #3b82f6, #1e40af); }
.card-stat .stat-icon.green  { background: linear-gradient(135deg, #10b981, #047857); }
.card-stat .stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #b45309); }
.card-stat .stat-icon.red    { background: linear-gradient(135deg, #ef4444, #991b1b); }
.card-stat .stat-label { color: #6b7280; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.card-stat .stat-value { font-size: 22px; font-weight: 600; color: #1b2a47; }

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

table { background: #fff; }
.table thead th { background: #f6f8fb; font-weight: 600; color: #4a5568; font-size: 13px; }

/* Auth */
.auth-body { background: linear-gradient(135deg, #1b2a47, #3b5998); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: #fff; border-radius: 12px; padding: 36px 32px; width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand i { font-size: 40px; color: #1f4e96; }
.auth-brand-text { font-size: 20px; font-weight: 600; color: #1b2a47; margin-top: 4px; }

/* Attendance marking */
.att-row { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid #eee; }
.att-row .att-name { flex: 1; }
.att-row input[type=radio] { margin-right: 4px; }

/* Challan print */
@media print {
    .sidebar, .topbar, .no-print, .btn { display: none !important; }
    .main { margin: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #fff; }
}
.challan-copy {
    border: 2px solid #000;
    padding: 10px;
    margin-bottom: 8px;
    page-break-inside: avoid;
}
.challan-copy h4 { margin: 0 0 6px; font-size: 13px; text-align: center; }
.challan-copy table { width: 100%; font-size: 12px; border-collapse: collapse; }
.challan-copy table td { padding: 3px 6px; }

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; top: 0; left: -240px; height: 100vh; z-index: 100; transition: left .2s;
    }
    body.sidebar-open .sidebar { left: 0; }
    .main { width: 100%; }
}

.badge-status-active { background: #d1fae5; color: #065f46; }
.badge-status-inactive { background: #fee2e2; color: #991b1b; }
.badge-paid    { background: #d1fae5; color: #065f46; }
.badge-unpaid  { background: #fee2e2; color: #991b1b; }
.badge-partial { background: #fef3c7; color: #92400e; }
