:root {
    --sidebar-width: 240px;
    --brand: #4f46e5;
    --brand-dark: #3730a3;
}

body {
    background: #f4f6fb;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--brand-dark), var(--brand));
    color: #fff;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.25rem 1rem;
    font-weight: 700;
    font-size: 1.05rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 0.5rem;
}

.sidebar-nav a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    padding: 0.65rem 0.85rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.92rem;
    margin-bottom: 0.15rem;
    transition: background 0.15s ease;
}

.sidebar-nav a i {
    width: 1.1rem;
    text-align: center;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar-nav a.active {
    background: #fff;
    color: var(--brand-dark);
    font-weight: 600;
}

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

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

.content {
    padding: 1.5rem;
    flex: 1;
}

.notification-menu {
    min-width: 280px;
    max-height: 320px;
    overflow-y: auto;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        left: -100%;
        z-index: 1050;
        transition: left 0.2s ease;
    }
    .sidebar.open {
        left: 0;
    }
}

/* ---------- Stat cards ---------- */
.stat-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--brand);
    height: 100%;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-card .stat-label {
    color: #6b7280;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-card .stat-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.stat-card.border-success { border-left-color: #198754; }
.stat-card.border-danger { border-left-color: #dc3545; }
.stat-card.border-warning { border-left-color: #ffc107; }
.stat-card.border-info { border-left-color: #0dcaf0; }
.stat-card.border-primary { border-left-color: #4f46e5; }
.stat-card.border-secondary { border-left-color: #6c757d; }

.chart-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ---------- Fingerprint scanner kiosk ---------- */
.kiosk-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #312e81, #0f172a 65%);
    color: #fff;
    padding: 2rem;
}

.scanner-panel {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1.25rem;
    padding: 2.5rem 2rem;
    text-align: center;
    backdrop-filter: blur(6px);
}

.scanner-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin: 1.5rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    background: rgba(79, 70, 229, 0.25);
    border: 3px solid #4f46e5;
    transition: all 0.25s ease;
    cursor: pointer;
}

.scanner-circle.scanning {
    animation: pulse 1s infinite ease-in-out;
    border-color: #facc15;
    background: rgba(250, 204, 21, 0.18);
}

.scanner-circle.success {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.2);
}

.scanner-circle.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 18px rgba(250, 204, 21, 0); }
}

.face-video-frame {
    width: 220px;
    height: 165px;
    margin: 0.5rem auto 1rem;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 3px solid #4f46e5;
    background: #000;
}

.face-video-frame.video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* mirror, like a selfie camera */
}

.face-video-frame.face-enroll-frame {
    width: 260px;
    height: 320px;
    border-radius: 44% 56% 54% 46% / 60% 40% 60% 40%;
    border: 3px solid #4f46e5;
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.16);
    position: relative;
}

.face-video-frame.face-enroll-frame::after {
    content: '';
    position: absolute;
    inset: 12px;
    border: 2px solid rgba(255, 255, 255, 0.42);
    border-radius: inherit;
    pointer-events: none;
}

.face-video-frame.face-enroll-frame.enrolling {
    border-color: #f59e0b;
    box-shadow: 0 12px 30px rgba(245, 158, 11, 0.22);
}

.face-video-frame video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* mirror, like a selfie camera */
}

.face-enroll-hint {
    min-height: 2.6rem;
    line-height: 1.4;
}

.scanner-status {
    font-size: 1.1rem;
    font-weight: 600;
    min-height: 1.6rem;
}

.scanner-clock {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Enrollment mini-scanner used on the teacher create/edit forms */
.enroll-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: #eef2ff;
    border: 2px solid var(--brand);
    color: var(--brand);
    cursor: pointer;
}

.enroll-circle.scanning { animation: pulse 1s infinite ease-in-out; }
.enroll-circle.done { border-color: #198754; color: #198754; background: #ecfdf3; }
