:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1a1d2e;
    --sidebar-bg-hover: #262a41;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --topbar-h: 64px;
    --body-bg: #f4f6fb;
    --card-radius: 12px;
}

* { box-sizing: border-box; }

body {
    background: var(--body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #2b2d42;
}

/* ---------- Login Page ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #818cf8 100%);
}
.login-wrapper { width: 100%; max-width: 420px; padding: 20px; }
.login-card { border: none; border-radius: 16px; }
.login-logo {
    width: 64px; height: 64px; border-radius: 16px;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; margin: 0 auto;
}
.captcha-img { border-radius: 8px; border: 1px solid #dee2e6; height: 50px; }

/* ---------- App Shell ---------- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #cfd2e3;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1040;
    transition: transform 0.25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px;
    color: #fff; font-weight: 700; font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand i { color: var(--primary); font-size: 1.4rem; }
.sidebar-nav { padding: 12px; list-style: none; margin: 0; }
.sidebar-nav .nav-link {
    color: #cfd2e3;
    padding: 11px 14px;
    border-radius: 8px;
    margin-bottom: 3px;
    display: flex; align-items: center; gap: 12px;
    font-size: 0.92rem;
    transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav .nav-link i { width: 18px; text-align: center; opacity: 0.9; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-bg-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--primary); color: #fff; }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid #e9ecf2;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 22px;
    position: sticky; top: 0; z-index: 1030;
}
.topbar .page-title { font-weight: 600; font-size: 1.15rem; margin: 0; }
.sidebar-toggle-btn { display: none; background: none; border: none; font-size: 1.3rem; color: #444; }

.content-area { padding: 24px; flex: 1; }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1035;
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle-btn { display: inline-block; }
    .sidebar-overlay.show { display: block; }
}

/* ---------- Cards / Stats ---------- */
.stat-card {
    border: none; border-radius: var(--card-radius);
    background: #fff; padding: 20px;
    box-shadow: 0 2px 10px rgba(20,20,60,0.05);
    display: flex; align-items: center; gap: 16px;
    height: 100%;
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: #fff; flex-shrink: 0;
}
.stat-value { font-size: 1.5rem; font-weight: 700; margin: 0; line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: #8a8d9f; margin: 0; }

.card {
    border: none; border-radius: var(--card-radius);
    box-shadow: 0 2px 10px rgba(20,20,60,0.05);
}
.card-header {
    background: #fff; border-bottom: 1px solid #eef0f5;
    font-weight: 600; border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
}

.table { margin-bottom: 0; }
.table thead th {
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em;
    color: #8a8d9f; border-bottom-width: 1px; font-weight: 600;
    background: #fafbfe;
}
.table td, .table th { vertical-align: middle; padding: 12px 14px; }

.badge-status { font-weight: 500; padding: 5px 10px; font-size: 0.75rem; }

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

.quick-action-btn {
    border-radius: 10px; padding: 14px; text-align: center;
    background: #fff; border: 1px solid #eef0f5; color: #2b2d42;
    display: block; text-decoration: none; transition: all 0.15s ease;
}
.quick-action-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.quick-action-btn i { font-size: 1.4rem; display: block; margin-bottom: 6px; }

.avatar-sm {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; background: #e9ecf2;
}
.avatar-placeholder {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.85rem;
}

.student-photo-lg {
    width: 100px; height: 100px; border-radius: 12px; object-fit: cover; background: #e9ecf2;
}

.form-label { font-weight: 500; font-size: 0.88rem; }
.section-title { font-weight: 600; font-size: 1rem; margin-bottom: 14px; color: #2b2d42; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }

@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; }
}
