:root {
  --blue: #0b3d91;
  --blue-dark: #072a66;
  --red: #d62828;
  --green: #2b9348;
  --amber: #f4a261;
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #1b2233;
  --muted: #64708a;
  --line: #e2e8f2;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--blue); }
header.top {
  background: linear-gradient(120deg, var(--blue-dark), var(--blue));
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
}
header.top { border-bottom: 4px solid var(--red); }
header.top .logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: #fff; padding: 3px; object-fit: contain;
}
.motto { color: var(--red); font-weight: 700; font-style: italic; margin: -4px 0 14px; font-size: 14px; }
.text-red, .kpi.text-red { color: var(--red); }
.staff-gate {
  position: fixed; inset: 0; z-index: 40; background: rgba(7, 42, 102, .92);
  display: grid; place-items: center; padding: 16px;
}
.staff-gate .card { width: 100%; max-width: 380px; margin: 0; }
.staff-gate .logo-big {
  display: block; width: 52px; height: 52px; border-radius: 14px; background: #fff;
  padding: 4px; object-fit: contain; box-shadow: 0 1px 4px rgba(0,0,0,.15); margin-bottom: 10px;
}
label.check {
  display: flex; align-items: center; gap: 10px; font-weight: 500;
  padding: 8px 0; margin: 0; border-bottom: 1px solid var(--line);
}
label.check input { width: 20px; height: 20px; flex: none; }
select + label, input + label { margin-top: 12px; }
.bar.marked { position: relative; overflow: visible; }
.bar.marked > span { border-radius: 99px; }
.bar.marked > span.low { background: var(--red); }
.bar.marked > i {
  position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .6;
}
header.top h1 { font-size: 18px; margin: 0; }
header.top small { opacity: .8; display: block; font-size: 12px; }
header.top .spacer { flex: 1; }
header.top a.home { color: #fff; text-decoration: none; font-size: 14px; opacity: .9; margin-left: 14px; }
main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }
main.narrow { max-width: 520px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 3px rgba(16, 32, 64, .08);
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 17px; }
.muted { color: var(--muted); font-size: 14px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
button, .btn {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover, .btn:hover { filter: brightness(1.1); }
button.secondary, .btn.secondary { background: #e8eef9; color: var(--blue); }
button.danger { background: var(--red); }
button.green { background: var(--green); }
button.block, .btn.block { width: 100%; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 6px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: #e8eef9; color: var(--blue);
}
.pill.green { background: #e3f4e8; color: var(--green); }
.pill.red { background: #fde8e8; color: var(--red); }
.pill.amber { background: #fff1e3; color: #b8621b; }
.pill.grey { background: #eef0f4; color: var(--muted); }
.kpi { font-size: 34px; font-weight: 800; color: var(--blue); }
.kpi small { font-size: 15px; color: var(--muted); font-weight: 600; }
.bar { height: 12px; background: #e8eef9; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--blue); border-radius: 99px; transition: width .6s; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.lesson {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.lesson:last-child { border-bottom: 0; }
.lesson .time { font-weight: 700; width: 60px; color: var(--blue); }
.lesson .info { flex: 1; }
.lesson .info b { display: block; }
.next {
  background: linear-gradient(120deg, var(--blue-dark), var(--blue));
  color: #fff;
}
.next .muted { color: #c9d6f2; }
.next .count { font-size: 40px; font-weight: 800; }
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 12px;
  max-width: 92vw; box-shadow: 0 6px 20px rgba(0,0,0,.25); z-index: 50;
  font-weight: 600;
}
.toast.ok { background: var(--green); }
.toast.err { background: var(--red); }
.banner { padding: 14px; border-radius: 12px; font-weight: 600; margin-bottom: 16px; }
.banner.ok { background: #e3f4e8; color: #1d6b34; }
.banner.err { background: #fde8e8; color: #a11d1d; }
.banner.warn { background: #fff1e3; color: #8a4a12; }
#installBtn { display: none; }
.green-card { border-top: 4px solid var(--green); }
.home-tiles a {
  display: block; text-decoration: none; color: inherit;
  transition: transform .15s;
}
.home-tiles a:hover { transform: translateY(-2px); }
.home-tiles .icon { font-size: 30px; }
video#cam { width: 100%; border-radius: 12px; background: #000; }

/* lecturer app */
.lec-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 900px) { .lec-grid { grid-template-columns: minmax(0, 1fr); } }
textarea { resize: vertical; }
button.sm, .btn.sm { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.lesson.pick { cursor: pointer; border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.lesson.pick:hover { background: #f5f8fd; }
.lesson.pick.sel { background: #e8eef9; box-shadow: inset 4px 0 0 var(--blue); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; text-align: center; }
.kpis .kpi { font-size: 28px; }
.msg { padding: 10px 0; border-bottom: 1px solid var(--line); }
.msg:last-child { border-bottom: 0; }
.scroll { overflow-x: auto; }
#reg table td { vertical-align: top; }
