/* ==========================================================================
   Điểm danh an toàn — UI
   Visual reference: "Smart Locker Delivery Tracker App UI" (Dribbble).
   Two distinct layouts, not one squeezed layout:
     - Mobile  (< 900px): app shell, sticky header, floating bottom nav, full-screen scan sheet
     - Desktop (>= 900px): fixed sidebar + multi-column dashboard, scan sheet as a centered dialog
   Icons: Heroicons (MIT) sprite /vendor/icons.svg. uiverse.io elements (MIT) are credited inline.
   ========================================================================== */

:root {
  --bg: #f2f3f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #111318;
  --ink-2: #3b3f47;
  --muted: #8a8f99;
  --line: #eceef2;
  --blue: #1f7bff;
  --blue-600: #1663d6;
  --blue-50: #e9f2ff;
  --ok: #17a34a;
  --ok-50: #e7f7ed;
  --warn: #b7791f;
  --warn-50: #fff5e0;
  --bad: #e5484d;
  --bad-50: #fdecec;
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(17, 19, 24, .04), 0 10px 30px rgba(17, 19, 24, .06);
  --shadow-lg: 0 20px 60px rgba(17, 19, 24, .18);
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.i { width: 22px; height: 22px; flex: none; display: inline-block; vertical-align: middle; }
.i-sm { width: 18px; height: 18px; }
.i-lg { width: 28px; height: 28px; }

/* ---------- Buttons ---------- */
button, .btn {
  font: inherit; cursor: pointer; border: 0; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 12px 20px; font-weight: 600;
  background: var(--ink); color: #fff; transition: transform .12s, background .15s, box-shadow .15s;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-blue { background: var(--blue); }
.btn-blue:hover { background: var(--blue-600); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad); }
.btn-warn { background: #f5a524; color: #1d1300; }
.btn-block { width: 100%; padding: 15px 20px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.icon-btn {
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
}
.icon-btn:hover { background: var(--surface-2); }
.link-btn { background: none; color: var(--blue); padding: 4px 6px; border-radius: 8px; font-weight: 600; }

/* ---------- Inputs ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-wrap .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 13px 14px;
}
.input-wrap input { padding-left: 44px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; background: #fff; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 17px; font-weight: 700; }
.section-title { font-size: 17px; font-weight: 700; margin: 22px 4px 12px; }

/* "Hurry up" style card: dark strip on top of an inset white panel */
.alert-card { border-radius: var(--r-lg); background: var(--ink); padding: 4px; box-shadow: var(--shadow); }
.alert-card .strip { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 13px; padding: 10px 14px 9px; }
.alert-card .strip .i { width: 18px; height: 18px; }
.alert-card .strip .end { margin-left: auto; opacity: .8; }
.alert-card .panel { background: var(--surface); border-radius: calc(var(--r-lg) - 4px); padding: 14px; }
.alert-card.warn { background: #2b2108; }
.alert-card.ok { background: var(--ink); }

.item { display: flex; align-items: center; gap: 14px; }
.item .thumb {
  width: 58px; height: 58px; border-radius: var(--r-md); flex: none;
  display: grid; place-items: center; background: var(--blue-50); color: var(--blue);
  border: 1px solid #d8e7ff;
}
.item .thumb.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.item .meta { min-width: 0; flex: 1; }
.item .title { font-weight: 700; font-size: 16px; line-height: 1.3; }
.item .sub { color: var(--muted); font-size: 13px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
  padding: 3px 10px; border-radius: 999px;
}
.chip.ok { background: var(--ok-50); color: var(--ok); border-color: #cdeed8; }
.chip.warn { background: var(--warn-50); color: var(--warn); border-color: #f6e2b8; }
.chip.bad { background: var(--bad-50); color: var(--bad); border-color: #f8d0d1; }
.chip.blue { background: var(--blue-50); color: var(--blue); border-color: #d8e7ff; }

/* Status badges (also used by JS) */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.VALID, .badge.active { background: var(--ok-50); color: var(--ok); }
.badge.SUSPICIOUS, .badge.pending { background: var(--warn-50); color: var(--warn); }
.badge.ABSENT, .badge.revoked, .badge.REJECTED { background: var(--bad-50); color: var(--bad); }

/* Big result box */
.result { border-radius: var(--r-lg); padding: 18px; border: 1.5px solid; display: flex; gap: 14px; align-items: flex-start; }
.result .r-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.result .r-body { min-width: 0; }
.result .big { font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.result code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; font-weight: 700; }
.result.VALID { background: var(--ok-50); border-color: #bfe8cd; color: #0f6b32; }
.result.VALID .r-icon { background: var(--ok); }
.result.SUSPICIOUS { background: var(--warn-50); border-color: #f3dca8; color: #7a5210; }
.result.SUSPICIOUS .r-icon { background: #f5a524; }
.result.REJECTED { background: var(--bad-50); border-color: #f6c9cb; color: #a3262a; }
.result.REJECTED .r-icon { background: var(--bad); }
.result.INFO { background: var(--blue-50); border-color: #cfe2ff; color: var(--blue-600); }
.result.INFO .r-icon { background: var(--blue); }

/* Blue promo banner */
.banner {
  position: relative; overflow: hidden; border-radius: var(--r-lg); color: #fff; padding: 22px;
  background: radial-gradient(120% 140% at 100% 0%, #5aa2ff 0%, #1f7bff 45%, #1557c9 100%);
  box-shadow: 0 16px 40px rgba(31, 123, 255, .28);
}
.banner .eyebrow { font-size: 12px; opacity: .85; }
.banner h3 { font-size: 24px; line-height: 1.15; font-weight: 800; margin: 4px 0 10px; }
.banner h3 span { font-weight: 500; opacity: .95; }
.banner ul { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; font-size: 13px; }
.banner li { display: flex; gap: 8px; align-items: center; }
.banner li .i { width: 18px; height: 18px; opacity: .9; }
.banner .btn-white { background: #fff; color: var(--ink); font-size: 13px; padding: 10px 16px; }
.banner .deco {
  position: absolute; right: -30px; bottom: -40px; width: 180px; height: 180px; border-radius: 40px;
  background: rgba(255, 255, 255, .12); transform: rotate(18deg);
}
.banner .deco::after {
  content: ""; position: absolute; inset: 34px; border-radius: 26px; border: 2px dashed rgba(255, 255, 255, .35);
}

/* ---------- Stepper — adapted from uiverse.io element PriyanshuGupta28/orange-newt-23 (MIT) ---------- */
.stepper-step { display: flex; margin-bottom: 22px; position: relative; }
.stepper-step:last-child { margin-bottom: 0; }
.stepper-line { position: absolute; left: 19px; top: 40px; bottom: -22px; width: 2px; background-color: #e2e8f0; z-index: 1; }
.stepper-step:last-child .stepper-line { display: none; }
.stepper-circle {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin-right: 14px; z-index: 2; font-weight: 700; background: #fff; flex: none;
}
.stepper-completed .stepper-circle { background-color: var(--ink); color: white; }
.stepper-active .stepper-circle { border: 2px solid var(--blue); color: var(--blue); }
.stepper-pending .stepper-circle { border: 2px solid #e2e8f0; color: #94a3b8; }
.stepper-failed .stepper-circle { background-color: var(--bad); color: #fff; }
.stepper-content { flex: 1; min-width: 0; }
.stepper-title { font-weight: 700; margin-bottom: 2px; }
.stepper-pending .stepper-title { color: #94a3b8; }
.stepper-status { font-size: 12px; font-weight: 600; display: inline-block; padding: 2px 9px; border-radius: 12px; margin-top: 2px; }
.stepper-completed .stepper-status { background-color: #dcfce7; color: #166534; }
.stepper-active .stepper-status { background-color: #dbeafe; color: #1d4ed8; }
.stepper-pending .stepper-status { background-color: #f1f5f9; color: #64748b; }
.stepper-failed .stepper-status { background-color: var(--bad-50); color: var(--bad); }
.stepper-time { font-size: 12px; color: #94a3b8; margin-top: 3px; }

/* ---------- Loader — uiverse.io element adamgiebl/thin-lionfish-5 (MIT), scaled down ---------- */
.dots-container { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px 0; }
.dots-container .dot { height: 12px; width: 12px; border-radius: 10px; background-color: #b3d4fc; animation: dots-pulse 1.5s infinite ease-in-out; }
.dots-container .dot:nth-child(1) { animation-delay: -0.3s; }
.dots-container .dot:nth-child(2) { animation-delay: -0.1s; }
.dots-container .dot:nth-child(3) { animation-delay: 0.1s; }
@keyframes dots-pulse {
  0% { transform: scale(0.8); background-color: #b3d4fc; box-shadow: 0 0 0 0 rgba(178, 212, 252, 0.7); }
  50% { transform: scale(1.2); background-color: #6793fb; box-shadow: 0 0 0 8px rgba(178, 212, 252, 0); }
  100% { transform: scale(0.8); background-color: #b3d4fc; box-shadow: 0 0 0 0 rgba(178, 212, 252, 0.7); }
}

/* ---------- Timeline list (history) ---------- */
.timeline { display: grid; gap: 10px; }
.tl-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.tl-item .tl-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); flex: none; }
.tl-item .tl-main { flex: 1; min-width: 0; }
.tl-item .tl-title { font-weight: 600; }
.tl-item .tl-sub { color: var(--muted); font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty .i { width: 36px; height: 36px; color: #c4c8d0; margin-bottom: 6px; }

/* ---------- Brand / avatar ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.2px; }
.brand .logo { width: 36px; height: 36px; border-radius: 12px; background: var(--ink); color: #fff; display: grid; place-items: center; }
.brand .logo .i { width: 20px; height: 20px; }
.brand em { font-style: italic; font-weight: 800; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #dbe9ff, #f1f5ff); color: var(--blue-600); font-weight: 800; border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(17, 19, 24, .08);
}

/* ==========================================================================
   App shell
   ========================================================================== */
.app { min-height: 100vh; }
.sidebar { display: none; }
.content { padding: 0 16px 120px; max-width: 560px; margin: 0 auto; }

/* Mobile header */
.m-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 0 8px; }
.greeting h1 { font-size: 30px; font-weight: 800; letter-spacing: -.6px; line-height: 1.15; margin-top: 14px; }
.greeting p { color: var(--muted); margin-top: 4px; }

/* Floating bottom nav (mobile) */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 30;
  width: min(440px, calc(100% - 32px)); background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: space-around; padding: 8px;
}
.bottom-nav button {
  width: 52px; height: 52px; padding: 0; border-radius: 50%; background: transparent; color: var(--ink-2);
}
.bottom-nav button.active { background: var(--blue); color: #fff; box-shadow: 0 8px 20px rgba(31, 123, 255, .35); }
.bottom-nav button.scan { width: 60px; height: 60px; background: var(--ink); color: #fff; }

/* Views: on mobile only the active view is shown */
.view { display: none; }
.view.active { display: block; }

/* Mobile: columns dissolve, views stack in source order */
.dash > .col { display: contents; }
.view.active { margin-bottom: 16px; }
.view .section-title:first-child { margin-top: 18px; }

.dash > .col > .card { margin-bottom: 16px; }
.lect-grid > * + * { margin-top: 16px; }

/* Desktop-only / mobile-only helpers */
.d-only { display: none !important; }

/* ==========================================================================
   Scan sheet: full-screen dark on mobile, dialog on desktop
   ========================================================================== */
.sheet {
  position: fixed; inset: 0; z-index: 50; background: #0b0d10; color: #fff;
  display: flex; flex-direction: column; padding: 18px 18px 24px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { font-size: 18px; font-weight: 600; }
.sheet .icon-btn { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .12); }
.sheet .hint { text-align: center; color: rgba(255, 255, 255, .78); margin: 22px auto 18px; max-width: 300px; }
.scan-frame {
  position: relative; width: min(100%, 340px); aspect-ratio: 1; margin: 0 auto; border-radius: 22px;
  background: rgba(255, 255, 255, .04); overflow: hidden;
}
.scan-frame #reader { width: 100%; height: 100%; }
.scan-frame #reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
.scan-frame .corner { position: absolute; width: 46px; height: 46px; border: 4px solid var(--blue); z-index: 3; }
.scan-frame .c1 { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 22px 0 0 0; }
.scan-frame .c2 { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 22px 0 0; }
.scan-frame .c3 { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 22px; }
.scan-frame .c4 { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 22px 0; }
.scan-frame .laser {
  position: absolute; left: 8%; right: 8%; height: 2px; top: 10%; z-index: 3; border-radius: 2px;
  background: #5aa2ff; box-shadow: 0 0 14px #5aa2ff; animation: laser 2.4s ease-in-out infinite;
}
@keyframes laser { 0%, 100% { top: 10%; } 50% { top: 88%; } }
.scan-frame .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .5); text-align: center; padding: 30px; font-size: 13px; }
.sheet-actions { margin-top: auto; display: grid; gap: 10px; padding-top: 22px; }
.sheet-actions .btn-dark { background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .14); }
.sheet textarea { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); color: #fff; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Biometric verification overlay — fingerprint from uiverse.io element SRIMANKS/lazy-jellyfish-5 (MIT) */
.verify-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(11, 13, 16, .72); backdrop-filter: blur(4px); }
.fp-card {
  width: 220px; height: 290px; background: #000; border-radius: 24px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 0 40px rgba(0, 224, 255, .25);
}
.fp-card img { width: 90px; height: 180px; filter: drop-shadow(0 0 10px #3fefef) drop-shadow(0 0 40px #3fefef); }
.fp-card .fp-text { color: lightskyblue; margin-top: 18px; font-size: 14px; }
.fp-card .fp-bar {
  position: absolute; bottom: 10%; left: 10%; height: .15em; width: 80%; border-radius: 10px; background: rgb(0, 200, 255);
  filter: drop-shadow(0 0 10px #3fefef) drop-shadow(0 0 10px #3fefef); animation: fp-grow 4s infinite;
}
@keyframes fp-grow { 0% { width: 0%; } 50% { width: 80%; } 100% { width: 0%; } }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 80;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px;
}

/* ==========================================================================
   Login
   ========================================================================== */
.auth { min-height: 100vh; display: flex; flex-direction: column; padding: 24px 20px; max-width: 480px; margin: 0 auto; }
.auth .auth-top { padding: 8px 0 26px; }
.auth h1 { font-size: 30px; font-weight: 800; letter-spacing: -.6px; line-height: 1.15; }
.auth .lead { color: var(--muted); margin: 8px 0 24px; }
.auth .panel-brand { display: none; }
.proof-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

/* ==========================================================================
   Lecturer
   ========================================================================== */
.qr-card { text-align: center; }
.qr-stage {
  position: relative; display: inline-block; padding: 18px; border-radius: 26px; background: #fff;
}
.qr-stage canvas { display: block; width: min(72vw, 300px) !important; height: auto !important; image-rendering: pixelated; }
.qr-stage .corner { position: absolute; width: 34px; height: 34px; border: 4px solid var(--blue); }
.qr-stage .c1 { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 18px 0 0 0; }
.qr-stage .c2 { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 18px 0 0; }
.qr-stage .c3 { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 18px; }
.qr-stage .c4 { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 18px 0; }
.countdown-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.countdown { font-size: 40px; font-weight: 800; color: var(--blue); line-height: 1; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { border-radius: var(--r-md); padding: 14px; background: var(--surface-2); border: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.stat .s-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); }
.stat .n { font-size: 26px; font-weight: 800; line-height: 1; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat.ok .s-icon { color: var(--ok); } .stat.ok .n { color: var(--ok); }
.stat.warn .s-icon { color: var(--warn); } .stat.warn .n { color: var(--warn); }
.stat.bad .s-icon { color: var(--bad); } .stat.bad .n { color: var(--bad); }
.controls { display: grid; gap: 10px; margin-top: 14px; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.segmented button { background: transparent; color: var(--ink-2); padding: 8px 14px; font-size: 13px; }
.segmented button.active { background: var(--ink); color: #fff; }
.people { display: grid; gap: 10px; margin-top: 14px; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; flex-wrap: wrap; }
.person .avatar { width: 40px; height: 40px; font-size: 14px; }
.person .p-main { flex: 1; min-width: 140px; }
.person .p-name { font-weight: 700; }
.person .p-sub { font-size: 12.5px; color: var(--muted); }
.person .p-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.course-pick { display: grid; gap: 10px; }
table.plain { width: 100%; border-collapse: collapse; font-size: 14px; }
table.plain th, table.plain td { text-align: left; padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.plain th { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.table-wrap { overflow-x: auto; }

/* ==========================================================================
   DESKTOP (>= 900px): sidebar + multi-column dashboard
   ========================================================================== */
@media (min-width: 900px) {
  .d-only { display: block !important; }
  .m-only { display: none !important; }
  .app { display: grid; grid-template-columns: 260px 1fr; background: linear-gradient(to right, var(--surface) 260px, var(--bg) 260px); }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh;
    padding: 24px 18px; background: var(--surface); border-right: 1px solid var(--line);
  }
  .sidebar .brand { padding: 4px 8px 22px; }
  .side-link {
    display: flex; align-items: center; gap: 12px; width: 100%; justify-content: flex-start;
    background: transparent; color: var(--ink-2); padding: 12px 14px; border-radius: 14px; font-weight: 600;
  }
  .side-link:hover { background: var(--surface-2); }
  .side-link.active { background: var(--ink); color: #fff; }
  .side-link.scan { background: var(--blue); color: #fff; margin-top: 8px; }
  .side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; }
  .side-foot .who { min-width: 0; flex: 1; }
  .side-foot .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-foot .who > span { font-size: 12px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .content { max-width: 1240px; width: 100%; margin: 0; padding: 28px 36px 48px; }
  .m-header, .bottom-nav { display: none !important; }
  .d-topbar { display: flex !important; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
  .d-topbar h1 { font-size: 30px; font-weight: 800; letter-spacing: -.6px; }
  .d-topbar p { color: var(--muted); margin-top: 2px; }

  /* All student views visible side by side */
  .view { display: block; }
  .dash { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
  .dash > .col { display: grid; gap: 18px; align-content: start; }
  .view.active { margin-bottom: 0; }
  .dash > .col > .card { margin-bottom: 0; }
  .lect-grid > * + * { margin-top: 0; }
  .view .section-title:first-child { margin-top: 4px; }
  .card + .card { margin-top: 0; }
  .section-title { margin: 4px 4px 10px; }

  /* Scan sheet becomes a centered dialog */
  .sheet {
    inset: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 460px; max-height: 92vh;
    border-radius: 30px; box-shadow: 0 30px 90px rgba(0, 0, 0, .45); padding: 22px 24px 26px;
  }
  .sheet-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(11, 13, 16, .55); }

  /* Lecturer dashboard */
  .lect-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr); gap: 22px; align-items: start; }
  .qr-stage canvas { width: min(36vw, 420px) !important; }
  .countdown { font-size: 52px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .controls button { white-space: nowrap; padding-left: 12px; padding-right: 12px; }
  .controls .full { grid-column: 1 / -1; }
  .course-pick { grid-template-columns: 1fr auto; align-items: center; }

  /* Login: split screen */
  .auth { max-width: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1.05fr 1fr; }
  .auth .panel-brand {
    display: flex; flex-direction: column; justify-content: space-between; padding: 44px;
    margin: 18px; border-radius: 32px; color: #fff; position: relative; overflow: hidden;
    background: radial-gradient(120% 120% at 100% 0%, #5aa2ff 0%, #1f7bff 45%, #123f99 100%);
  }
  .auth .panel-brand h2 { font-size: 40px; line-height: 1.1; font-weight: 800; letter-spacing: -.8px; max-width: 460px; }
  .auth .panel-brand .proofs { display: grid; gap: 12px; margin-top: 28px; max-width: 440px; }
  .auth .panel-brand .proof { display: flex; gap: 12px; align-items: center; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); border-radius: 16px; padding: 12px 14px; }
  .auth .panel-brand .proof .i { width: 24px; height: 24px; }
  .auth .form-side { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(32px, 6vw, 96px); }
  .auth .form-side .inner { width: 100%; max-width: 420px; }
  .auth .auth-top .brand { display: none; }
  .proof-chips { display: none; }
}

/* Larger laptops: a little more air */
@media (min-width: 1360px) {
  .content { padding: 32px 48px 56px; }
}
