:root {
  color-scheme: light;
  --ink: #111738;
  --muted: #5f6478;
  --paper: #f6f5f2;
  --sheet: #ffffff;
  --soft: #efeff4;
  --line: #dddde5;
  --line-strong: #bfc1d0;
  --green: #141c52;
  --green-hover: #202d76;
  --green-tint: #e8eaf3;
  --lime: #8a704c;
  --lime-ink: #ffffff;
  --coral: #9e3e33;
  --coral-tint: #f8e5e1;
  --amber: #725735;
  --amber-tint: #f3ede4;
  --input: #ffffff;
  --scrim: rgba(20, 28, 82, .08);
  --shadow-auth: 0 24px 70px rgba(20, 28, 82, .13);
  --focus: #8a704c;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --ease: cubic-bezier(.2, 0, 0, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f2ed;
  --muted: #b8bbca;
  --paper: #0d1126;
  --sheet: #141a35;
  --soft: #1c2446;
  --line: #2b3459;
  --line-strong: #46517d;
  --green: #d4b986;
  --green-hover: #e4cda1;
  --green-tint: #222d58;
  --lime: #d4b986;
  --lime-ink: #141c52;
  --coral: #ef9488;
  --coral-tint: #482923;
  --amber: #dfc28d;
  --amber-tint: #3a3026;
  --input: #10162f;
  --scrim: rgba(0, 0, 0, .22);
  --shadow-auth: 0 28px 80px rgba(0, 0, 0, .34);
  --focus: #d4b986;
}

* { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-color: var(--line-strong) var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  transition: background-color 180ms var(--ease), color 180ms var(--ease);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
h1, h2, h3 { text-wrap: balance; }
p, li, small { text-wrap: pretty; }
::selection { background: var(--lime); color: var(--lime-ink); }

header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(5vw, 24px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 10px;
  color: var(--ink);
  font: 800 19px Manrope, sans-serif;
  text-decoration: none;
  letter-spacing: -.02em;
}
.brand small { padding-inline-start: 10px; border-inline-start: 1px solid var(--line-strong); color: var(--muted); font: 500 12px "DM Sans", sans-serif; letter-spacing: 0; }

.header-tools { display: flex; align-items: center; gap: 14px; }

.theme-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--sheet);
  color: var(--ink);
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), scale 140ms var(--ease);
}

.theme-toggle:hover { background: var(--soft); border-color: var(--line-strong); }
.theme-toggle:active { scale: .96; }
.theme-icon { position: absolute; width: 19px; height: 19px; transition: opacity 180ms var(--ease), scale 180ms var(--ease), filter 180ms var(--ease); }
.theme-icon svg { display: block; width: 100%; height: 100%; }
.theme-icon-moon, [data-theme="dark"] .theme-icon-sun { opacity: 0; scale: .25; filter: blur(4px); }
.theme-icon-sun, [data-theme="dark"] .theme-icon-moon { opacity: 1; scale: 1; filter: blur(0); }

main { width: min(1180px, 90vw); margin: 0 auto; }

.entry {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
  align-items: center;
  gap: clamp(48px, 9vw, 128px);
  padding: 72px 0 96px;
}

.entry h1 {
  max-width: 720px;
  margin: 0 0 20px;
  font: 800 clamp(2.7rem, 5.5vw, 4.8rem)/1.02 Manrope, sans-serif;
  letter-spacing: -.035em;
}
.entry p { max-width: 640px; margin: 0; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.14rem); line-height: 1.65; }
.role-grid { display: grid; border-top: 1px solid var(--line-strong); }

.role-card {
  min-height: 108px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 20px 4px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background-color 120ms var(--ease);
}

.role-card:hover { background: var(--sheet); }
.role-card:active { scale: .99; }
.role-card strong { display: block; font: 700 18px Manrope, sans-serif; letter-spacing: -.015em; }
.role-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.arrow { color: var(--green); font-size: 23px; transition: translate 140ms var(--ease); }
.arrow svg { display: block; width: 21px; height: 21px; }
.role-card:hover .arrow, .class-row:hover .arrow { translate: 4px 0; }

.text-action {
  min-height: 44px;
  padding: 14px 2px 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.text-action:hover { color: var(--green-hover); }

.screen { padding: clamp(42px, 6vw, 72px) 0 96px; }
.back { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0; margin: 0 0 24px; border: 0; background: transparent; color: var(--muted); }
.back svg { width: 18px; height: 18px; }
.back:hover { color: var(--ink); }

.panel {
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--sheet);
}
.auth { max-width: 520px; margin: 12px auto; box-shadow: var(--shadow-auth); }
.wide-auth { max-width: 700px; }
.panel h1, .panel h2 { margin: 0 0 10px; font: 800 clamp(1.8rem, 4vw, 2.2rem) Manrope, sans-serif; letter-spacing: -.03em; }
.panel h3 { font: 700 18px Manrope, sans-serif; }
.sub { max-width: 65ch; margin: 0 0 28px; color: var(--muted); line-height: 1.55; }
.eyebrow { margin-bottom: 10px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }

.field { margin: 18px 0; }
.field label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.field small { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }
.field input, .field textarea, .field select, .decision-box input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--input);
  color: var(--ink);
  caret-color: var(--green);
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease), background-color 180ms var(--ease);
}
.field textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.field input:hover, .field textarea:hover, .field select:hover, .decision-box input:hover { border-color: var(--muted); }
.field input:focus, .field textarea:focus, .field select:focus, .decision-box input:focus { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.code { font: 700 22px Manrope, sans-serif !important; font-variant-numeric: tabular-nums; letter-spacing: .14em; text-transform: uppercase; }

.btn {
  min-height: 44px;
  padding: 11px 17px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--green);
  color: var(--paper);
  font-weight: 700;
  transition: background-color 120ms var(--ease), color 120ms var(--ease), border-color 120ms var(--ease), scale 120ms var(--ease);
}
.btn:hover { background: var(--green-hover); }
.btn:active:not(:disabled) { scale: .96; }
.btn.full { width: 100%; margin-top: 8px; }
.btn.secondary { border-color: var(--line); background: var(--soft); color: var(--ink); }
.btn.secondary:hover { border-color: var(--line-strong); background: var(--sheet); }
.btn.danger { background: var(--coral-tint); color: var(--coral); }
.btn.danger:hover { background: var(--coral); color: var(--paper); }
.btn:disabled { border-color: var(--line); background: var(--soft); color: var(--muted); opacity: 1; }
.error { min-height: 20px; margin-top: 12px; color: var(--coral); font-size: 13px; }

.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.dash-head h1 { margin: 0; font: 800 clamp(2.1rem, 4vw, 3rem) Manrope, sans-serif; letter-spacing: -.035em; }
.page-detail { margin: 7px 0 0; color: var(--muted); }
.staff-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; padding: 7px 11px; border-radius: 999px; background: var(--green-tint); color: var(--green); font-size: 12px; font-weight: 700; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line-strong); }
.action-card { min-width: 0; padding: 26px 24px; border-right: 1px solid var(--line); background: transparent; }
.action-card:last-child { border-right: 0; }
.action-card.done { background: var(--green-tint); }
.action-card h3 { margin: 16px 0 8px; font: 700 18px Manrope, sans-serif; }
.action-card p { min-height: 44px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.survey-check { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 14px; font-weight: 700; cursor: pointer; }
.survey-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--green); }
.survey-check:has(input:disabled) { cursor: default; }
.survey-na { margin-bottom: 0; color: var(--muted); }
.big-icon { color: var(--green); font-size: 23px; }
.big-icon svg { display: block; width: 24px; height: 24px; }
.status { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.status-pending { color: var(--amber); }
.status-rejected { color: var(--coral); }
.claim-box { margin-top: 24px; }
.note { margin-top: 20px; padding: 15px 17px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted); font-size: 14px; }

.admin-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; }
.settings { align-self: start; position: sticky; top: 20px; padding: 26px; }
.code-display { margin-top: 5px; color: var(--green); font: 800 31px Manrope, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: .15em; }
.window-copy { margin: 6px 0 16px; color: var(--muted); font-size: 13px; }
.pulse-btn { background: var(--lime); color: var(--lime-ink); animation: live-pulse 2.2s ease-out infinite; }
.pulse-btn:hover { background: var(--lime); filter: brightness(.96); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 18px 0; }
.toggle-row small { color: var(--muted); }
.toggle { width: 48px; height: 28px; flex: 0 0 auto; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--soft); }
.toggle span { display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: translate 180ms var(--ease), background-color 180ms var(--ease); }
.toggle.on { background: var(--green-tint); }
.toggle.on span { translate: 20px 0; background: var(--green); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line-strong); margin-bottom: 30px; }
.stat { padding: 18px 20px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font: 800 28px Manrope, sans-serif; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; }
.section-title { margin: 0 0 14px; font: 700 20px Manrope, sans-serif; letter-spacing: -.02em; }
.queue-title { margin-top: 34px; }
.claims { display: grid; border-top: 1px solid var(--line); }
.claim { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--line); }
.claim p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.claim-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.claim-actions .btn { min-height: 44px; padding: 9px 12px; font-size: 13px; }
.empty { padding: 30px 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); text-align: center; line-height: 1.6; }

.admin-participation { display: grid; grid-template-columns: minmax(170px, .7fr) minmax(320px, 1.3fr); gap: 34px; margin: 32px 0; padding: 26px; border-block: 1px solid var(--line-strong); background: var(--sheet); }
.admin-participation p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.admin-participation .field:first-child { margin-top: 0; }
.conflict-section { margin: 34px 0; }
.conflict-list { display: grid; gap: 12px; }
.conflict { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px; border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line)); border-radius: var(--radius); background: var(--amber-tint); }
.conflict-source { padding: 12px; border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); border-radius: var(--radius-sm); }
.conflict-source span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.conflict-source strong { font-size: 14px; line-height: 1.45; }
.conflict-meta { display: flex; flex-direction: column; justify-content: center; }
.conflict-meta small { margin-top: 4px; color: var(--muted); }
.conflict .claim-actions { justify-content: flex-end; }

.table-wrap { overflow: auto; margin-top: 24px; border-block: 1px solid var(--line-strong); background: var(--sheet); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
tbody tr { transition: background-color 100ms var(--ease); }
tbody tr:hover { background: var(--soft); }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: var(--line-strong); }
.dot.yes { background: var(--green); }
.dot.waiting { background: var(--amber); }
.dot.no { background: var(--coral); }
.session-summary { margin-top: 48px; }
.summary-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.summary-heading .section-title { margin-bottom: 4px; }
.summary-heading p, .summary-heading > span { margin: 0; color: var(--muted); font-size: 13px; }
.session-summary .table-wrap { margin-top: 16px; }
.roster-state { display: inline-flex; align-items: center; gap: 4px; }

#toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(380px, calc(100vw - 44px)); padding: 13px 16px; border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); box-shadow: 0 14px 40px var(--scrim); opacity: 0; translate: 0 10px; pointer-events: none; transition: opacity 160ms var(--ease), translate 160ms var(--ease); }
#toast.show { opacity: 1; translate: 0; }

.feedback-trigger { position: fixed; left: 20px; bottom: 20px; z-index: 15; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--sheet); color: var(--ink); font-weight: 700; box-shadow: 0 10px 28px var(--scrim); }
.feedback-trigger:hover { background: var(--soft); }
.feedback-dialog { width: min(540px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--sheet); color: var(--ink); box-shadow: 0 28px 80px rgba(13, 17, 38, .28); }
.feedback-dialog::backdrop { background: rgba(13, 17, 38, .58); }
.feedback-dialog form { padding: 28px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.dialog-heading h2 { margin: 0; font: 700 22px Manrope, sans-serif; }
.dialog-heading p { margin: 6px 0 0; color: var(--muted); line-height: 1.5; }
.dialog-close { width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 28px; line-height: 1; }
.dialog-close:hover { background: var(--soft); color: var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.feedback-list { border-top: 1px solid var(--line-strong); }
.feedback-row { display: grid; grid-template-columns: minmax(150px, .35fr) minmax(0, 1fr); gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.feedback-row p { margin: 0; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-meta { display: grid; align-content: start; gap: 5px; }
.feedback-meta small { color: var(--muted); }

.auth-link { width: 100%; margin-top: 16px; text-align: center; }
.form-pair, .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.result-panel { text-align: center; }
.state-mark { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; background: var(--green-tint); color: var(--green); font-size: 23px; }
.state-mark svg { width: 24px; height: 24px; }
.class-toolbar { display: flex; justify-content: flex-end; margin: -8px 0 18px; }
.class-list, .review-list { border-top: 1px solid var(--line-strong); }
.class-row { width: 100%; display: grid; grid-template-columns: 1fr auto 24px; gap: 24px; align-items: center; padding: 22px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; transition: background-color 100ms var(--ease); }
.class-row:hover { background: var(--sheet); }
.class-row:active { scale: .995; }
.class-row strong, .class-row small { display: block; }
.class-row strong { font: 700 18px Manrope, sans-serif; }
.class-row small, .class-policy { margin-top: 4px; color: var(--muted); font-size: 13px; }
.class-policy { text-align: right; line-height: 1.5; }
.inline-form { margin-bottom: 28px; box-shadow: none; }
.inline-form h2 { font-size: 22px; }

.review-row { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(300px, 1.2fr); gap: 20px; align-items: center; padding: 20px 4px; border-bottom: 1px solid var(--line); }
.review-row strong, .review-row a, .review-row small { display: block; }
.review-row a { margin: 4px 0; color: var(--green); text-underline-offset: 3px; }
.review-row small, .decision-copy { color: var(--muted); }
.review-state { display: flex; align-items: center; gap: 10px; }
.decision-box { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
.decision-box input { min-width: 0; }
.decision-copy { font-size: 14px; }

.class-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; border-block: 1px solid var(--line-strong); }
.setup-status strong, .setup-status span { display: block; }
.setup-status span { margin-top: 3px; color: var(--muted); font-size: 13px; }
.live-session-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; padding: 24px 0; border-block: 1px solid var(--line-strong); }
.start-session { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.start-session h2 { margin: 0; font: 700 22px Manrope, sans-serif; }
.start-session p { margin: 6px 0 0; color: var(--muted); }
.session-start-controls { display: flex; align-items: end; gap: 10px; }
.session-start-controls .field { min-width: 110px; margin: 0; }
.live-queues { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
.class-summary { display: flex; border-bottom: 1px solid var(--line-strong); margin-bottom: 34px; }
.class-summary > div { min-width: 130px; padding: 18px 30px 18px 0; margin-right: 30px; }
.class-summary b, .class-summary span { display: block; }
.class-summary b { font: 800 26px Manrope, sans-serif; font-variant-numeric: tabular-nums; }
.class-summary span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 34px; }
.workspace-grid > * { min-width: 0; }
.roster-table { margin-top: 0; }
.work-panel { margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); }
.work-panel summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.work-panel p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.work-panel h2 { margin: 0; font: 700 18px Manrope, sans-serif; }
.setup-panel { padding: clamp(22px, 4vw, 34px); border-block: 1px solid var(--line-strong); background: var(--sheet); }
.roster-import.work-panel { margin-top: 24px; }
.import-heading, .roster-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.import-heading h2, .roster-heading h2 { margin: 0; font: 700 20px Manrope, sans-serif; }
.import-heading p, .roster-heading p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.file-rule { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.import-layout { display: grid; grid-template-columns: minmax(0, .9fr) minmax(260px, 1.1fr); gap: 30px; align-items: start; margin-top: 24px; }
.import-guide { padding: 16px 18px; border-block: 1px solid var(--line); background: var(--soft); }
.import-guide h3 { margin: 0 0 10px; font: 700 16px Manrope, sans-serif; }
.import-guide ol { margin: 0; padding-inline-start: 22px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.import-guide li + li { margin-top: 4px; }
.import-layout form .field { margin-top: 0; }
.text-action.compact { width: auto; padding-top: 0; text-align: right; }
.file-state { overflow-wrap: anywhere; color: var(--ink) !important; font-weight: 700; }
.admin-list { border-block: 1px solid var(--line); }
.admin-list > div { padding: 13px 0; border-bottom: 1px solid var(--line); }
.admin-list > div:last-child { border-bottom: 0; }
.admin-list strong, .admin-list small { display: block; overflow-wrap: anywhere; }
.admin-list small { margin-top: 3px; color: var(--muted); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
code { padding: 2px 5px; border-radius: 4px; background: var(--soft); color: var(--ink); font-size: .9em; }
input[type="file"] { font-size: 14px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible, .decision-box input:focus-visible { outline: none; }

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--lime) 0%, transparent); }
  45% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--lime) 22%, transparent); }
}

@media (max-width: 900px) {
  .entry { grid-template-columns: 1fr; align-content: center; gap: 48px; padding-block: 64px; }
  .admin-grid, .workspace-grid { grid-template-columns: 1fr; }
  .live-queues { grid-template-columns: 1fr; }
  .settings { position: static; }
  .cards { grid-template-columns: 1fr; }
  .action-card { border-right: 0; border-bottom: 1px solid var(--line); }
  .action-card:last-child { border-bottom: 0; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .admin-participation, .conflict { grid-template-columns: 1fr; }
  .review-row { grid-template-columns: 1fr auto; }
  .decision-box, .decision-copy { grid-column: 1 / -1; }
  .conflict .claim-actions { justify-content: flex-start; }
  .workspace-aside { padding-top: 8px; border-top: 1px solid var(--line-strong); }
}

@media (max-width: 640px) {
  .feedback-trigger { left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
  .feedback-dialog form { padding: 22px; }
  .feedback-row { grid-template-columns: 1fr; gap: 12px; }
  body { font-size: 16px; }
  header { height: 60px; padding-inline: max(16px, env(safe-area-inset-left)); }
  .brand { display: block; font-size: 17px; }
  .brand small { display: none; }
  main { width: calc(100vw - 32px); }
  .entry { min-height: calc(100svh - 60px); align-content: start; gap: 40px; padding-block: 42px max(64px, env(safe-area-inset-bottom)); }
  .entry h1 { font-size: clamp(2.25rem, 12vw, 3.2rem); line-height: 1.04; }
  .entry p { font-size: 1rem; }
  .role-card { grid-template-columns: 1fr auto; min-height: 92px; padding-block: 16px; }
  .screen { padding: 28px 0 max(88px, calc(64px + env(safe-area-inset-bottom))); }
  .dash-head { align-items: flex-start; flex-direction: column; }
  .dash-head h1 { font-size: clamp(1.9rem, 9vw, 2.5rem); overflow-wrap: anywhere; }
  .staff-actions { width: 100%; }
  .staff-actions .btn { flex: 1 1 calc(50% - 4px); }
  .staff-actions .btn:last-child { flex-basis: 100%; }
  .form-pair, .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .stat { display: flex; align-items: baseline; justify-content: space-between; border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .claim { grid-template-columns: 1fr; }
  .claim-actions { justify-content: flex-start; }
  .claim-actions .btn { flex: 1 1 130px; }
  .cards { border-top: 1px solid var(--line-strong); }
  .action-card { padding: 22px 0; }
  .action-card h3 { margin-top: 0; }
  .action-card p { min-height: 0; }
  .action-card .btn { width: 100%; }
  .survey-check { width: 100%; }
  .big-icon { display: none; }
  .pill { max-width: 100%; white-space: normal; line-height: 1.4; }
  .class-row { grid-template-columns: 1fr 20px; }
  .class-policy { display: none; }
  .review-row { grid-template-columns: 1fr; }
  .review-state, .decision-box, .decision-copy { grid-column: 1; }
  .decision-box { grid-template-columns: 1fr 1fr; }
  .decision-box input { grid-column: 1 / -1; }
  .class-actions { align-items: stretch; flex-direction: column; }
  .live-session-panel, .start-session { align-items: stretch; grid-template-columns: 1fr; flex-direction: column; }
  .live-session-panel .btn { width: 100%; }
  .session-start-controls { align-items: stretch; flex-direction: column; }
  .session-start-controls .btn { width: 100%; }
  .class-actions .btn { width: 100%; }
  .class-summary { display: grid; grid-template-columns: repeat(3, 1fr); }
  .class-summary > div { min-width: 0; margin: 0; padding: 14px 8px 14px 0; }
  .class-summary span { overflow-wrap: anywhere; }
  .import-heading, .roster-heading { align-items: stretch; flex-direction: column; }
  .summary-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .summary-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .summary-table, .summary-table tbody, .summary-table tr, .summary-table td { display: block; width: 100%; }
  .summary-table tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .summary-table td { display: grid; grid-template-columns: minmax(110px, .8fr) 1fr; gap: 12px; padding: 7px 14px; border: 0; white-space: normal; }
  .summary-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .file-rule { align-self: flex-start; }
  .import-layout { grid-template-columns: 1fr; gap: 20px; }
  .setup-panel { margin-inline: -16px; padding-inline: 16px; }
  .roster-import.work-panel { padding: 18px 16px; }
  .import-button { width: 100%; }
  .text-action.compact { min-height: 44px; align-self: flex-start; text-align: left; }
  input[type="file"] { min-height: 52px; padding: 10px; font-size: 16px; }
  .roster-table { overflow: visible; border: 0; background: transparent; }
  .roster-table table, .roster-table tbody, .roster-table tr, .roster-table td { display: block; width: 100%; }
  .roster-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .roster-table tbody { display: grid; gap: 10px; }
  .roster-table tr { padding: 12px 14px; border: 1px solid var(--line); background: var(--sheet); }
  .roster-table td { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 5px 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .roster-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
  .admin-participation { padding-inline: 0; background: transparent; }
  #toast { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }
}

@media (pointer: coarse) {
  button, summary, input, select, textarea { min-height: 44px; }
  .theme-toggle { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

.sheet-sync-panel { margin-bottom: 32px; }
.sheet-sync-panel p { overflow-wrap: anywhere; }
.sync-guidance, .sync-detail { color: var(--muted); font-size: 14px; line-height: 1.5; }
.sheet-sync-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.sheet-sync-actions .btn { width: auto; text-align: center; text-decoration: none; }
.quick-sheet-link { margin-inline-start: auto; text-align: center; text-decoration: none; }
.account-security { margin-top: 40px; }
.account-security h2 { margin-top: 0; }
@media (max-width: 640px) { .quick-sheet-link { margin-inline-start: 0; } }

.bulk-records { display: grid; grid-template-columns: minmax(180px, .45fr) minmax(0, 1.55fr); gap: 28px; margin-top: 38px; padding-block: 22px; border-block: 1px solid var(--line-strong); }
.bulk-records p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.bulk-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.bulk-actions label { flex: 1 1 230px; }
.bulk-actions label span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; }
.bulk-actions input { width: 100%; }
.editable-summary { min-width: 790px; }
.editable-summary td:first-child strong, .editable-summary td:first-child small { display: block; }
.editable-summary td:first-child small { margin-top: 4px; color: var(--muted); }
.record-toggle { min-height: 36px; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: transparent; color: var(--ink); font-weight: 700; }
.record-toggle.is-active { border-color: var(--green); background: var(--green); color: white; }
.participation-control { display: flex; min-width: 320px; align-items: center; gap: 10px; }
.stepper { display: inline-grid; grid-template-columns: 36px 38px 36px; min-width: 110px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.stepper button { min-height: 36px; border: 0; background: var(--soft); color: var(--ink); font-size: 19px; }
.stepper button:hover { background: var(--line); }
.stepper output { display: grid; place-items: center; border-inline: 1px solid var(--line-strong); font-weight: 800; font-variant-numeric: tabular-nums; }
.inline-note { flex: 1; }
.inline-note input { width: 100%; min-height: 36px; padding: 7px 9px; }
.muted { color: var(--muted); }

@media (max-width: 760px) {
  .bulk-records { grid-template-columns: 1fr; }
  .bulk-actions { align-items: stretch; }
  .bulk-actions .btn { width: 100%; }
  .editable-summary { min-width: 0; }
  .editable-summary td { grid-template-columns: 105px minmax(0, 1fr); }
  .participation-control { min-width: 0; align-items: stretch; flex-direction: column; }
}
