:root {
  --ink: #17231f;
  --muted: #65736e;
  --paper: #f6f8f5;
  --white: #ffffff;
  --green: #176b4d;
  --green-dark: #123d30;
  --yellow: #f2c94c;
  --red: #b42318;
  --line: #d8dfda;
  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(#dfe7e1 1px, transparent 1px); background-size: 100% 48px; }
button, input, select { font: inherit; }
button { min-height: 42px; border: 0; border-radius: 6px; padding: 0 16px; background: var(--green); color: white; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
button:hover { background: var(--green-dark); }
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: white; background: var(--green-dark); border-color: var(--green-dark); }
svg { width: 18px; height: 18px; }
.topbar { height: 68px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; background: var(--green-dark); color: white; }
.brand { color: white; text-decoration: none; font-size: 19px; font-weight: 600; }
.brand span { color: var(--yellow); font-weight: 900; letter-spacing: 0; }
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(--yellow); 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: white; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.setup-panel { padding: 28px; border-right: 1px solid var(--line); background: #fbfcfa; }
.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: white; border: 1px solid #aebbb4; border-radius: 4px; }
input:focus, select:focus { outline: 3px solid #b9ddce; 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(--yellow); background: #fff9df; 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: #765b00; }
.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: #f7f9f7; }
.scan-feedback.scanning { color: #765b00; border-color: var(--yellow); background: #fff9df; }
.scan-feedback.success { color: var(--green-dark); border-color: var(--green); background: #eaf7f0; 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: white; padding: 0 12px; }
.status-buttons button + button { border-left: 1px solid var(--line); }
.status-buttons button.active { color: white; background: var(--green-dark); }
.score-table-wrap { overflow: auto; margin-top: 16px; border: 1px solid var(--line); }
.score-table { width: 100%; min-width: 680px; border-collapse: collapse; background: white; }
.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: #fbfcfa; }
.score-table thead th { position: sticky; top: 0; z-index: 2; background: var(--green-dark); color: white; }
.score-table thead th:first-child { z-index: 3; background: var(--green-dark); }
.score-table th small { display: block; margin-top: 3px; color: #b9d5ca; 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: white; border: 1px solid var(--line); border-top: 5px solid var(--yellow); border-radius: 6px; box-shadow: 0 24px 80px rgb(18 61 48 / 24%); }
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) {
  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; }
}