*{box-sizing:border-box}body{font-family:system-ui,-apple-system,Segoe UI,sans-serif;margin:0;background:#f4f5f7;color:#222}
nav{display:flex;gap:1rem;align-items:center;background:#1f3b5a;padding:.6rem 1rem}nav a{color:#fff;text-decoration:none;font-weight:600}
nav .right{margin-left:auto;color:#cfd8e3;display:flex;gap:.5rem;align-items:center}
main{max-width:1000px;margin:auto;padding:1rem}
.card{background:#fff;padding:1rem;border-radius:8px;margin:1rem 0;box-shadow:0 1px 3px #0002}.narrow{max-width:360px}
label{display:block;margin:.4rem 0;font-weight:600}label.inline{font-weight:normal}
.row{display:flex;gap:1rem;align-items:flex-end;flex-wrap:wrap}
input,select,button{font-size:1rem;padding:.45rem;border:1px solid #bbb;border-radius:6px;min-height:2.5rem;line-height:1.25;box-sizing:border-box}
button{background:#e8e8e8;cursor:pointer}.primary{background:#1f6feb;color:#fff;border:1px solid #1f6feb}.danger{background:#c62828;color:#fff;border:1px solid #c62828}
.row > button{min-height:2.5rem}
select#event{font-size:1.2rem;min-width:320px}
input.scan{width:100%;font-size:2rem;padding:.6rem;margin:1rem 0}
.status{font-size:2.6rem;font-weight:800;text-align:center;padding:2rem 1rem;border-radius:12px;color:#fff;min-height:9rem}
.status.idle{background:#ddd;color:#555}.status.ok{background:#1b8a2f}.status.duplicate{background:#e68a00}.status.notfound,.status.error{background:#c62828}
.count{font-size:1.6rem;text-align:center;margin:1rem;font-weight:700}
.hint{color:#666;text-align:center}#reader{max-width:420px;margin:auto}
table{width:100%;border-collapse:collapse;background:#fff}th,td{padding:.4rem;border-bottom:1px solid #ddd;text-align:left}
td input{width:100%}.nowrap{white-space:nowrap}
.flash{padding:.6rem 1rem;border-radius:6px;margin:.5rem 0}.flash.ok{background:#dff3e3}.flash.error{background:#fde0e0}
.tabs a{margin-right:1rem;padding:.3rem .6rem;border-radius:6px;background:#fff;text-decoration:none}.tabs a.on{background:#1f3b5a;color:#fff}
.status.notonlist{background:#c62828;outline:6px dashed #fff;outline-offset:-16px}
td.warn{color:#b35c00;font-weight:700}
.checklist{max-height:480px;overflow:auto;border:1px solid #ddd;border-radius:6px}
.inline-form{display:inline}a.btn{padding:.45rem .6rem;background:#e8e8e8;border-radius:6px;text-decoration:none;color:#222}
.tabs a{display:inline-block;margin-bottom:.3rem}th a{color:inherit}
.selall{margin:.4rem 0}.selall input{transform:scale(1.3);margin-right:.4rem}

/* student search autocomplete */
.ac-wrap { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin: 2px 0 0; padding: 0; list-style: none;
  background: #fff; border: 1px solid #bbb; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); max-height: 22em; overflow-y: auto; }
.ac-list li { padding: .5em .75em; cursor: pointer; display: flex; justify-content: space-between; gap: 1em; color: #222; }
.ac-list li.active, .ac-list li:hover { background: #dbeafe; }
.ac-list li small { color: #555; white-space: nowrap; }
.ac-list li.empty { color: #777; cursor: default; }
a.button{display:inline-block;padding:.5rem .9rem;border-radius:6px;text-decoration:none}

/* v3.4 branding + login */
.nav-logo{background:#fff;border-radius:6px;padding:4px 8px;display:inline-flex;align-items:center;overflow:visible;line-height:0}.nav-logo img{height:36px;width:auto;max-width:min(180px,55vw);display:block;object-fit:contain;object-position:left center}
.login-head{display:block;text-align:center;margin:1rem auto .5rem;width:100%}
.login-logo{display:block;margin:0 auto .75rem;max-width:300px;width:75%;height:auto;float:none;object-fit:contain;padding:6px 0 10px;box-sizing:content-box}
.login-head h1{text-align:center;margin:.25rem 0 0}
.login-page{display:block;max-width:360px;margin:0 auto;text-align:center}.login-page .narrow{margin-left:auto;margin-right:auto;text-align:left}
.button.big{display:block;text-align:center;font-size:1.1rem;padding:.75rem}
.local-login summary{cursor:pointer;background:#e8e8e8;color:#222;list-style:none;text-align:center}
.local-login summary::-webkit-details-marker{display:none}.local-login[open] summary{margin-bottom:.6rem}
.muted{color:#666}

/* v3.5 responsive header + mobile */
html,body{max-width:100%;overflow-x:hidden}
.navtog,.hamburger{display:none}
.navlinks{display:flex;gap:1rem;align-items:center;flex:1;min-width:0}
.table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.table-wrap table{min-width:100%}
img,select,input,textarea{max-width:100%}
@media (max-width:700px){
  .nav-logo{padding:4px 6px}.nav-logo img{height:32px;max-width:min(160px,52vw)}
  nav.topbar{flex-wrap:wrap;gap:0;padding:.5rem .75rem;position:relative}
  .hamburger{display:flex;flex-direction:column;justify-content:center;gap:5px;margin-left:auto;width:44px;height:44px;cursor:pointer;padding:10px}
  .hamburger span{display:block;height:3px;background:#fff;border-radius:2px}
  .navlinks{display:none;flex-basis:100%;flex-direction:column;align-items:stretch;gap:0;margin-top:.5rem;border-top:1px solid #ffffff33}
  .navtog:checked ~ .navlinks{display:flex}
  .navlinks > a{padding:.75rem .25rem;min-height:44px;border-bottom:1px solid #ffffff22;font-size:1.05rem}
  nav .right{margin:0;padding:.75rem .25rem;flex-wrap:wrap;justify-content:space-between;gap:.5rem}
  nav .right .who{overflow-wrap:anywhere;min-width:0;flex:1}
  nav .right button{min-height:44px;padding:.5rem 1rem}
  main{padding:.75rem}
  h1{font-size:1.5rem;margin:.5rem 0 .75rem}
  input,select,textarea,button{font-size:16px}
  button,select,input:not([type=checkbox]):not([type=radio]),a.btn,a.button,summary.button{min-height:44px}
  .row{flex-direction:column;align-items:stretch;gap:.6rem}
  .row > label,.row > button,.row > a{width:100%}
  .row label select,.row label input{display:block;width:100%;margin-top:.25rem}
  select#event{min-width:0;width:100%;font-size:16px}
  .scan-controls #camBtn{width:100%}
  input.scan{font-size:1.4rem;margin:.75rem 0}
  .status{font-size:1.9rem;padding:1.5rem .75rem;min-height:7rem}
  .card{padding:.75rem}.narrow{max-width:100%}
  .table-wrap{margin:0 -.75rem;width:calc(100% + 1.5rem);padding:0 .75rem}
  .table-wrap table{min-width:600px}
  .table-wrap td input{min-width:120px}
  .tabs a{margin-right:.4rem}
  .ac-list{max-height:50vh}.ac-list li{padding:.75em;flex-wrap:wrap;gap:.25em}
  .login-page{max-width:100%}
}

/* v3.6 recurring */
.tag{display:inline-block;font-size:.75rem;font-weight:700;background:#e8eef6;color:#1f3b5a;border-radius:4px;padding:.1rem .4rem;vertical-align:middle}
.recurring h2{margin:.2rem 0}.recurring .big-btn{font-size:1.05rem;padding:.6rem 1rem;margin:.4rem 0}
.recurring .other-date{margin:.4rem 0}.recurring details{margin-top:.5rem}.recurring summary{cursor:pointer;font-weight:600}
@media (max-width:700px){.recurring .big-btn{width:100%}}

/* v3.7 lists */
.paste{margin:.5rem 0}.paste summary{cursor:pointer;font-weight:600}.paste textarea{width:100%;box-sizing:border-box;font:inherit;margin-top:.4rem}
select[name=audience]{max-width:100%}
@media (max-width:700px){select[name=audience]{width:100%}}

/* v3.8 inline list builder */
.newlist{width:100%;border-top:1px solid #dde3ea;margin-top:.5rem;padding-top:.5rem}.newlist h2{margin:.2rem 0}
.newlist label{display:block}.newlist .checklist{max-height:50vh;overflow:auto}
[hidden]{display:none!important}

/* v4.1 start / end */
.tap,.go-btn,.chooser summary,#chooser{min-height:44px}
.go-btn{background:#1e8e3e;color:#fff;border:0;border-radius:8px;font-size:1.1rem;font-weight:700;padding:.7rem 1.2rem;cursor:pointer}
.go-btn:hover{background:#17722f}.go-btn:disabled{opacity:.6}
.next-up h2{margin:.2rem 0}.next-up .go-btn{width:100%;font-size:1.25rem;min-height:56px}
.running-banner{position:sticky;top:0;z-index:5;display:flex;flex-wrap:wrap;gap:.6rem;align-items:center;justify-content:space-between;
  background:#e6f4ea;border:2px solid #1e8e3e;border-radius:8px;padding:.7rem 1rem;margin-bottom:.8rem}
.banner-count{font-weight:700;margin:0}
.live-dot{display:inline-block;width:.7rem;height:.7rem;border-radius:50%;background:#1e8e3e;animation:pulse 1.5s infinite}
@keyframes pulse{50%{opacity:.3}}
.status.locked{background:#f1f3f4;color:#5f6368;border:2px dashed #bbb}
input.scan:disabled{background:#f1f3f4;cursor:not-allowed}
.chooser{margin:.6rem 0}.chooser summary{cursor:pointer;color:#1f5fa8;display:flex;align-items:center}
.chooser-form{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:.4rem}.chooser-form select{flex:1 1 240px;max-width:100%}
#confirmDlg{border:0;border-radius:10px;padding:1.2rem;max-width:min(420px,92vw);box-shadow:0 8px 30px rgba(0,0,0,.3)}
#confirmDlg p{font-size:1.1rem;margin-top:0}.dlg-actions{justify-content:flex-end;gap:.5rem}
.ended-card{border-left:4px solid #c5221f}
@media (max-width:700px){.running-banner{flex-direction:column;align-items:stretch}.running-banner .tap{width:100%}
  .chooser-form .go-btn,.chooser-form select{width:100%}}

/* v4.3 roster upload */
.roster-upload{margin:.6rem 0 1rem;padding:.8rem 1rem;border:1px dashed #9aa0a6;border-radius:8px;background:#fafafa}
.roster-upload h3{margin:0 0 .4rem;font-size:1rem}
.roster-upload input[type=file]{max-width:100%;min-height:44px}

/* v4.5 form control height: primary/danger keep 1px border; shared min-height */

/* expected roster on scan page (read-only) */
.expected-roster{margin-top:1rem}
.expected-roster h3{margin:.25rem 0 .5rem;font-size:1.05rem}
.expected-roster ul{list-style:none;margin:0;padding:0;max-height:40vh;overflow-y:auto;border:1px solid #ddd;border-radius:8px}
.expected-roster li{padding:.4rem .7rem;border-bottom:1px solid #eee;font-weight:600}
.expected-roster li small{font-weight:400;color:#777}
.expected-roster li.out{color:#c62828}
.expected-roster li.in{color:#2e7d32;font-weight:400}
.expected-roster select{margin:0 0 .5rem;max-width:100%}

/* v4.10: name review warnings/errors are distinct, scoped to the new feature. */
.name-review-results section{margin:1rem 0;padding:.75rem;border:1px solid #aaa;border-radius:6px}
.name-review-results .name-errors{border:2px solid #c62828;background:#fff5f5}
.name-review-results tr.low_confidence,.name-review-results tr.ambiguous{background:#fff6db}
.name-review-results select{max-width:100%;min-width:180px}
.name-review-results td p{margin:0 0 .4rem}

/* v4.17: vertically align Add event with the check-in dropdown */
form.card.row{display:flex;flex-wrap:wrap;align-items:flex-end;gap:1rem}
form.card.row > label{margin-bottom:0}

/* v4.17: name override indicator on Students */
.name-edited{display:inline-block;font-size:.7rem;font-weight:700;background:#e8eef6;color:#1f3b5a;border-radius:4px;padding:.05rem .35rem;margin-left:.25rem;vertical-align:middle;cursor:help}
@media (max-width:700px){form.card.row{align-items:stretch}}

/* v4.24 Sick List highlight */
tr.sick td,li.sick{background:#fff1c2}.sick-tag{display:inline-block;margin-left:.35rem;padding:0 .35rem;border-radius:4px;background:#b35c00;color:#fff;font-size:.75em;font-weight:700}
ul.picker-results{list-style:none;padding:0;margin:.2rem 0}ul.picker-results button{margin:.1rem 0}
/* v4.26 multi-select checkbox dropdowns */
.multi-field{display:flex;flex-direction:column;gap:.15rem}
.multi{position:relative;min-width:10rem}
.multi>summary{list-style:none;cursor:pointer;border:1px solid #bbb;border-radius:6px;padding:.45rem 1.8rem .45rem .45rem;min-height:2.5rem;box-sizing:border-box;background:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:18rem}
.multi>summary::-webkit-details-marker{display:none}
.multi>summary::after{content:"▾";position:absolute;right:.6rem;top:.6rem}
.multi-opts{position:absolute;z-index:20;left:0;top:100%;min-width:100%;max-height:18rem;overflow:auto;background:#fff;border:1px solid #bbb;border-radius:6px;padding:.4rem;box-shadow:0 4px 14px rgba(0,0,0,.15)}
.multi-opts label{display:flex;gap:.5rem;align-items:center;padding:.35rem .25rem;white-space:nowrap}
.multi-opts .multi-group{font-weight:bold;margin:.3rem 0 0;font-size:.9rem}
@media (max-width:700px){.row>.multi-field{width:100%}.multi,.multi>summary{max-width:none;width:100%}.multi-opts{position:static;box-shadow:none}.multi-opts label{min-height:44px}}
