:root {
  --ink: #17352f;
  --ink-soft: #334c46;
  --muted: #697872;
  --muted-light: #8c9893;
  --paper: #f4f6f1;
  --surface: #fffefb;
  --surface-muted: #f8faf7;
  --line: #dce3df;
  --line-strong: #c9d3ce;
  --primary: #176b5b;
  --primary-dark: #105046;
  --primary-soft: #e4f1ed;
  --blue: #3178a8;
  --blue-soft: #e7f0f7;
  --orange: #b96328;
  --orange-soft: #f9eee5;
  --red: #a84452;
  --red-soft: #f8e9eb;
  --yellow: #b4851f;
  --yellow-soft: #faf2dc;
  --shadow-sm: 0 1px 2px rgba(23, 53, 47, 0.05);
  --shadow-md: 0 10px 30px rgba(23, 53, 47, 0.08);
  --radius: 7px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(23, 53, 47, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 53, 47, 0.022) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.page-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 35%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: #fff;
  background: var(--ink);
  border-radius: 7px;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

.brand-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(23, 53, 47, 0.12);
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.button:hover {
  background: rgba(23, 53, 47, 0.055);
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible,
.icon-button:focus-visible,
.account-button:focus-visible,
.group-card-button:focus-visible,
.quick-value:focus-visible {
  outline: 3px solid rgba(49, 120, 168, 0.28);
  outline-offset: 2px;
}

.button.primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 5px rgba(23, 107, 91, 0.18);
}

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

.button.quiet {
  border-color: var(--line);
  background: var(--surface);
}

.button.quiet:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.button.danger {
  color: var(--red);
  border-color: #e9c8cd;
  background: var(--red-soft);
}

.button.wide {
  width: 100%;
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
}

.button svg,
.icon-button svg,
.date-control svg,
.account-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.9;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(23, 53, 47, 0.06);
}

.icon-only {
  width: 40px;
  padding: 0;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.field input,
.field select {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 19px,
    calc(100% - 12px) 19px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  cursor: pointer;
}

.field input::placeholder {
  color: #a0aaa6;
}

.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.12);
}

.form-error {
  margin: 2px 0 0;
  padding: 9px 11px;
  color: #8f3340;
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  font-size: 13px;
  line-height: 1.5;
}

/* Login */

.login-view {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.login-brand {
  display: flex;
  width: min(1180px, calc(100% - 48px));
  min-height: 88px;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

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

.login-brand strong {
  font-size: 16px;
  letter-spacing: 0.01em;
}

.login-brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.login-main {
  display: grid;
  width: min(1180px, calc(100% - 48px));
  flex: 1;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.75fr);
  gap: clamp(64px, 9vw, 140px);
  align-items: center;
  margin: 0 auto;
  padding: 64px 0 80px;
}

.login-context {
  max-width: 590px;
}

.login-context h1 {
  max-width: 560px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(36px, 4.4vw, 56px);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.18;
}

.login-lead {
  max-width: 530px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.login-flow {
  display: grid;
  max-width: 560px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 44px;
  border-top: 1px solid var(--line-strong);
}

.login-flow div {
  padding: 17px 16px 0 0;
}

.login-flow span {
  color: var(--primary);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

.login-flow p {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.login-panel {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.panel-heading h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.01em;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.login-role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin-top: 22px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.login-role-tabs button {
  min-height: 35px;
  color: var(--muted);
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.login-role-tabs button.is-active {
  color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 48px;
}

.password-field .inline-icon {
  position: absolute;
  top: 3px;
  right: 3px;
}

.login-note {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted-light);
  font-size: 11px;
  line-height: 1.6;
}

/* App chrome */

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px max(24px, calc((100vw - 1420px) / 2));
  border-bottom: 1px solid rgba(201, 211, 206, 0.82);
  background: rgba(255, 254, 251, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-copy {
  display: grid;
  min-width: 0;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-control {
  display: flex;
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.date-control:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.1);
}

.date-control input {
  width: 122px;
  height: 36px;
  padding: 0;
  color: var(--ink);
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  font-weight: 600;
}

.account-button {
  display: flex;
  height: 44px;
  align-items: center;
  gap: 9px;
  margin-left: 4px;
  padding: 0 8px 0 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.account-button:hover {
  border-color: var(--line);
  background: var(--surface);
}

.avatar {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  border-radius: 6px;
  background: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.account-copy {
  display: grid;
  min-width: 84px;
  text-align: left;
}

.account-copy strong {
  max-width: 150px;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
}

.account-chevron {
  display: inline-flex;
  color: var(--muted);
}

.account-chevron svg {
  width: 14px;
  height: 14px;
}

.main-content {
  width: min(1420px, calc(100% - 48px));
  min-height: calc(100vh - 132px);
  margin: 0 auto;
  padding: 34px 0 50px;
}

.app-footer {
  display: flex;
  width: min(1420px, calc(100% - 48px));
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto;
  color: var(--muted-light);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.loading-state {
  display: grid;
  min-height: 400px;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Dashboard */

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 27px;
}

.page-intro h1 {
  margin: 0;
  font-size: clamp(27px, 3vw, 38px);
  font-weight: 740;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.page-intro h1 .title-date {
  white-space: nowrap;
}

.page-intro h1 .title-date::before {
  content: " · ";
}

.page-intro .intro-copy {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
}

.deadline-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--orange);
  font-weight: 650;
}

.deadline-tag svg {
  width: 14px;
  height: 14px;
}

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

.teacher-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 24px;
}

.teacher-intro h1 {
  margin: 0;
  font-size: clamp(27px, 3vw, 38px);
}

.teacher-intro p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.teacher-date {
  display: grid;
  min-width: 166px;
  padding: 13px 16px;
  border-left: 3px solid var(--primary);
  background: var(--surface);
}

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

.teacher-date strong {
  margin-top: 5px;
  font-size: 14px;
}

.notice-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 12px 14px;
  color: #7a5714;
  border: 1px solid #ead9ac;
  border-radius: var(--radius);
  background: var(--yellow-soft);
  font-size: 12px;
  line-height: 1.55;
}

.notice-strip svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.notice-strip strong {
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 27px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 254, 251, 0.55);
}

.kpi-item {
  position: relative;
  min-width: 0;
  padding: 20px 22px;
}

.kpi-item + .kpi-item {
  border-left: 1px solid var(--line);
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.kpi-label svg {
  width: 15px;
  height: 15px;
}

.kpi-value {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-top: 9px;
}

.kpi-value strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: clamp(26px, 2.5vw, 34px);
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
}

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

.kpi-item.accent .kpi-value strong {
  color: var(--primary);
}

.kpi-item.warning .kpi-value strong {
  color: var(--orange);
}

.kpi-sub {
  margin: 5px 0 0;
  color: var(--muted-light);
  font-size: 11px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 32px 0 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.section-heading .section-count {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.group-grid.single-group {
  grid-template-columns: minmax(0, 300px);
}

.group-card {
  --group-color: var(--primary);
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.group-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--group-color);
  content: "";
}

.group-card.is-active {
  border-color: var(--group-color);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--group-color) 14%, transparent);
}

.group-card-button {
  width: 100%;
  padding: 17px 16px 16px;
  color: inherit;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.group-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.group-card h3 {
  overflow: hidden;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-card .room {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.group-number {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--group-color);
}

.group-metrics {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 18px;
}

.group-metrics strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 27px;
  font-weight: 680;
  letter-spacing: -0.04em;
}

.group-metrics span {
  padding-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
}

.group-progress {
  height: 4px;
  margin-top: 12px;
  border-radius: 3px;
  background: #e9eeeb;
  overflow: hidden;
}

.group-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--group-color);
  transition: width 280ms ease;
}

.group-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 10px;
}

.group-status .complete {
  color: var(--primary);
  font-weight: 700;
}

.group-status .pending {
  color: var(--orange);
  font-weight: 700;
}

.table-section {
  margin-top: 30px;
}

.table-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.table-toolbar h2 {
  margin: 0;
  font-size: 19px;
}

.table-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.filter-chip {
  min-height: 32px;
  padding: 0 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.class-filter {
  min-height: 32px;
  max-width: 170px;
  padding: 0 28px 0 10px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.class-filter:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(23, 107, 91, 0.1);
}

.filter-chip:hover,
.filter-chip.is-active {
  color: var(--primary);
  border-color: #b9d4cc;
  background: var(--primary-soft);
}

.filter-chip svg,
.section-count svg {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.report-table th {
  height: 43px;
  padding: 0 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-align: left;
  white-space: nowrap;
}

.report-table td {
  height: 54px;
  padding: 9px 14px;
  color: var(--ink-soft);
  border-bottom: 1px solid #edf0ee;
  vertical-align: middle;
}

.report-table tr:last-child td {
  border-bottom: 0;
}

.report-table tbody tr:hover {
  background: #fafbf9;
}

.class-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.class-initial {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  flex: 0 0 auto;
  color: var(--ink);
  border-radius: 5px;
  background: var(--surface-muted);
  font-size: 10px;
  font-weight: 700;
}

.class-cell strong {
  font-size: 13px;
  font-weight: 650;
}

.class-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  color: inherit;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.class-link:hover strong {
  color: var(--primary);
}

.class-link svg {
  width: 12px;
  height: 12px;
  color: var(--muted-light);
}

.sub-label {
  display: block;
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 9px;
}

.room-cell {
  white-space: nowrap;
}

.count-cell {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.count-cell.missing {
  color: var(--muted-light);
  font-size: 13px;
  font-weight: 500;
}

.count-unit {
  margin-left: 3px;
  color: var(--muted);
  font-family: var(--font);
  font-size: 9px;
  font-weight: 500;
}

.count-stack {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.mini-action {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.mini-action svg {
  width: 13px;
  height: 13px;
}

.mini-action.primary {
  color: var(--primary);
  border-color: #b8d4cc;
  background: var(--primary-soft);
}

.mini-action.warning {
  color: var(--orange);
  border-color: #ebd5c2;
  background: var(--orange-soft);
}

.rollcall-result {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.status-chip {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.status-chip::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-chip.done {
  color: var(--primary);
  background: var(--primary-soft);
}

.status-chip.pending {
  color: var(--orange);
  background: var(--orange-soft);
}

.note-cell {
  max-width: 230px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-cell {
  color: var(--muted-light);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  white-space: nowrap;
}

.late-label {
  display: inline-block;
  margin-left: 4px;
  color: var(--red);
  font-size: 9px;
}

.mobile-row-detail {
  display: none;
}

.empty-row td {
  height: 160px;
  color: var(--muted);
  text-align: center;
}

.empty-inline {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.empty-inline svg {
  width: 24px;
  height: 24px;
  color: var(--muted-light);
}

/* Teacher entry */

.roster-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 13px 15px;
  border: 1px solid #c8ddd7;
  border-radius: var(--radius);
  background: #edf6f3;
}

.roster-strip.attention {
  border-color: #ebd5c2;
  background: var(--orange-soft);
}

.roster-strip-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  color: var(--primary);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.65);
}

.roster-strip.attention .roster-strip-icon {
  color: var(--orange);
}

.roster-strip-icon svg {
  width: 18px;
  height: 18px;
}

.roster-strip > div {
  min-width: 0;
  flex: 1;
}

.roster-strip strong {
  display: block;
  font-size: 13px;
}

.roster-strip p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.roster-strip .button {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.72);
}

.entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 20px;
  align-items: start;
}

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

.entry-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.entry-panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.entry-panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.entry-form {
  padding: 24px 22px 22px;
}

.count-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.count-label strong {
  font-size: 14px;
}

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

.count-entry {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  gap: 6px;
}

.stepper-button {
  display: grid;
  place-items: center;
  min-height: 68px;
  color: var(--primary);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  cursor: pointer;
}

.stepper-button:hover {
  border-color: #b6d2ca;
  background: var(--primary-soft);
}

.stepper-button svg {
  width: 20px;
  height: 20px;
}

.count-input-wrap {
  position: relative;
}

.count-input {
  width: 100%;
  height: 68px;
  padding: 0 70px 0 18px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 34px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.count-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.11);
}

.count-unit-large {
  position: absolute;
  top: 50%;
  right: 18px;
  color: var(--muted);
  font-size: 12px;
  transform: translateY(-50%);
}

.quick-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.quick-value {
  min-height: 29px;
  padding: 0 9px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-size: 10px;
  cursor: pointer;
}

.quick-value:hover {
  color: var(--primary);
  border-color: #b7d2ca;
}

.note-field {
  display: grid;
  gap: 7px;
  margin-top: 20px;
}

.note-field span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.note-field textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  padding: 11px 12px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  outline: none;
}

.note-field textarea::placeholder {
  color: #a0aaa6;
}

.note-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.1);
}

.entry-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.entry-state {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.entry-state svg {
  width: 15px;
  height: 15px;
}

.entry-state.saved {
  color: var(--primary);
}

.entry-side {
  display: grid;
  gap: 12px;
}

.class-summary {
  padding: 21px;
  color: #fff;
  border-radius: var(--radius);
  background: var(--ink);
}

.class-summary .eyebrow {
  color: #9fc7bc;
}

.class-summary h2 {
  margin: 0;
  font-size: 24px;
}

.class-summary p {
  margin: 6px 0 0;
  color: #bfded5;
  font-size: 12px;
}

.summary-list {
  display: grid;
  gap: 11px;
  margin: 23px 0 0;
}

.summary-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.summary-list dt {
  color: #afccc4;
  font-size: 10px;
}

.summary-list dd {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.side-note {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.side-note p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

/* Parent portal */

.parent-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.parent-intro h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 44px);
  letter-spacing: -0.02em;
}

.parent-intro > div > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.parent-date {
  padding: 9px 12px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.parent-meal-card {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 24px;
  color: #fff;
  border-radius: 8px;
  background: var(--ink);
  box-shadow: var(--shadow-md);
}

.parent-meal-card.opted-out {
  background: #69323a;
}

.parent-meal-card.locked {
  background: #4d5a56;
}

.parent-meal-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: #d8ede6;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.parent-meal-icon svg {
  width: 27px;
  height: 27px;
}

.parent-status-label {
  color: #a8cbc1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.parent-meal-copy h2 {
  margin: 5px 0 0;
  font-size: 25px;
}

.parent-meal-copy p {
  max-width: 650px;
  margin: 7px 0 0;
  color: #c9ded8;
  font-size: 12px;
  line-height: 1.7;
}

.parent-deadline {
  display: grid;
  min-width: 125px;
  justify-items: end;
  padding-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.parent-deadline span,
.parent-deadline small {
  color: #b6d1c9;
  font-size: 9px;
}

.parent-deadline strong {
  margin: 3px 0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 28px;
}

.parent-meal-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.parent-meal-actions .button {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.28);
  background: #fff;
}

.parent-meal-actions .button.danger {
  color: #7d303b;
  background: #fff4f5;
  border-color: #f0c8ce;
}

.parent-locked {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #d5e0dc;
  font-size: 12px;
  font-weight: 650;
}

.parent-locked svg {
  width: 15px;
  height: 15px;
}

.parent-info-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  margin-top: 16px;
}

.parent-info-section {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.parent-info-section h2 {
  margin: 0;
  font-size: 19px;
}

.parent-summary-list {
  margin-top: 18px;
}

.parent-summary-list div {
  border-top-color: var(--line);
}

.parent-summary-list dt {
  color: var(--muted);
}

.parent-rule-list {
  display: grid;
  gap: 13px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.parent-rule-list li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.parent-rule-list li > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  flex: 0 0 auto;
  color: var(--primary);
  border-radius: 50%;
  background: var(--primary-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
}

.parent-rule-list p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.parent-privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 10px;
}

.parent-privacy svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.parent-confirm-form {
  justify-items: center;
  text-align: center;
}

.parent-confirm-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: var(--primary);
  border-radius: 50%;
  background: var(--primary-soft);
}

.parent-confirm-icon.danger {
  color: var(--red);
  background: var(--red-soft);
}

.parent-confirm-icon svg {
  width: 25px;
  height: 25px;
}

.parent-confirm-copy h3 {
  margin: 0;
  font-size: 18px;
}

.parent-confirm-copy p {
  max-width: 440px;
  margin: 9px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.parent-confirm-form .modal-actions {
  width: 100%;
}

/* History */

.history-section {
  margin-top: 30px;
}

.history-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.history-day {
  min-width: 0;
  padding: 14px 12px 15px;
  border-bottom: 2px solid transparent;
}

.history-day + .history-day {
  border-left: 1px solid var(--line);
}

.history-day.today {
  background: var(--primary-soft);
  border-bottom-color: var(--primary);
}

.history-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
}

.history-date strong {
  color: var(--ink-soft);
  font-size: 11px;
}

.history-bars {
  display: flex;
  height: 38px;
  align-items: flex-end;
  margin-top: 9px;
}

.history-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  background: #bed8d1;
}

.history-day.today .history-bar {
  background: var(--primary);
}

.history-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  margin-top: 7px;
}

.history-value strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
}

.history-value span {
  color: var(--muted-light);
  font-size: 9px;
}

/* Modal and toast */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(16, 35, 31, 0.46);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(480px, 100%);
  max-height: min(720px, calc(100vh - 44px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(16, 35, 31, 0.25);
  overflow: auto;
  animation: modal-in 180ms ease-out;
}

.modal.workspace-modal {
  width: min(820px, 100%);
  max-height: min(860px, calc(100vh - 44px));
}

.workspace-body {
  min-height: 160px;
}

.workspace-form {
  display: grid;
  gap: 16px;
  padding: 20px 22px 22px;
}

.workspace-note,
.rollcall-instruction {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  color: var(--ink-soft);
  border: 1px solid #d5e3de;
  border-radius: 6px;
  background: var(--primary-soft);
  font-size: 11px;
  line-height: 1.6;
}

.workspace-note svg,
.rollcall-instruction svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.workspace-note p {
  margin: 0;
}

.roster-editor {
  display: grid;
  gap: 7px;
}

.roster-editor > span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.roster-editor textarea {
  width: 100%;
  min-height: 310px;
  resize: vertical;
  padding: 13px 14px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background:
    linear-gradient(90deg, var(--surface-muted) 0 42px, #fff 42px);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.9;
  outline: none;
}

.roster-editor textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.1);
}

.roster-editor-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted-light);
  font-size: 10px;
}

.roster-editor-meta span:first-child {
  color: var(--primary);
  font-weight: 650;
}

.parent-code-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  overflow: hidden;
}

.parent-code-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
}

.parent-code-heading strong,
.parent-code-heading span {
  display: block;
}

.parent-code-heading strong {
  font-size: 12px;
}

.parent-code-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.parent-code-list {
  display: grid;
  max-height: 260px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: auto;
}

.parent-code-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto 32px;
  align-items: center;
  gap: 8px;
  padding: 8px 9px 8px 12px;
  border-bottom: 1px solid #e8edea;
}

.parent-code-row:nth-child(odd) {
  border-right: 1px solid #e8edea;
}

.parent-code-student {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parent-code-row code {
  color: var(--primary);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

.parent-code-row .icon-button {
  width: 30px;
  height: 30px;
}

.rollcall-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  overflow: hidden;
}

.rollcall-meta > div {
  padding: 12px 13px;
}

.rollcall-meta > div + div {
  border-left: 1px solid var(--line);
}

.rollcall-meta span,
.rollcall-meta strong {
  display: block;
}

.rollcall-meta span {
  color: var(--muted);
  font-size: 9px;
}

.rollcall-meta strong {
  margin-top: 5px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
}

.rollcall-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rollcall-toolbar > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.student-toggle {
  display: grid;
  min-width: 0;
  min-height: 54px;
  grid-template-columns: 30px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 7px;
  padding: 8px 9px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.student-toggle:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.student-toggle.present {
  border-color: #c2dbd4;
  background: #f1f8f5;
}

.student-toggle.absent {
  border-color: #e6c4c9;
  background: var(--red-soft);
}

.student-number {
  overflow: hidden;
  color: var(--muted-light);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-parent-note {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--red);
  font-size: 8px;
  font-weight: 600;
  text-overflow: ellipsis;
}

.student-mark {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
}

.student-toggle.present .student-mark {
  color: var(--primary);
  background: var(--primary-soft);
}

.student-toggle.absent .student-mark {
  color: var(--red);
  background: #f1d8dc;
}

.student-mark svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}

.rollcall-actions,
.workspace-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 3px;
}

.rollcall-actions p,
.workspace-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.student-grid.readonly {
  margin-top: 16px;
}

.student-card {
  display: grid;
  min-height: 48px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.student-card.present {
  border-color: #c2dbd4;
  background: #f1f8f5;
}

.student-card.absent {
  border-color: #e6c4c9;
  background: var(--red-soft);
}

.student-status {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.student-card.present .student-status {
  color: var(--primary);
}

.student-card.absent .student-status {
  color: var(--red);
}

.workspace-readonly {
  padding: 20px 22px 22px;
}

.workspace-footer {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.workspace-footer-actions {
  display: flex;
  gap: 7px;
}

.workspace-empty {
  display: grid;
  min-height: 300px;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 30px;
  text-align: center;
}

.workspace-empty > svg {
  width: 34px;
  height: 34px;
  color: var(--muted-light);
}

.workspace-empty h3 {
  margin: 0;
  font-size: 16px;
}

.workspace-empty p {
  max-width: 330px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-heading h2 {
  margin: 0;
  font-size: 20px;
}

.account-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 18px 22px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
  overflow: hidden;
}

.account-detail {
  padding: 12px 13px;
  background: var(--surface-muted);
}

.account-detail span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.account-detail strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.password-form {
  display: grid;
  gap: 15px;
  padding: 21px 22px 22px;
}

.password-form h3 {
  margin: 0;
  font-size: 15px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 7px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 16px;
  color: #fff;
  border-radius: 6px;
  background: var(--ink);
  box-shadow: 0 12px 32px rgba(16, 35, 31, 0.25);
  font-size: 13px;
  line-height: 1.5;
  animation: toast-in 160ms ease-out;
}

.toast.error {
  background: #8e3743;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (max-width: 1180px) {
  .group-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .login-main {
    gap: 54px;
  }
}

@media (max-width: 900px) {
  .login-main {
    grid-template-columns: 1fr;
    gap: 38px;
    max-width: 660px;
    padding: 42px 0 60px;
  }

  .login-context {
    max-width: 620px;
  }

  .login-context h1 {
    max-width: 620px;
  }

  .login-flow {
    max-width: 620px;
  }

  .login-panel {
    width: 100%;
    max-width: 480px;
  }

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

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

  .kpi-item:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .kpi-item:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .entry-layout {
    grid-template-columns: 1fr;
  }

  .entry-side {
    grid-template-columns: 1fr 1fr;
  }

  .parent-info-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .login-brand {
    width: calc(100% - 32px);
    min-height: 72px;
  }

  .login-main {
    width: calc(100% - 32px);
    gap: 28px;
    padding: 30px 0 42px;
  }

  .login-context h1 {
    font-size: 34px;
  }

  .login-lead {
    margin-top: 16px;
    font-size: 14px;
    line-height: 1.7;
  }

  .login-flow {
    margin-top: 28px;
  }

  .login-flow div {
    padding-top: 13px;
  }

  .login-flow p {
    margin-top: 6px;
    font-size: 12px;
  }

  .login-panel {
    padding: 24px 20px;
  }

  .topbar {
    min-height: 64px;
    padding: 10px 16px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .brand-copy small {
    display: none;
  }

  .topbar-actions {
    gap: 5px;
  }

  .date-control {
    padding: 0 8px;
  }

  .date-control svg {
    display: none;
  }

  .date-control input {
    width: 104px;
    font-size: 11px;
  }

  .account-copy,
  .account-chevron {
    display: none;
  }

  .account-button {
    height: 38px;
    padding: 0;
  }

  .avatar {
    width: 32px;
    height: 32px;
  }

  .main-content {
    width: calc(100% - 28px);
    padding: 24px 0 38px;
  }

  .app-footer {
    width: calc(100% - 28px);
  }

  .page-intro {
    display: block;
    margin-bottom: 22px;
  }

  .page-intro h1 {
    font-size: 28px;
  }

  .page-intro h1 .title-date {
    display: block;
    margin-top: 3px;
    font-size: 0.82em;
  }

  .page-intro h1 .title-date::before {
    content: "";
  }

  .page-actions {
    justify-content: flex-start;
    margin-top: 17px;
  }

  .page-actions .button {
    flex: 1;
  }

  .parent-intro {
    display: block;
  }

  .parent-intro h1 {
    font-size: 34px;
  }

  .parent-date {
    display: inline-flex;
    margin-top: 14px;
  }

  .parent-meal-card {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 13px;
    padding: 18px;
  }

  .parent-meal-icon {
    width: 46px;
    height: 46px;
  }

  .parent-meal-icon svg {
    width: 22px;
    height: 22px;
  }

  .parent-meal-copy h2 {
    font-size: 21px;
  }

  .parent-deadline {
    grid-column: 1 / -1;
    justify-items: start;
    padding: 13px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-left: 0;
  }

  .parent-deadline strong {
    font-size: 23px;
  }

  .parent-meal-actions {
    padding-top: 13px;
  }

  .parent-meal-actions .button {
    width: 100%;
  }

  .parent-info-section {
    padding: 18px;
  }

  .roster-strip {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .roster-strip .button {
    width: 100%;
    grid-column: 1 / -1;
  }

  .teacher-intro {
    display: block;
  }

  .teacher-date {
    margin-top: 16px;
  }

  .kpi-item {
    padding: 16px;
  }

  .kpi-value strong {
    font-size: 26px;
  }

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

  .group-grid.single-group {
    grid-template-columns: 1fr;
  }

  .group-card-button {
    padding: 15px 14px;
  }

  .group-metrics {
    margin-top: 13px;
  }

  .table-toolbar {
    display: block;
  }

  .table-filters {
    margin-top: 11px;
  }

  .class-filter {
    max-width: 100%;
  }

  .report-table {
    min-width: 0;
    table-layout: fixed;
  }

  .report-table th,
  .report-table td {
    padding-right: 11px;
    padding-left: 11px;
  }

  .report-table th:nth-child(2),
  .report-table td:nth-child(2),
  .report-table th:nth-child(5),
  .report-table td:nth-child(5),
  .report-table th:nth-child(6),
  .report-table td:nth-child(6) {
    display: none;
  }

  .report-table th:nth-child(1) {
    width: 58%;
  }

  .report-table th:nth-child(3) {
    width: 22%;
  }

  .report-table th:nth-child(4) {
    width: 20%;
  }

  .report-table .class-initial {
    display: none;
  }

  .report-table .class-cell {
    gap: 0;
  }

  .class-link svg {
    display: none;
  }

  .report-table .class-cell > div > .sub-label:not(.mobile-row-detail) {
    display: none;
  }

  .report-table td:nth-child(3),
  .report-table th:nth-child(3) {
    text-align: right;
  }

  .report-table td:nth-child(4),
  .report-table th:nth-child(4) {
    text-align: right;
  }

  .report-table .count-cell {
    font-size: 15px;
  }

  .mobile-row-detail {
    display: block;
    max-width: 210px;
    overflow: hidden;
    margin-top: 3px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .count-stack .status-chip {
    padding: 0 6px;
    font-size: 9px;
  }

  .mini-action {
    padding: 0 7px;
  }

  .entry-side {
    grid-template-columns: 1fr;
  }

  .entry-panel-head,
  .entry-form {
    padding-right: 17px;
    padding-left: 17px;
  }

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

  .entry-actions .button {
    width: 100%;
  }

  .history-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .history-day:nth-child(5) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .history-day:nth-child(n + 5) {
    border-top: 1px solid var(--line);
  }

  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
  }

  .modal.workspace-modal {
    max-height: 94vh;
  }

  .workspace-form,
  .workspace-readonly {
    padding-right: 16px;
    padding-left: 16px;
  }

  .roster-editor textarea {
    min-height: 260px;
  }

  .roster-editor-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .parent-code-list {
    grid-template-columns: 1fr;
  }

  .parent-code-row:nth-child(odd) {
    border-right: 0;
  }

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

  .rollcall-meta > div:nth-child(3) {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .rollcall-meta > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .rollcall-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .rollcall-actions,
  .workspace-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .rollcall-actions .button,
  .workspace-footer-actions,
  .workspace-footer-actions .button {
    width: 100%;
  }

  .workspace-footer-actions {
    flex-direction: column-reverse;
  }

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

  .modal-actions .button {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .brand-copy strong {
    font-size: 14px;
  }

  .kpi-label {
    font-size: 10px;
  }

  .kpi-value strong {
    font-size: 23px;
  }

  .kpi-item {
    padding: 14px 12px;
  }

  .history-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .history-day:nth-child(4) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .history-day:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

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

@media (max-width: 360px) {
  .brand-copy {
    display: none;
  }
}

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