:root {
  color-scheme: light;
  --page: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --surface-blue: #e8f1ff;
  --surface-green: #e7f6ef;
  --surface-orange: #fff2e5;
  --text: #17202a;
  --muted: #667085;
  --muted-strong: #4d5a68;
  --line: #dfe5ec;
  --line-strong: #cbd4df;
  --blue: #1769e0;
  --blue-dark: #0f55bd;
  --green: #1f8a5b;
  --green-dark: #166f49;
  --orange: #d66b19;
  --red: #c83a3a;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(26, 39, 52, 0.05);
  --font: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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;
}

.admin-shell {
  min-height: 100vh;
}

.admin-shell.is-hidden,
.admin-auth-gate.is-hidden {
  display: none !important;
}

.admin-auth-gate {
  display: grid;
  min-height: 100vh;
  padding: 20px;
  place-items: center;
  background: var(--page);
}

.auth-card {
  display: grid;
  justify-items: stretch;
  width: min(100%, 400px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(22, 38, 54, 0.13);
}

.auth-mark {
  width: 48px;
  height: 48px;
  margin-bottom: 17px;
  font-size: 20px;
}

.auth-card h1 {
  margin: 0;
  font-size: 25px;
}

.auth-card > p {
  margin: 7px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.auth-card code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--blue-dark);
}

.auth-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 15px;
}

.text-button {
  margin-top: 10px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.code-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.code-input-row .secondary-button {
  white-space: nowrap;
}

.admin-header,
.student-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 70px;
  padding: 12px max(18px, calc((100vw - 1360px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--blue-dark);
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.header-date {
  text-align: center;
}

.header-date span,
.header-date strong {
  display: block;
}

.header-date span {
  color: var(--muted);
  font-size: 11px;
}

.header-date strong {
  margin-top: 1px;
  font-size: 13px;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button,
.secondary-button,
.primary-button,
.batch-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border-radius: 7px;
  font-weight: 700;
}

.icon-button {
  width: 38px;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.icon-button:hover,
.secondary-button:hover {
  background: var(--surface-soft);
}

.secondary-button {
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted-strong);
}

.primary-button {
  padding: 8px 12px;
  border: 1px solid var(--blue-dark);
  background: var(--blue);
  color: #fff;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.admin-main {
  width: min(calc(100% - 32px), 1360px);
  margin: 0 auto;
  padding: 22px 0 50px;
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  display: flex;
  align-items: flex-start;
  min-height: 106px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  display: grid;
  width: 36px;
  height: 36px;
  margin-right: 12px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--surface-blue);
  color: var(--blue);
}

.stat-icon.icon-warn {
  background: var(--surface-orange);
  color: var(--orange);
}

.stat-icon.icon-soft {
  background: #edf0f4;
  color: #566575;
}

.stat-card span,
.stat-card small {
  display: block;
}

.stat-card > div > span {
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin: 5px 0 2px;
  font-size: 27px;
  line-height: 1;
}

.stat-card small {
  color: var(--muted);
  font-size: 11px;
}

.session-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.session-main {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.session-main h2 {
  margin: 0;
  font-size: 17px;
}

.session-main p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.session-state {
  min-width: 64px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.session-state.is-open {
  background: var(--surface-green);
  color: var(--green-dark);
}

.session-state.is-closed {
  background: var(--surface-soft);
  color: var(--muted-strong);
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.session-countdown {
  min-width: 58px;
  color: var(--blue-dark);
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  align-items: start;
  gap: 14px;
}

.roster-panel,
.class-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.class-tabs,
.status-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9fb;
}

.class-tab,
.status-tab {
  min-height: 31px;
  padding: 5px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.class-tab:hover,
.status-tab:hover {
  color: var(--text);
}

.class-tab.is-active,
.status-tab.is-active {
  background: var(--surface);
  color: var(--blue-dark);
  box-shadow: 0 1px 3px rgba(26, 39, 52, 0.1);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
}

.search-field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}

.search-field input {
  min-width: 0;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.search-field input:focus {
  box-shadow: none;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.bulk-toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.bulk-toolbar select {
  min-height: 34px;
  padding: 5px 28px 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
}

.roster-groups {
  padding: 14px;
}

.roster-group + .roster-group {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.roster-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.roster-group-heading h2 {
  margin: 0;
  font-size: 15px;
}

.roster-group-heading span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 7px;
}

.roster-button {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  text-align: left;
}

.roster-button:hover {
  border-color: #b9c5d2;
  background: #fbfcfd;
}

.roster-button.is-present {
  border-color: #a8dbc5;
  background: #f4fbf7;
}

.roster-button.is-leave {
  border-color: #eed6b9;
  background: #fffbf5;
}

.roster-button.is-absent {
  border-color: #efc4c4;
  background: #fff7f7;
}

.student-avatar {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-soft);
  color: #435263;
  font-size: 12px;
  font-weight: 800;
}

.roster-button.is-present .student-avatar {
  background: var(--surface-green);
  color: var(--green-dark);
}

.roster-button.is-leave .student-avatar {
  background: var(--surface-orange);
  color: #a8500b;
}

.roster-button.is-absent .student-avatar {
  background: #ffe9e9;
  color: var(--red);
}

.roster-name {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-state {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
}

.roster-state .icon {
  width: 12px;
  height: 12px;
  stroke-width: 3;
}

.roster-button.is-present .roster-state {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.roster-button.is-leave .roster-state {
  border-color: #d98a35;
  background: #d98a35;
  color: #fff;
}

.roster-button.is-absent .roster-state {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.panel-heading {
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 0;
  font-size: 16px;
}

.panel-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.class-stat-list {
  display: grid;
  gap: 8px;
  padding: 13px;
}

.class-stat-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fcfdfe;
}

.class-stat-row.is-active {
  border-color: #b8d3f8;
  background: #f7faff;
}

.class-stat-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.class-stat-top strong {
  font-size: 13px;
}

.class-stat-top span {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
}

.class-progress {
  height: 7px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ebf1;
}

.class-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.class-stat-row button {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.class-stat-row button:hover {
  color: var(--blue-dark);
  text-decoration: underline;
}

.class-stat-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.class-stat-actions button {
  margin-top: 0;
}

.class-exception-text {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.side-section {
  padding: 0 13px 13px;
}

.side-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.side-section-title h3 {
  margin: 0;
  font-size: 13px;
}

.side-section-title span {
  color: var(--muted);
  font-size: 10px;
}

.session-history,
.activity-list {
  display: grid;
  gap: 7px;
  max-height: 240px;
  overflow-y: auto;
}

.session-history-item {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fcfdfe;
}

.session-history-item.is-active {
  border-color: #b8d3f8;
  background: #f7faff;
}

.session-history-item button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.session-history-item strong,
.session-history-item span {
  display: block;
}

.session-history-item strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-history-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.activity-item {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fcfdfe;
}

.activity-item .student-avatar {
  width: 27px;
  height: 27px;
  font-size: 10px;
}

.activity-item strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-item small {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.activity-time {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.side-empty {
  padding: 14px 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.status-pill.status-leave {
  background: var(--surface-orange);
  color: #a8500b;
}

.status-pill.status-absent {
  background: #fff0f0;
  color: var(--red);
}

.batch-button {
  width: calc(100% - 26px);
  margin: 0 13px 13px;
  padding: 9px 12px;
  border: 1px solid var(--blue-dark);
  background: var(--blue);
  color: #fff;
}

.batch-button:disabled {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--muted);
  opacity: 0.75;
}

.empty-state {
  display: grid;
  justify-items: center;
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state.is-hidden,
.student-shell[hidden] {
  display: none;
}

.empty-state .icon {
  width: 28px;
  height: 28px;
}

.empty-state strong {
  margin-top: 9px;
  color: var(--text);
}

.empty-state span {
  margin-top: 3px;
  font-size: 12px;
}

.student-shell {
  display: none;
  min-height: 100vh;
}

html[data-app-mode="student"] .admin-shell {
  display: none;
}

html[data-app-mode="student"] .admin-auth-gate {
  display: none !important;
}

html[data-app-mode="student"] .student-shell {
  display: block;
}

.student-header {
  grid-template-columns: 1fr auto;
  min-height: 68px;
  padding-right: 18px;
  padding-left: 18px;
}

.online-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
}

.student-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-install-button {
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid #b8d3f8;
  border-radius: 6px;
  background: var(--surface-blue);
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 800;
}

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--surface-green);
}

.student-main {
  width: min(100% - 28px, 560px);
  margin: 0 auto;
  padding: 22px 0 45px;
}

.student-step[hidden],
.student-workspace[hidden] {
  display: none !important;
}

.student-step h1 {
  margin: 4px 0 0;
  font-size: 27px;
}

.student-step > p {
  margin: 7px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.student-kicker {
  display: block;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.class-choice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.class-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.class-choice:hover {
  border-color: #b9c5d2;
}

.class-choice strong,
.class-choice span {
  display: block;
}

.class-choice strong {
  font-size: 15px;
}

.class-choice span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.back-link {
  margin-bottom: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.student-search {
  margin-bottom: 10px;
}

.student-name-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 470px;
  overflow-y: auto;
}

.student-name-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  text-align: left;
}

.student-name-option:hover {
  border-color: #b9c5d2;
  background: #fbfcfd;
}

.student-name-option strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-note {
  min-height: 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.student-workspace {
  display: grid;
  gap: 13px;
}

.student-person {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.student-person .student-avatar {
  width: 44px;
  height: 44px;
  background: var(--surface-blue);
  color: var(--blue-dark);
  font-size: 17px;
}

.student-person > div > span,
.student-person > div > strong {
  display: block;
}

.student-person > div > span {
  color: var(--muted);
  font-size: 11px;
}

.student-person > div > strong {
  margin-top: 1px;
  font-size: 16px;
}

.student-switch-button {
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 700;
}

.student-date {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 3px;
}

.student-date span {
  color: var(--muted);
  font-size: 11px;
}

.student-date strong {
  font-size: 13px;
}

.student-session-card {
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.student-session-card span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.student-session-card strong {
  font-size: 14px;
}

.student-session-card small {
  color: var(--muted);
  font-size: 10px;
}

.student-session-card.is-open {
  border-color: #a8dbc5;
  background: #f8fdfa;
}

.student-session-card.is-open span {
  color: var(--green-dark);
}

.checkin-card {
  display: grid;
  justify-items: center;
  padding: 27px 20px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.checkin-card.is-present {
  border-color: #a8dbc5;
  background: #f8fdfa;
}

.checkin-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-blue);
  color: var(--blue);
}

.checkin-card.is-present .checkin-icon {
  background: var(--surface-green);
  color: var(--green);
}

.checkin-icon .icon {
  width: 26px;
  height: 26px;
}

.checkin-label {
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.checkin-card > strong {
  margin-top: 3px;
  font-size: 24px;
}

.checkin-card > p {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.checkin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 49px;
  padding: 11px 18px;
  border: 1px solid var(--blue-dark);
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.checkin-button.is-complete {
  border-color: #a8dbc5;
  background: var(--surface-green);
  color: var(--green-dark);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 50;
  max-width: min(90vw, 420px);
  padding: 10px 14px;
  border-radius: 7px;
  background: #1f2d3b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.qr-dialog {
  width: min(calc(100% - 28px), 430px);
  max-height: 90vh;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.start-dialog {
  width: min(calc(100% - 28px), 460px);
  max-height: 90vh;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.start-dialog::backdrop {
  background: rgba(20, 29, 39, 0.48);
  backdrop-filter: blur(2px);
}

.dialog-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(22, 38, 54, 0.2);
}

.dialog-form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field > span {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.form-field textarea {
  resize: vertical;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 18px 18px;
}

.dialog-card > .dialog-actions {
  padding-top: 4px;
}

.qr-dialog::backdrop {
  background: rgba(20, 29, 39, 0.48);
  backdrop-filter: blur(2px);
}

.qr-card {
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(22, 38, 54, 0.2);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 17px 13px;
  border-bottom: 1px solid var(--line);
}

.dialog-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.dialog-header h2 {
  margin: 0;
  font-size: 18px;
}

.qr-body {
  display: grid;
  justify-items: center;
  padding: 20px;
}

.qr-code-frame {
  display: grid;
  width: 240px;
  height: 240px;
  padding: 10px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.qr-code-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-countdown {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 13px;
}

.qr-countdown span {
  color: var(--muted);
  font-size: 12px;
}

.qr-countdown strong {
  color: var(--blue-dark);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.qr-help {
  margin: 5px 0 13px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.qr-link-box {
  width: 100%;
  padding: 9px 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted-strong);
  font-family: Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
}

.qr-actions .secondary-button,
.qr-actions .primary-button {
  width: 100%;
}

@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .class-panel {
    order: -1;
  }

  .class-stat-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .admin-header {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .header-date {
    display: none;
  }

  .header-actions .secondary-button {
    width: 38px;
    padding: 0;
    font-size: 0;
  }

  .overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 92px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .session-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .session-actions {
    justify-content: space-between;
  }

  .bulk-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-toolbar label {
    justify-content: space-between;
  }

  .class-tabs,
  .status-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
  }

  .status-tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .class-tab,
  .status-tab {
    width: 100%;
  }

  .roster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .admin-main {
    width: min(100% - 20px, 1360px);
    padding-top: 14px;
  }

  .brand span {
    display: none;
  }

  .roster-groups {
    padding: 10px;
  }

  .class-stat-list {
    grid-template-columns: 1fr;
  }

  .overview {
    grid-template-columns: 1fr;
  }

  .session-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .session-countdown {
    text-align: center;
  }

  .class-choice-list,
  .student-name-list {
    grid-template-columns: 1fr;
  }

  .student-main {
    width: min(100% - 24px, 560px);
    padding-top: 18px;
  }

  .student-step h1 {
    font-size: 24px;
  }

  .student-person {
    grid-template-columns: 42px minmax(0, 1fr) auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}
