:root {
  /* Palette adopted from the SDSCPA Inventory site: near-black monochrome dark. */
  --bg: #0a0a0a; --panel: #1a1a1a; --panel2: #242424; --text: #f0f0f0;
  --muted: #888888; --line: #333333;
  --good: #4ade80; --warn: #fbbf24; --bad: #ef4444; --info: #3b82f6; --accent: #6366f1;
  --radius: 14px; --shadow: 0 10px 26px rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; }
/* Gradient heading treatment from the inventory site. */
h1 {
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  letter-spacing: .3px;
}
.muted { color: var(--muted); }
code { background: #0b1220; padding: .1em .35em; border-radius: 4px; font-size: .9em; }
hr { border: none; border-top: 1px solid var(--line); margin: 1.25rem 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; flex-direction: column; line-height: 1.1; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-main { font-weight: 800; font-size: 1.05rem; letter-spacing: .3px;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent; }
.brand-sub { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.topbar .links a { margin-left: 1rem; color: var(--muted); }
.topbar .links a:hover { color: var(--text); }

.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.center-card { min-height: 100vh; display: grid; place-items: center; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid:not(.two) { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 800px) { .grid.two { grid-template-columns: 1fr; } }
.link-card:hover { border-color: var(--accent); text-decoration: none; }
.link-card h3 { margin: .4rem 0 .2rem; }
.teacher-section { margin-bottom: 1.75rem; }
.teacher-section > h2 { border-bottom: 1px solid var(--line); padding-bottom: .35rem; margin-bottom: .8rem; }

.stack { display: flex; flex-direction: column; gap: .6rem; }
.row { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }
input, select, button, textarea {
  font: inherit; padding: .55rem .7rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
}
textarea { resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); }
button { background: var(--accent); border-color: var(--accent); color: white; cursor: pointer; font-weight: 600; }
button:hover { filter: brightness(1.1); }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.sm { padding: .25rem .5rem; font-size: .85rem; }
button.ghost { background: transparent; color: var(--info); border-color: var(--info); }
.btn-link { display: inline-block; background: var(--accent); color: #fff; padding: .5rem .9rem;
  border-radius: 8px; font-weight: 600; }
.btn-link:hover { filter: brightness(1.1); text-decoration: none; }
label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: #052e16; color: #86efac; }
.flash.error { background: #450a0a; color: #fca5a5; }

.login { width: min(360px, 92vw); text-align: center; gap: .8rem; display: flex; flex-direction: column; }

/* Tables */
table.roster { width: 100%; border-collapse: collapse; margin: .5rem 0 1rem; }
.roster th, .roster td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); }
.roster th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.roster.compact td, .roster.compact th { padding: .4rem .4rem; font-size: .92rem; }
.roster tr.tardy td { background: rgba(245, 158, 11, .08); }
.roster tr.absent td { color: var(--muted); }

.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li { background: var(--panel2); padding: .25rem .6rem; border-radius: 999px; font-size: .85rem; }
.list { list-style: none; padding: 0; }
.list li { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--line); }

.pill { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--panel2); color: var(--muted); }
.pill.good { background: rgba(34,197,94,.18); color: var(--good); }
.pill.warn { background: rgba(245,158,11,.18); color: var(--warn); }
.pill.bad  { background: rgba(239,68,68,.18); color: var(--bad); }
.pill.info { background: rgba(56,189,248,.18); color: var(--info); }
.pill.nurse { background: rgba(139,92,246,.18); color: #a78bfa; }

/* Dashboard */
.dash-head { display: flex; justify-content: space-between; align-items: center; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); }
.clock.big { font-size: 2rem; font-weight: 700; color: var(--text); }
.counts { display: flex; gap: 1rem; margin: 1rem 0; }
.count { flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; text-align: center; box-shadow: var(--shadow); }
.count span { font-size: 2.4rem; font-weight: 800; display: block; }
.count label { color: var(--muted); }
.count.good span { color: var(--good); } .count.warn span { color: var(--warn); } .count.bad span { color: var(--bad); } .count.info span { color: var(--info); }

/* Prominent "currently in the restroom" banner, above the counts */
.restroom-banner { margin: 1rem 0; border: 1px solid var(--info);
  background: rgba(56,189,248,.12); border-radius: var(--radius); padding: .6rem 1rem;
  box-shadow: var(--shadow); }
.rb-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .25rem 0; }
.rb-icon { font-size: 1.5rem; }
.rb-name { font-size: 1.3rem; font-weight: 800; color: var(--info); }
.restroom-banner:has(.rb-row.nurse) { border-color: #8b5cf6; background: rgba(139,92,246,.12); }
.rb-row.nurse .rb-name { color: #a78bfa; }
.restroom-banner .timer { font-size: 1.3rem; margin-left: auto; }
.restroom-banner button { margin-left: .5rem; }

/* Full-screen red flash on the teacher dashboard when a sign-out is blocked */
.screen-flash { position: fixed; inset: 0; z-index: 100; display: flex;
  align-items: center; justify-content: center; text-align: center; padding: 2rem;
  font-size: 2.4rem; font-weight: 800; color: #fff; background: rgba(239,68,68,.92); }
.screen-flash.active { animation: flashpulse .6s steps(1) 6; }
@keyframes flashpulse { 0%,100% { background: rgba(239,68,68,.92); } 50% { background: rgba(239,68,68,.45); } }

/* Clickable attendance-override dropdown on the class dashboard */
.status-select { padding: .25rem 1.6rem .25rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; cursor: pointer; border: 1px solid var(--line);
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23888' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .55rem center; }
.status-select.on_time { background-color: rgba(74,222,128,.18); color: var(--good); border-color: transparent; }
.status-select.tardy   { background-color: rgba(251,191,36,.18); color: var(--warn); border-color: transparent; }
.status-select.absent  { background-color: rgba(239,68,68,.18); color: var(--bad); border-color: transparent; }
.status-select:focus { outline: 2px solid var(--accent); }
.status-select option { background: var(--panel); color: var(--text); font-weight: 600; }

/* Restroom (away) status on the class dashboard */
.roster tr.out td { background: rgba(56,189,248,.10); }
.roster td.actions { text-align: right; white-space: nowrap; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--info); }
.timer.alert { color: var(--bad); }
.roster tr.alert td { animation: flashred 1s steps(1) infinite; }
@keyframes flashred {
  0%, 100% { background: rgba(239,68,68,.12); }
  50%      { background: rgba(239,68,68,.42); }
}

/* Modal (disruption logging) */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; width: min(520px, 94vw); display: flex; flex-direction: column; gap: 1rem;
  box-shadow: var(--shadow); }
.modal-card h2 { margin: 0; }
.chip-select { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-toggle { background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: .4rem .8rem; font-weight: 500; font-size: .9rem; }
.chip-toggle.selected { background: var(--accent); border-color: var(--accent); color: white; }

/* Kiosk */
.kiosk-body { background: radial-gradient(circle at 50% 30%, #1e293b, #0f172a); }
.kiosk { max-width: none; min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 2rem; }
.kiosk-header { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between;
  align-items: center; padding: 1rem 1.5rem; color: var(--muted); }
.kiosk-brand { display: flex; flex-direction: column; line-height: 1.15; }
.kiosk-brand .brand-main { font-weight: 800; font-size: 1.1rem; letter-spacing: .3px;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent; }
/* Whole-screen red flash when a second student tries to leave for the restroom */
.kiosk-body.flash-red { animation: kioskflash .5s steps(1) 6; }
@keyframes kioskflash {
  0%, 100% { background: radial-gradient(circle at 50% 30%, #1e293b, #0f172a); }
  50%      { background: #b91c1c; }
}
.station-mode { font-weight: 700; letter-spacing: .05em; }
.station-mode.shop { color: var(--info); }
.kiosk-prompt h1 { font-size: 3rem; margin: .3rem 0; }
.tap-icon { font-size: 6rem; line-height: 1; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: .4; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }
#reader { position: fixed; opacity: 0; pointer-events: none; bottom: 0; }
.kiosk .clock { position: fixed; bottom: 1.2rem; font-size: 1.4rem; }

.kiosk-result { padding: 2rem 3rem; border-radius: 20px; min-width: min(560px, 90vw); border: 3px solid var(--line); }
.kiosk-result.good { border-color: var(--good); background: rgba(34,197,94,.12); }
.kiosk-result.warn { border-color: var(--warn); background: rgba(245,158,11,.12); }
.kiosk-result.bad  { border-color: var(--bad);  background: rgba(239,68,68,.12); }
.kiosk-result.info { border-color: var(--info); background: rgba(56,189,248,.12); }
.result-big { font-size: 3.5rem; font-weight: 800; letter-spacing: .03em; }
.result-name { font-size: 2rem; margin: .3rem 0; }
.result-msg { color: var(--muted); font-size: 1.1rem; }

/* Bell schedule */
.bell-day { margin-bottom: 1rem; }
.bell-day-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.bell-table input[type=time] { width: 100%; }

/* Kiosk manual entry */
.kiosk-link { position: fixed; bottom: 1.2rem; right: 1.5rem; background: none;
  border: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.manual-box { display: flex; flex-direction: column; gap: 1rem; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 2rem; }
.manual-box input { font-size: 2rem; text-align: center; width: min(360px, 80vw); letter-spacing: .1em; }
.manual-box .row { gap: 1rem; }

/* Student history: flags, summary, inline action forms */
.alert-banner { background: rgba(239,68,68,.12); border: 1px solid var(--bad);
  border-radius: 10px; padding: .7rem 1rem; margin: 1rem 0; display: flex;
  align-items: center; gap: .5rem; flex-wrap: wrap; }
.behavior-summary { margin-bottom: 1rem; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-top: .5rem; }
.summary-grid > div { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.summary-grid .big { font-size: 1.8rem; font-weight: 800; display: block; }
.summary-grid .big.good { color: var(--good); }
.summary-grid .big.bad { color: var(--bad); }
.summary-grid label { margin-top: .3rem; }
.trend { font-weight: 700; }
.trend.up { color: var(--bad); }
.trend.up.good { color: var(--good); }
.trend.down { color: var(--good); }
.trend.flat { color: var(--muted); font-weight: 500; }
.muted.sm, .sm { font-size: .8rem; }
form.inline { display: inline; }
.contact-form { margin-bottom: 1rem; }
.field-label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.chip-toggle.radio.selected { background: var(--accent); border-color: var(--accent); color: white; }

.hidden { display: none !important; }
