:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-dark);
    color: #fff;
    padding: 0 16px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .brand { font-weight: 600; font-size: 18px; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.menu-toggle { display: none; background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; }

.app-body { display: flex; flex: 1; }

.sidebar {
    width: 230px;
    background: #111827;
    color: #d1d5db;
    padding: 16px 0;
    flex-shrink: 0;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
    display: block;
    padding: 10px 20px;
    color: #d1d5db;
    font-size: 14px;
}
.sidebar li a:hover { background: #1f2937; color: #fff; text-decoration: none; }

.content { flex: 1; padding: 24px; max-width: 100%; overflow-x: auto; }

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.login-card {
    background: #fff;
    padding: 32px;
    border-radius: var(--radius);
    width: 360px;
    box-shadow: 0 10px 25px rgba(0,0,0,.2);
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p.sub { color: var(--muted); margin-top: 0; margin-bottom: 20px; font-size: 13px; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat-card { text-align: center; }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary-dark); }
.stat-card .label { color: var(--muted); font-size: 13px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; color: var(--text); }
.form-control, select, textarea, input[type=text], input[type=password], input[type=email],
input[type=number], input[type=date] {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}
textarea { resize: vertical; min-height: 70px; }

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }
.btn-outline { background: transparent; border: 1px solid #fff; color: #fff; }
.btn-outline:hover { background: rgba(255,255,255,.15); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { background: #f9fafb; font-weight: 600; }
tr:hover td { background: #f9fafb; }

.badge { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }

.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }

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

.tag { display: inline-block; margin-right: 6px; }

.quiz-question { border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.quiz-timer { font-weight: 700; color: var(--danger); font-size: 18px; }

.report-card-sheet { background: #fff; padding: 24px; border: 1px solid var(--border); max-width: 800px; margin: auto; }
.report-card-sheet table { margin-top: 12px; }

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

@media (max-width: 800px) {
    .menu-toggle { display: block; }
    .sidebar { position: fixed; left: -230px; top: 56px; bottom: 0; transition: left .2s ease; z-index: 9; }
    .sidebar.open { left: 0; }
}
