:root {
  --ink: #d9f6df;
  --muted: #88a795;
  --paper: #050a07;
  --white: #0a1410;
  --green: #5cff7a;
  --green-dark: #1ea94f;
  --yellow: #b8ff3d;
  --red: #b42318;
  --line: #1c3225;
  font-family: "Avenir Next", "Gill Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background-image: linear-gradient(rgb(12 28 18 / 65%) 1px, transparent 1px), radial-gradient(circle at 20% 0%, rgb(46 142 80 / 20%), transparent 42%); background-size: 100% 48px, 100% 100%; }
button, input, select { font: inherit; }
button { min-height: 42px; border: 0; border-radius: 6px; padding: 0 16px; background: var(--green); color: #041008; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button:hover { background: #7bff95; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary, button.tab { color: var(--ink); background: transparent; border: 1px solid var(--line); }
button.tab.active { color: #041008; background: var(--green); border-color: var(--green); }
svg { width: 18px; height: 18px; }
.topbar { height: 74px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(90deg, #060e09 0%, #0b1a11 60%, #0e2415 100%); color: var(--ink); border-bottom: 1px solid #153220; }
.brand { color: var(--ink); text-decoration: none; font-size: 19px; font-weight: 700; display: inline-flex; align-items: center; gap: 10px; }
.brand-logo { height: 32px; width: auto; display: block; filter: drop-shadow(0 0 8px rgb(92 255 122 / 28%)); }
.brand-attendance { color: var(--yellow); text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; font-weight: 900; }
main { padding: 36px clamp(20px, 5vw, 72px) 72px; }
.view { max-width: 1280px; margin: 0 auto; }
.view.narrow { max-width: 520px; margin-top: clamp(24px, 8vh, 90px); background: var(--white); border: 1px solid var(--line); border-top: 5px solid var(--green); padding: clamp(24px, 5vw, 48px); border-radius: 6px; }
.hidden { display: none !important; }
h1, h2 { font-family: Georgia, serif; margin: 0; font-weight: 600; }
h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.05; }
h2 { font-size: 23px; }
.eyebrow { margin: 0 0 8px; color: var(--green); text-transform: uppercase; font-size: 12px; font-weight: 900; letter-spacing: 0; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.account-actions, .dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.account-help { margin: 20px 0 0; color: var(--muted); font-size: 13px; }
.workspace { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); min-height: 620px; background: #09150f; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.setup-panel { padding: 28px; border-right: 1px solid var(--line); background: #0c1c14; }
.operations { min-width: 0; }
.stack { display: grid; gap: 17px; margin-top: 24px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 800; }
input, select { width: 100%; min-height: 43px; padding: 8px 11px; color: var(--ink); background: #06100b; border: 1px solid #2a4a38; border-radius: 4px; }
input:focus, select:focus { outline: 3px solid rgb(92 255 122 / 22%); border-color: var(--green); }
.toggle-row { grid-template-columns: 1fr auto; align-items: center; }
.toggle-row input { width: 42px; height: 22px; accent-color: var(--green); }
.optional { color: var(--muted); font-weight: 500; }
.tabs { display: flex; gap: 8px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.session-summary { margin: 18px 26px 0; padding: 12px 14px; border-left: 4px solid var(--green); background: #0d2416; font-weight: 800; }
.autosave-status { min-height: 20px; margin: 10px 26px 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.autosave-status.saving { color: #e8ff8a; }
.autosave-status.success { color: var(--green); }
.autosave-status.failure { color: var(--red); }
.tab-panel { padding: 26px; }
#reader { max-width: 620px; margin: 0 auto 18px; border: 1px dashed var(--line); min-height: 260px; }
.scanner-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 18px; }
.notice, .empty { color: var(--muted); padding: 16px 0; }
.notice.compact { min-height: 18px; padding: 0; margin: 0; color: var(--green); font-size: 13px; font-weight: 700; }
.scan-feedback { min-height: 54px; margin: 12px 0 0; padding: 14px 16px; border-left: 4px solid var(--line); background: #0c1c14; }
.scan-feedback.scanning { color: #e8ff8a; border-color: var(--yellow); background: #1a2f16; }
.scan-feedback.success { color: var(--ink); border-color: var(--green); background: #10361b; font-weight: 700; }
.scan-feedback.failure { color: var(--red); border-color: var(--red); background: #fff0ee; }
.error { color: var(--red); min-height: 18px; margin: 0; font-size: 13px; }
.qr-output { margin-top: 24px; text-align: center; border-top: 1px solid var(--line); padding-top: 22px; }
.qr-output img { width: min(100%, 280px); aspect-ratio: 1; object-fit: contain; image-rendering: crisp-edges; }
.qr-output p { color: var(--muted); font-size: 13px; }
.attendance-panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.attendance-panel-heading p { margin: 0; color: var(--muted); font-size: 13px; text-align: right; }
.attendance-column-headings { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(210px, auto) minmax(130px, 1fr); gap: 10px; padding: 14px 0 2px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.attendance-row { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(210px, auto) minmax(130px, 1fr); gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.attendance-row strong { display: block; }
.attendance-row small { color: var(--muted); }
.status-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 210px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.student-attendance .status-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 260px; }
.restricted-status { color: var(--muted); font-size: 12px; font-weight: 700; }
.session-hours { color: var(--muted); font-size: 13px; }
.status-buttons button { min-height: 40px; border-radius: 0; color: var(--ink); background: #0b1611; padding: 0 12px; }
.status-buttons button + button { border-left: 1px solid var(--line); }
.status-buttons button.active { color: #041008; background: var(--green); }
.score-table-wrap { overflow: auto; margin-top: 16px; border: 1px solid var(--line); }
.score-table { width: 100%; min-width: 680px; border-collapse: collapse; background: #09150f; }
.score-table th, .score-table td { min-width: 120px; padding: 10px; text-align: left; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.score-table th:first-child { min-width: 210px; position: sticky; left: 0; z-index: 1; background: #102016; }
.score-table thead th { position: sticky; top: 0; z-index: 2; background: #112816; color: var(--green); }
.score-table thead th:first-child { z-index: 3; background: #112816; }
.score-table th small { display: block; margin-top: 3px; color: #9cd7ab; font-weight: 500; }
.score-table tbody th small { color: var(--muted); }
.score-table input { min-width: 92px; }
.score-table input:invalid { border-color: var(--red); background: #fff0ee; }
.score-total { font-weight: 900; color: var(--green-dark); }
.status-Yes { color: var(--green); }
dialog { width: min(92vw, 480px); padding: 0; color: var(--ink); background: #0a1410; border: 1px solid var(--line); border-top: 5px solid var(--green); border-radius: 6px; box-shadow: 0 24px 80px rgb(0 0 0 / 55%); }
dialog::backdrop { background: rgb(23 35 31 / 48%); }
dialog .stack { margin: 0; padding: 28px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.dialog-actions { justify-content: flex-end; }
.icon-button { width: 42px; padding: 0; flex: 0 0 42px; }

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 74px; padding-top: 10px; padding-bottom: 10px; align-items: start; gap: 10px; flex-direction: column; }
  .brand-logo { height: 28px; }
  main { padding-top: 24px; }
  .workspace { grid-template-columns: 1fr; }
  .setup-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .tabs { overflow-x: auto; }
  .attendance-row { grid-template-columns: 1fr 1fr; }
  .attendance-row .person { grid-column: 1 / -1; }
  .student-attendance .status-buttons, .student-attendance .restricted-status, .student-attendance input, .ta-attendance .restricted-status, .ta-attendance .session-hours { grid-column: 1 / -1; min-width: 0; }
  .attendance-column-headings { display: none; }
  .attendance-panel-heading { align-items: start; flex-direction: column; gap: 6px; }
  .attendance-panel-heading p { text-align: left; }
  .inline-form { grid-template-columns: 1fr; }
  .page-heading { align-items: center; }
  .page-heading h1 { font-size: 34px; }
}