/* AAG Digital Hall Pass - styles. Brand colours sampled from the AAG logo (to be confirmed). */
:root {
  --ink: #111111; --gold: #F2A81A; --red: #C0141C;
  --bg: #f6f5f2; --card: #ffffff; --line: #e3e0d8; --muted: #5b5b5b;
  --ok: #1E7B3A; --ok-bg: #e3f3e8; --warn: #B45309; --warn-bg: #fff4e0; --bad-bg: #fde8e8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); font-size: 16px; }
.banner { background: var(--red); color: #fff; text-align: center; font-weight: 700; padding: 8px; letter-spacing: .04em; }
.top { background: var(--ink); color: #fff; padding: 12px 20px; border-bottom: 4px solid var(--gold); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-size: 1.2rem; font-weight: 700; }
.top-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; }
.who { color: #ddd; }
.testbar { background: var(--warn-bg); border-bottom: 1px solid var(--gold); padding: 8px 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.testbar select { min-height: 36px; padding: 4px 8px; font-size: 1rem; }
.hint { color: var(--warn); font-weight: 600; }
.tabs { display: flex; gap: 4px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.tabs a { padding: 14px 16px; color: var(--ink); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.tabs a.active { border-bottom-color: var(--gold); }
main { max-width: 1200px; margin: 20px auto; padding: 0 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--card); border-radius: 12px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.12); margin-bottom: 16px; }
.card h1 { margin-top: 0; }
.card h2 { margin: 0 0 10px; font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.narrow { max-width: 460px; margin: 40px auto; }
.center { text-align: center; }
.big-name { font-size: 1.4rem; font-weight: 700; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: .9rem; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.wait { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--red); }
.chip { display: inline-block; padding: 2px 8px; margin: 2px 4px 2px 0; border-radius: 6px; background: #f0ede6; font-size: .85rem; }
.btn { display: inline-block; min-height: 44px; padding: 10px 18px; border: 0; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer; }
.btn.light { background: #e7e5df; color: var(--ink); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: default; }
.msg { font-weight: 600; }
.msg.error { color: var(--red); }
.msg.ok { color: var(--ok); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
form label.inline { flex-direction: row; align-items: center; gap: 8px; }
form input[type=email], form input[type=text], input[type=search] { min-height: 44px; padding: 8px 10px; border: 1px solid #c9c5bb; border-radius: 8px; font-size: 1rem; }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: end; }
fieldset.roles { border: 1px solid var(--line); border-radius: 8px; margin: 14px 0; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
fieldset.roles label { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; min-height: 36px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .85rem; color: var(--muted); text-transform: uppercase; }
.table tr.inactive td { color: #999; }
form select { min-height: 44px; padding: 8px 10px; border: 1px solid #c9c5bb; border-radius: 8px; font-size: 1rem; background: #fff; }
.inline-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-controls select { min-height: 44px; padding: 8px; border: 1px solid #c9c5bb; border-radius: 8px; font-size: 1rem; }
.card h3 { font-size: 1rem; margin: 18px 0 6px; }
details { margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
details summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.lvl-error { color: var(--red); font-weight: 700; }
.lvl-warning { color: var(--warn); font-weight: 700; }
label.confirm { margin: 14px 0; font-weight: 700; color: var(--red); }
.table input[type=text], .table input[type=number], .table input[type=time] { min-height: 38px; width: 100%; min-width: 64px; padding: 4px 6px; border: 1px solid #c9c5bb; border-radius: 6px; font-size: .95rem; }
.table.compact td { padding: 6px 4px; }
.table input[type=checkbox] { width: 22px; height: 22px; }
form input[type=date], form input[type=number], form input[type=time] { min-height: 44px; padding: 8px 10px; border: 1px solid #c9c5bb; border-radius: 8px; font-size: 1rem; }

/* ---------- Phase 1b-1: test clock, teacher screen, safeguarding ---------- */
.clockbanner { background: var(--gold); color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* teacher: the lesson the teacher is in right now */
.session-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--ink); color: #fff; border-left: 8px solid var(--gold); border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; }
.session-title { font-size: 1.35rem; font-weight: 800; margin: 0 0 4px; }
.session-sub { margin: 0; color: #e8e2d4; }

/* teacher: who is out (overdue is always icon + words, never colour alone) */
.out-list { display: grid; gap: 10px; }
.out-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 2px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.out-card.late { border-color: var(--red); background: var(--bad-bg); }
.out-main p { margin: 0; }
.out-name { font-size: 1.15rem; font-weight: 800; }
.out-where { font-weight: 600; }
.out-state { color: var(--muted); }
.out-state.late { color: var(--red); font-weight: 800; }
.out-state .icon { font-size: 1.1em; }
.out-actions { display: flex; gap: 8px; }
.out-actions .btn { min-width: 88px; min-height: 52px; font-size: 1.05rem; }
.end-btn { background: var(--ink); }

/* teacher: tap a student, then a destination */
.big-search { width: 100%; min-height: 52px !important; font-size: 1.1rem !important; margin-bottom: 10px; }
.student-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 6px; }
.student-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 60px; padding: 10px 14px;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.student-btn:hover { border-color: var(--gold); }
.student-btn:active { background: #fff6e2; }
.sb-name { font-weight: 700; font-size: 1.02rem; }
.sb-grade { font-size: .85rem; color: var(--muted); }
.hidden-note { text-align: center; padding: 18px 8px; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(17, 17, 17, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 12px; }
.sheet { background: #fff; width: 100%; max-width: 640px; border-radius: 16px; padding: 18px; border-top: 6px solid var(--gold); }
.sheet-title { font-size: 1.2rem; font-weight: 800; margin: 0 0 12px; }
.dest-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-bottom: 14px; }
.dest-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 72px; padding: 12px 14px;
  border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.dest-btn:hover { background: #fff6e2; }
.dest-btn.pressed { background: var(--gold); }
.dest-btn:disabled { opacity: .6; cursor: default; }
.db-name { font-weight: 800; }
.db-min { font-size: .9rem; color: var(--muted); }
.btn.wide { width: 100%; }
@media (min-width: 760px) { .sheet-backdrop { align-items: center; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: 92vw;
  padding: 14px 22px; border-radius: 10px; font-weight: 700; font-size: 1.05rem; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.ok { background: var(--ink); color: #fff; border-left: 6px solid var(--gold); }
.toast.bad { background: #fff; color: var(--red); border: 2px solid var(--red); }

/* settings: timetable */
.lunch-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.lunch-grid label { font-weight: 600; }
.grade-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; }
.grade-checks label { min-height: 40px; }

/* safeguarding */
.alert-card { border-left: 6px solid var(--red); }
.alert-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding: 8px 0; }
.alert-row p { margin: 0; }
.chip.warn { background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.chip.bad { background: var(--bad-bg); color: var(--red); font-weight: 700; }
.table tr.late-row td { background: var(--bad-bg); }
.group-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 12px; }
.group-card.inactive { opacity: .7; }
.group-card input[type=number] { max-width: 120px; }
.member-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip.member { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; font-size: .95rem; }
.chip.member.archived { text-decoration: line-through; color: var(--muted); }
.chip-x { min-width: 32px; min-height: 32px; border: 0; border-radius: 6px; background: #e3dfd5; font-size: 1.1rem; cursor: pointer; }
.pick-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.group-card input[type=search], #sgOvSearch { width: 100%; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.form-row label.inline { flex-direction: row; align-items: center; gap: 8px; min-height: 44px; }
.form-row input[type=text], .form-row input[type=number], .form-row input[type=search], .form-row input[type=date], .form-row select,
.group-card input[type=search], .actions select { min-height: 44px; padding: 8px 10px; border: 1px solid #c9c5bb; border-radius: 8px; font-size: 1rem; background: #fff; }
.form-row input[type=checkbox], .grade-checks input[type=checkbox] { width: 22px; height: 22px; }
.toast { width: max-content; text-align: center; }

/* ---------- Phase 1b-2a: arrivals, live view, emergency roll ---------- */
.attention-banner { background: var(--bad-bg); color: var(--red); border: 2px solid var(--red); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px; font-weight: 800; }
.out-state.ok { color: #1b6b3a; font-weight: 700; }
.chip.ok { background: #e3f3e8; color: #1b6b3a; font-weight: 700; }
.hs-out { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.hs-out summary { font-weight: 700; cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.lv-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lv-tools .chime { color: #fff; font-weight: 600; }
.roll-btn { background: var(--red); border: 2px solid #fff; }
.big-action { min-width: 120px; min-height: 56px; font-size: 1.1rem; }

.roll { position: fixed; inset: 0; z-index: 80; background: #fff; overflow: auto; padding: 20px clamp(12px, 4vw, 40px); }
.roll-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap;
  border-bottom: 4px solid var(--red); padding-bottom: 10px; margin-bottom: 12px; }
.roll-head h1 { margin: 0 0 4px; font-size: 1.5rem; }
.roll-head p { margin: 0; font-weight: 600; }
.roll-actions { display: flex; gap: 8px; }
.roll h2 { font-size: 1.15rem; margin: 18px 0 6px; }
.roll-table td.tick { font-size: 1.3rem; width: 56px; text-align: center; }
.roll-none { font-size: 1.2rem; font-weight: 700; }
body.roll-open { overflow: hidden; }

@media print {
  body.roll-open > *:not(main) { display: none !important; }
  body.roll-open main > *:not(#lvRoll) { display: none !important; }
  body.roll-open .roll { position: static; overflow: visible; padding: 0; }
  body.roll-open .roll-actions { display: none; }
  body.roll-open .roll-table th, body.roll-open .roll-table td { border: 1px solid #000; padding: 6px 8px; }
  body.roll-open .roll h2 { page-break-after: avoid; }
}
.roll-table { table-layout: fixed; width: 100%; }
.roll-table th:nth-child(1) { width: 64px; }
.roll-table th:nth-child(3) { width: 70px; }
.roll-table th:nth-child(4) { width: 100px; }
@media print { body.roll-open { background: #fff; } }
#destRows select { min-height: 40px; padding: 6px 8px; border: 1px solid #c9c5bb; border-radius: 8px; font-size: 1rem; background: #fff; }

/* ---------- Phase 1b-2b: cover line, reports, audit ---------- */
.cover-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 14px; }
.cover-line .chip { font-weight: 700; }
#rpSections h3 { margin: 16px 0 6px; }
#auRows td:nth-child(5) { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; word-break: break-all; }
#tabs { overflow-x: auto; }

/* ---------- S24: pilot label ---------- */
.env-badge { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 6px; background: var(--gold); color: var(--ink);
  font-size: .75rem; font-weight: 800; letter-spacing: .06em; vertical-align: middle; }

/* ---------- S25: paper passes today ---------- */
.paperbanner { background: var(--red); color: #fff; font-size: 1.05rem; }
.paper-card { border-left: 6px solid var(--red); }
.paper-status { font-weight: 700; }
.paper-status.on { color: var(--red); }
.btn.paper-on { background: var(--red); }
