:root {
    --primary: #4f90a3;
    --primary-dark: #32697a;
    --accent: #f4b942;
    --bg: #f4f7f9;
    --text: #17242a;
    --muted: #647680;
    --border: #d9e3e8;
    --white: #ffffff;
    --danger: #d84343;
    --success: #14885d;
    --warning: #b77700;
    --info: #2d78a7;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: linear-gradient(180deg, var(--primary-dark), #244f5c); color: white; padding: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.brand-logo { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: rgba(255,255,255,.16); font-weight: 800; }
.brand span { display: block; font-size: 12px; opacity: .82; margin-top: 4px; }
.nav { display: grid; gap: 8px; }
.nav a { padding: 11px 13px; border-radius: 12px; color: rgba(255,255,255,.9); }
.nav a:hover { background: rgba(255,255,255,.13); }
.content { flex: 1; padding: 22px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; background: var(--white); padding: 14px 18px; border-radius: 18px; margin-bottom: 18px; box-shadow: 0 8px 30px rgba(18,54,64,.08); }
.topbar span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.today { color: var(--muted); }
.page-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 16px; }
.page-title h1 { margin: 0; font-size: 28px; }
.card, .panel { background: var(--white); border-radius: 18px; padding: 18px; box-shadow: 0 8px 30px rgba(18,54,64,.08); margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { border-left: 5px solid var(--primary); }
.stat .value { font-size: 32px; font-weight: 800; }
.stat .label { color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 12px; background: var(--primary); color: white; padding: 10px 14px; font-weight: 700; cursor: pointer; font-size: 14px; }
.btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #e6eef2; color: #20323a; }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }
.btn.warning { background: var(--warning); }
.btn.small { padding: 6px 9px; border-radius: 9px; font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-group { margin-bottom: 14px; }
label { display: block; font-weight: 700; margin-bottom: 7px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; font: inherit; background: white; }
textarea { min-height: 88px; resize: vertical; }
.help { color: var(--muted); font-size: 13px; margin-top: 6px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 13px; color: var(--muted); background: #f8fbfc; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; color: white; font-size: 12px; font-weight: 700; }
.badge-success { background: var(--success); }
.badge-warning { background: var(--warning); }
.badge-danger { background: var(--danger); }
.badge-info { background: var(--info); }
.badge-primary { background: var(--primary); }
.badge-secondary { background: #7b8a91; }
.alert { padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; background: #e8f0f3; }
.alert-success { background: #e3f6ed; color: #0e6544; }
.alert-danger { background: #fde7e7; color: #9d2323; }
.alert-warning { background: #fff2d7; color: #8c5a00; }
.alert-info { background: #e6f3fb; color: #245e80; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.login-card { width: 100%; max-width: 420px; background: white; border-radius: 22px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.login-card h1 { margin-top: 0; }
.scan-box { text-align: center; padding: 28px; }
.scan-input { font-size: 28px; text-align: center; letter-spacing: 1px; font-weight: 800; }
.scan-result { display: grid; place-items: center; gap: 8px; padding: 18px; border-radius: 18px; background: #f8fbfc; }
.camera-box video { width: 100%; max-width: 520px; border-radius: 18px; background: #111; }
.print-toolbar { margin: 16px 0; }
.student-card-wrap { display: inline-block; margin: 10px; }
.student-card { width: 9cm; height: 5.7cm; border-radius: 14px; overflow: hidden; background: #fff; position: relative; box-shadow: 0 8px 24px rgba(0,0,0,.18); border: 1px solid #dfe8ed; color: #111; }
.student-card .card-header { height: 1.28cm; background: var(--primary); color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 .28cm; }
.student-card .mini-logo { width: .82cm; height: .82cm; border-radius: 50%; background: rgba(255,255,255,.95); color: var(--primary-dark); display: grid; place-items: center; font-size: 9px; font-weight: 900; text-align: center; }
.student-card .school-text { text-align: center; line-height: 1.05; font-weight: 800; font-size: 10px; flex: 1; padding: 0 .14cm; }
.student-card .school-text span { display: block; font-size: 8px; font-weight: 600; margin-top: 2px; }
.student-card .card-body { display: grid; grid-template-columns: 2.25cm 1fr; gap: .22cm; padding: .22cm .28cm; }
.student-card .photo { width: 2.15cm; height: 2.72cm; object-fit: cover; border-radius: 7px; border: 1px solid #d5e1e6; }
.student-card .title { color: var(--primary-dark); text-align: center; font-size: 17px; font-weight: 900; letter-spacing: 1px; margin-bottom: .08cm; }
.student-card .data { font-size: 9.4px; line-height: 1.35; }
.student-card .data strong { display: inline-block; width: 1.65cm; }
.student-card .barcode-area { position: absolute; left: .28cm; right: .28cm; bottom: .18cm; display: grid; grid-template-columns: 2.25cm 1fr; gap: .25cm; align-items: end; }
.student-card .valid { font-size: 8.5px; color: #222; }
.student-card .valid strong { display: block; font-size: 11px; }
.student-card .barcode { width: 100%; height: .62cm; display: block; }
.student-card .barcode-text { font-size: 7px; letter-spacing: 1px; text-align: center; margin-top: 1px; }
.cards-grid-print { display: flex; flex-wrap: wrap; gap: 12px; }
@media (max-width: 960px) {
    .app-shell { display: block; }
    .sidebar { position: relative; width: auto; height: auto; }
    .grid-4, .grid-3, .form-row { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; gap: 12px; }
}
@media print {
    body { background: white; }
    .sidebar, .topbar, .print-toolbar, .no-print, .alert, .page-title { display: none !important; }
    .content { padding: 0; }
    .card, .panel { box-shadow: none; padding: 0; margin: 0; }
    .student-card { box-shadow: none; break-inside: avoid; margin: 0; }
    .student-card-wrap { margin: 6px; break-inside: avoid; }
}
.inline-form { display: inline-flex; margin: 0; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
