:root {
  /* Pacifica brand (Logo + Branding Guide, 2023) */
  --brand: #0d3160;        /* Pacifica Navy, web */
  --brand-2: #1a4a86;      /* lighter navy for hovers */
  --accent: #279b44;       /* Pacifica Green, web */
  --sky: #5fa0bb;
  --mist: #ccdde7;
  --silver: #c8cbc8;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #edf2f5;
  --text: #14233a;
  --muted: #59625a;        /* brand gray, darkened for readable small text */
  --border: #d9e1e6;
  --ok: #1f7f38;
  --ok-bg: #e4f3e8;
  --warn: #a35f00;
  --warn-bg: #fff3dc;
  --over: #c0262d;
  --over-bg: #fde8e8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(13, 49, 96, .06), 0 2px 8px rgba(13, 49, 96, .07);
  --font: "Gotham Narrow", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "Cormorant", "Trajan Pro", Georgia, serif;
  font-family: var(--font);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #08162b; --surface: #0f2240; --surface-2: #16305a; --text: #e8eef5; --muted: #a7b4c4;
    --border: #23406b; --ok: #4cc06a; --ok-bg: #12321f; --warn: #f0b04a; --warn-bg: #3a2a0c;
    --over: #ff6b6b; --over-bg: #3d1515; --brand-2: #2a5ea3;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
.wordmark { font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; line-height: 1; }
.crest-white { filter: brightness(0) invert(1); }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
a { color: var(--brand-2); }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }

/* buttons & inputs */
.btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: transform .05s, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--over); }
.btn.ok { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.input, select.input {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 12px;
  font-size: 14px; min-width: 0;
}
.input:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* app shell for dashboards */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--brand); color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.topbar .brand img { height: 36px; filter: brightness(0) invert(1); }
.topbar .brand .wordmark { font-size: 22px; }
.topbar .brand .app-name { font-size: 11px; text-transform: uppercase; letter-spacing: .2em; opacity: .8; font-weight: 600; margin-top: 3px; }
.topbar a, .topbar .link { color: #fff; opacity: .85; text-decoration: none; font-weight: 600; font-size: 14px;
  background: none; border: 0; cursor: pointer; padding: 0; }
.topbar a:hover, .topbar .link:hover { opacity: 1; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #4cd471; display: inline-block; }
.live-dot.off { background: #f28b82; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }
.tabs { display: flex; gap: 4px; background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 24px; overflow-x: auto; position: sticky; top: 62px; z-index: 9; }
.tabs a { padding: 12px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px;
  border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .badge { background: var(--over); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 12px; margin-left: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card > .card-head h2 { font-size: 16px; }
.card > .card-body { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.side { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
@media (max-width: 900px) { .grid.two, .grid.side { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 30px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.alert .value { color: var(--over); }

table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.flag td { background: var(--over-bg); }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table-wrap { overflow: auto; max-height: 70vh; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 10px; font-size: 12px;
  font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.over { background: var(--over-bg); color: var(--over); }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; }
.timer.ok { color: var(--ok); } .timer.warn { color: var(--warn); } .timer.over { color: var(--over); }

.bar { height: 8px; border-radius: 4px; background: var(--brand-2); min-width: 2px; }

/* pass cards (teacher "out now") */
.pass-list { display: flex; flex-direction: column; gap: 10px; }
.pass-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); }
.pass-card.warn { border-color: #f0c36d; background: var(--warn-bg); }
.pass-card.over { border-color: #ef9a9a; background: var(--over-bg); animation: pulse 2s infinite; }
.pass-card .icon { font-size: 26px; }
.pass-card .who { font-weight: 700; }
.pass-card .timer { font-size: 22px; margin-left: auto; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(198, 40, 40, .15); } }

.roster-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.roster-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; text-align: left; }
.roster-item:hover { background: var(--surface-2); }
.roster-item.out { background: var(--warn-bg); border-color: #f0c36d; }

.banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px;
  background: var(--over-bg); color: var(--over); font-weight: 700; border: 1px solid #ef9a9a; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(10, 18, 30, .55); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-card { background: var(--surface); border-radius: 20px; padding: 24px; width: min(640px, 100%); max-height: 90vh;
  overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-card h2 { margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1c2633; color: #fff;
  padding: 12px 20px; border-radius: 12px; font-weight: 600; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  max-width: 90vw; }
.toast.error { background: var(--over); }

.dest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.dest-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 10px; border-radius: 16px;
  border: 2px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 17px; }
.dest-btn:hover { border-color: var(--brand-2); }
.dest-btn .icon { font-size: 40px; }
.dest-btn .limit { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------------- kiosk (portrait iPad on the classroom wall) ---------------- */
body.kiosk { user-select: none; -webkit-user-select: none; overscroll-behavior: none; }

/* landing / welcome screen */
.k-landing { position: fixed; inset: 0; background: var(--brand); color: #fff; display: flex; flex-direction: column;
  align-items: center; text-align: center; padding: 48px 36px 40px; cursor: pointer; overflow: hidden; }
.k-landing::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--accent); }
.k-landing-top { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.k-landing-top img { height: 120px; }
.k-landing-top .wordmark { font-size: 34px; letter-spacing: .14em; }
.k-room-label { font-size: 15px; letter-spacing: .22em; text-transform: uppercase; opacity: .75; font-weight: 600; }
.k-welcome { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; max-width: 92%; }
.k-eyebrow { font-size: 22px; letter-spacing: .3em; text-transform: uppercase; color: var(--mist); font-weight: 600; }
.k-course { font-family: var(--display); font-weight: 700; font-size: clamp(48px, 9vw, 84px); line-height: 1.02; margin: 4px 0 10px; }
.k-rule { width: 84px; height: 4px; background: var(--accent); border-radius: 2px; margin: 0 auto 6px; }
.k-teacher { font-size: 30px; font-weight: 600; }
.k-meta { font-size: 22px; color: var(--mist); }
.k-meta strong { color: #fff; font-weight: 700; }
.k-landing-out { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 8px 0 24px; min-height: 10px; }
.k-out-chip { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18);
  border-radius: 99px; padding: 8px 16px; font-size: 17px; }
.k-out-chip .timer { font-weight: 800; }
.k-out-chip.warn { background: rgba(240, 176, 74, .22); border-color: rgba(240, 176, 74, .6); }
.k-out-chip.over { background: rgba(255, 107, 107, .25); border-color: rgba(255, 107, 107, .7); }
.k-out-chip .timer.ok, .k-out-chip .timer.warn, .k-out-chip .timer.over { color: #fff; }
.k-landing-foot { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.k-clock-big { font-size: 64px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.k-tap { display: inline-flex; align-items: center; gap: 12px; background: var(--accent); color: #fff; font-size: 22px; font-weight: 700;
  padding: 18px 34px; border-radius: 99px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.04); } }

/* roster screen */
.k-head { display: flex; align-items: center; gap: 16px; padding: 16px 24px; background: var(--brand); color: #fff;
  border-bottom: 5px solid var(--accent); }
.k-head img { height: 46px; }
.k-class { flex: 1; min-width: 0; }
.k-class .name { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.05;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-class .meta { opacity: .85; font-size: 15px; margin-top: 2px; }
.k-clock { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.k-done { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3); color: #fff; font-size: 16px;
  font-weight: 700; padding: 10px 16px; border-radius: 12px; cursor: pointer; }
.k-out { padding: 16px 24px 0; display: flex; flex-direction: column; gap: 12px; }
.k-out:empty { display: none; }
.k-pass { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px;
  background: var(--surface); border: 2px solid var(--border); box-shadow: var(--shadow); }
.k-pass.warn { border-color: #f0c36d; background: var(--warn-bg); }
.k-pass.over { border-color: #ef9a9a; background: var(--over-bg); }
.k-pass .icon { font-size: 34px; }
.k-pass .who { font-size: 20px; font-weight: 800; }
.k-pass .where { color: var(--muted); font-size: 15px; }
.k-pass .timer { font-size: 28px; margin-left: auto; }
.k-pass .btn { font-size: 18px; padding: 14px 20px; border-radius: 14px; }
.k-main { padding: 18px 24px 40px; }
.k-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.k-toolbar h2 { font-size: 24px; flex: 1 0 100%; }
.k-toolbar .input { font-size: 17px; padding: 12px 16px; flex: 1 1 260px; border-radius: 14px; }
.k-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.k-name { padding: 20px 16px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface);
  font-size: 20px; font-weight: 700; text-align: left; cursor: pointer; box-shadow: var(--shadow); color: var(--text);
  -webkit-tap-highlight-color: transparent; line-height: 1.2; }
.k-name .last { display: block; font-weight: 500; color: var(--muted); font-size: 16px; }
.k-name:active { transform: scale(.97); border-color: var(--brand-2); }
.k-name.out { background: var(--warn-bg); border-color: #f0c36d; }
.k-name.out .last::after { content: " · out"; color: var(--warn); font-weight: 700; }
.k-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.k-empty .big { font-size: 26px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.k-success { text-align: center; padding: 10px 0; }
.k-success .icon { font-size: 64px; }
.k-success h2 { font-size: 28px; margin: 8px 0; }
.pair-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--brand); }
.pair-card { background: var(--surface); border-radius: 24px; padding: 36px; width: min(460px, 100%); text-align: center; }
.pair-card img { width: 180px; margin-bottom: 12px; }
.pair-card .input { font-size: 34px; letter-spacing: .3em; text-align: center; width: 100%; margin: 20px 0; padding: 14px; font-weight: 800; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: var(--brand); }
.login-card { background: var(--surface); border-radius: 22px; padding: 32px; width: min(440px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card .logo { width: 100%; max-width: 300px; display: block; margin: 4px auto 18px; }
.login-card h1 { text-align: center; font-size: 15px; text-transform: uppercase; letter-spacing: .2em; color: var(--muted); }
/* The full logo has solid white details, so it can't be recolored white; the login page stays light. */
.error-box { background: var(--over-bg); color: var(--over); padding: 10px 12px; border-radius: 10px; font-weight: 600; margin: 12px 0; }

/* kiosk: PIN pad and ID scanner */
.k-scan { font-size: 17px; padding: 12px 18px; border-radius: 14px; }
.pin-wrap { text-align: center; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 6px; min-height: 22px; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--brand-2); }
.pin-dots span.on { background: var(--brand-2); }
.pin-error { color: var(--over); font-weight: 700; min-height: 22px; margin: 4px 0 10px; text-align: center; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 96px); gap: 12px; justify-content: center; }
.pin-key { height: 72px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface-2);
  font-size: 30px; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pin-key:active { transform: scale(.95); background: var(--border); }
.pin-key.fn { font-size: 17px; color: var(--muted); }
.pin-go { margin-top: 16px; width: 312px; padding: 14px; font-size: 18px; border-radius: 14px; }
.scan-box { position: relative; margin-top: 14px; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.scan-frame { position: absolute; inset: 18% 22%; border: 4px solid var(--accent); border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); }
