:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1f2b;
  --muted: #4d5666;      /* 7.3:1 on white */
  --border: #b8bfcc;
  --accent: #1d4ed8;     /* 6.7:1 on white */
  --accent-text: #ffffff;
  --accent-soft: #e6edff;
  --ok: #0b6b3a;
  --danger: #a31515;
  --focus: #b45309;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 1rem 0 .5rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .25rem; }
main { max-width: 64rem; margin: 0 auto; padding: 0 1rem 3rem; }
.muted { color: var(--muted); }
.campus-name { font-weight: 500; color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-row { max-width: 64rem; margin: 0 auto; padding: .5rem 1rem; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.brand { font-weight: 700; font-size: 1.15rem; }
.campus-switch { display: flex; gap: .5rem; align-items: center; margin-left: auto; }
.signout { display: flex; gap: .5rem; align-items: center; }
.who { color: var(--muted); font-size: .9rem; }
nav { max-width: 64rem; margin: 0 auto; padding: 0 1rem; display: flex; flex-wrap: wrap; gap: .25rem; }
nav a {
  display: inline-block; padding: .75rem 1rem; text-decoration: none; color: var(--text);
  border-bottom: 4px solid transparent; font-weight: 600; min-height: 44px;
}
nav a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--accent); }
nav a:hover { background: var(--accent-soft); }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .5rem 1rem; font: inherit; font-weight: 600;
  background: var(--surface); color: var(--text); border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: #1e40af; }
.btn.small { min-height: 40px; padding: .25rem .75rem; font-size: .95rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select {
  font: inherit; min-height: 44px; padding: .4rem .6rem; color: var(--text); background: var(--surface);
  border: 2px solid var(--border); border-radius: 8px; max-width: 100%;
}
input[type="checkbox"] { min-height: 0; width: 1.4rem; height: 1.4rem; }
label { font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-top: 2rem; }
.card.narrow { max-width: 28rem; margin-left: auto; margin-right: auto; }
.card form { display: grid; gap: .5rem; }
.code-input { font-size: 1.75rem; letter-spacing: .3em; text-align: center; }
.notice, .banner { background: var(--accent-soft); border: 2px solid var(--accent); border-radius: var(--radius); padding: .6rem .9rem; }
.banner { background: #fdecec; border-color: var(--danger); color: #5c0b0b; display: flex; gap: .75rem; align-items: center; justify-content: space-between; }
.banner[hidden] { display: none; }
.error { color: var(--danger); font-weight: 600; }
.note { margin-top: 1.25rem; padding: .75rem 1rem; border-left: 5px solid var(--accent); background: var(--surface); }

/* Tap grid: one row per category, In-Person and Remote side by side */
.tap-grid { display: grid; gap: .75rem; margin-top: .75rem; }
.cat-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: .75rem 1rem; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem;
}
.cat-info h2 { margin: 0; }
.cat-info p { margin: .1rem 0 0; }
.desc { color: var(--text); }
.time { color: var(--muted); font-size: .9rem; }
.cat-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.tap {
  position: relative; min-height: 84px; padding: .5rem; font: inherit; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 3px solid var(--accent); border-radius: 14px;
  display: grid; place-items: center; align-content: center; gap: 0; touch-action: manipulation;
}
.tap:active { transform: scale(.98); }
.tap .tap-label { font-weight: 700; font-size: 1rem; }
.tap .tap-count { font-size: 1.75rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tap .tap-msg { font-size: .85rem; font-weight: 700; min-height: 1.1em; }
.tap.confirmed { background: var(--ok); border-color: var(--ok); }
.tap.pending { border-style: dashed; border-color: #fff; outline: 2px solid var(--accent); }
.tap:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
.undo-row { margin-top: 1rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.undo-row .btn { min-width: 9rem; min-height: 52px; }

@media (max-width: 40rem) {
  .cat-row { grid-template-columns: 1fr; }
  .campus-switch { margin-left: 0; width: 100%; }
}

/* Gate count */
.gate-list { display: grid; gap: .75rem; }
.gate-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; }
.gate-row label { display: block; margin-bottom: .25rem; }
.gate-field { display: flex; gap: .5rem; }
.gate-field input { flex: 1; font-size: 1.25rem; min-width: 0; }
.gate-row p { margin: .25rem 0 0; }

/* Edit */
.date-pick { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.day-strip { list-style: none; padding: 0; margin: .25rem 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.day-strip a { display: inline-block; padding: .35rem .6rem; border: 2px solid var(--border); border-radius: 8px; background: var(--surface); text-decoration: none; min-height: 40px; line-height: 1.8; }
.day-strip a[aria-current="date"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.mark { color: #8a4b00; font-weight: 700; }
table.grid { border-collapse: collapse; width: 100%; max-width: 40rem; background: var(--surface); margin: .75rem 0; }
table.grid caption { text-align: left; font-weight: 700; padding: .5rem 0; }
table.grid th, table.grid td { border: 1px solid var(--border); padding: .4rem .6rem; text-align: left; }
table.grid thead th { background: var(--accent-soft); }
table.grid td input[type="number"] { width: 7rem; }
.history { margin-top: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem 1rem; }
.history summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* Forms: export + admin */
.filters, .inline-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin: .75rem 0; }
.field { display: grid; gap: .2rem; }
.field.check { display: flex; align-items: center; gap: .5rem; padding-bottom: .6rem; }
.field.wide { flex: 1 1 16rem; }
.field.wide input { width: 100%; }
.field [hidden], .field[hidden] { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; width: 100%; }
.rows .row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .75rem; margin-bottom: .5rem; }
.static { padding: .6rem 0; word-break: break-all; }
.label { font-weight: 600; }

@media print { .top, .skip { display: none; } }
