:root {
  color-scheme: light;
  --ink: #18233a;
  --muted: #667085;
  --line: #dfe4ec;
  --line-strong: #cbd3df;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --page: #eef2f7;
  --primary: #4f46a5;
  --primary-strong: #3d357f;
  --primary-soft: #eeecff;
  --accent: #0f766e;
  --accent-soft: #e6f6f3;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --warning: #a15c00;
  --warning-soft: #fff7e8;
  --success: #087a55;
  --success-soft: #eaf8f2;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 3px rgb(16 24 40 / 0.08);
  --shadow-lg: 0 18px 48px rgb(31 42 68 / 0.14);
  --radius: 14px;
  --radius-sm: 9px;
  --focus: 0 0 0 3px rgb(79 70 165 / 0.2);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgb(79 70 165 / 0.07), transparent 30rem),
    var(--page);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

h2 {
  line-height: 1.25;
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid rgb(203 211 223 / 0.8);
  background: rgb(255 255 255 / 0.92);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.8);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr);
  align-items: center;
  gap: 1rem;
  width: min(1160px, calc(100% - 2rem));
  min-height: 68px;
  margin: 0 auto;
}

.topbar-inner.wide {
  width: min(1500px, calc(100% - 2rem));
}

.brand,
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: var(--ink);
  font-weight: 750;
}

.brand:hover,
.user-chip:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  background:
    linear-gradient(135deg, transparent 48%, rgb(255 255 255 / 0.28) 49% 55%, transparent 56%),
    linear-gradient(135deg, var(--primary), #786fe0);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.22), var(--shadow-sm);
}

.brand-mark::after {
  width: 10px;
  height: 10px;
  border: 2px solid white;
  border-radius: 50%;
  content: "";
}

.brand-mark-lg {
  width: 54px;
  height: 54px;
  margin-bottom: 0.75rem;
  border-radius: 16px;
}

.brand-mark-lg::after {
  width: 18px;
  height: 18px;
  border-width: 3px;
}

.brand-text,
.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: flex;
  align-self: stretch;
  gap: 0.2rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  padding: 0.15rem 0.8rem 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.nav-link:hover {
  color: var(--primary);
  text-decoration: none;
}

.nav-link.is-active {
  border-color: var(--primary);
  color: var(--primary);
}

.topbar-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  min-width: 0;
}

.avatar {
  display: inline-grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #d8d3ff;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
}

.page {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.25rem 0 4rem;
}

.page.wide {
  width: min(1500px, calc(100% - 2rem));
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-sub,
.muted,
.hint,
.auth-sub,
.assign-meta {
  color: var(--muted);
}

.page-sub {
  margin-bottom: 0;
}

.small {
  font-size: 0.85rem;
}

.inline,
.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.stack {
  display: grid;
  gap: 1.1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.card,
.assign-card,
.auth-card,
.empty {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card,
.empty {
  padding: 1.35rem;
}

.card-narrow {
  max-width: 650px;
}

.card-title {
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

.rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.35rem 0;
}

.empty {
  padding: 3.5rem 1.5rem;
  text-align: center;
}

.empty h2 {
  margin-bottom: 0.5rem;
}

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 1px rgb(16 24 40 / 0.03);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.btn:hover {
  border-color: #aaa2ef;
  color: var(--primary);
  text-decoration: none;
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
  color: white;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.btn-danger {
  border-color: #f0b7b2;
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-sm {
  min-height: 34px;
  padding: 0.4rem 0.65rem;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
}

.field {
  display: grid;
  gap: 0.38rem;
}

.field-inline {
  display: grid;
  gap: 0.25rem;
}

.label {
  color: #344054;
  font-size: 0.82rem;
  font-weight: 750;
}

.hint {
  font-size: 0.8rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  color: var(--ink);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aab3c2;
}

input::placeholder,
textarea::placeholder {
  color: #98a2b3;
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.flash[hidden] {
  display: none;
}

.flash-success {
  border-color: #a9dec9;
  background: var(--success-soft);
  color: #086146;
}

.flash-error {
  border-color: #f3b8b2;
  background: var(--danger-soft);
  color: #912018;
}

.flash-info {
  border-color: #cac6f2;
  background: var(--primary-soft);
  color: #393274;
}

.auth-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 50% -10%, rgb(120 111 224 / 0.25), transparent 32rem),
    linear-gradient(150deg, #f6f5ff, #e8edf5 70%);
}

.auth-body .page {
  width: min(440px, 100%);
  padding: 0;
}

.auth-card {
  padding: clamp(1.5rem, 5vw, 2.25rem);
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-brand h1 {
  margin-bottom: 0.2rem;
  font-size: 1.65rem;
}

.auth-help {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.assign-card {
  position: relative;
  overflow: hidden;
  padding: 1.2rem;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.assign-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--primary);
  content: "";
}

.assign-card.is-done::before {
  background: var(--success);
}

.assign-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgb(31 42 68 / 0.1);
}

.assign-card-top,
.assign-actions,
.save-actions,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.assign-card-top {
  justify-content: space-between;
}

.assign-class {
  margin: 1rem 0 0.25rem;
  font-size: 1.35rem;
}

.assign-actions {
  margin-top: 1rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 800;
}

.pill-subject {
  background: var(--primary-soft);
  color: var(--primary);
}

.pill-done {
  background: var(--success-soft);
  color: var(--success);
}

.pill-todo {
  background: var(--warning-soft);
  color: var(--warning);
}

.pill-muted {
  background: #eef1f5;
  color: #596579;
}

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

.table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0.9rem;
  text-align: left;
}

.table th {
  background: var(--surface-soft);
  color: #475467;
  font-size: 0.76rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

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

.table tbody tr:hover,
.table .is-highlight {
  background: #fafaff;
}

.table .num {
  text-align: right;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

/* Administration workspace */

.admin-nav {
  display: flex;
  overflow-x: auto;
  gap: 0.35rem;
  margin: -0.35rem 0 1.25rem;
  padding: 0.35rem 0 0.65rem;
  scrollbar-width: thin;
}

.admin-nav a {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.admin-nav a:hover,
.admin-nav a.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.admin-stat {
  display: grid;
  gap: 0.25rem;
  color: var(--ink);
}

.admin-stat:hover {
  border-color: #aaa2ef;
  text-decoration: none;
}

.admin-stat strong {
  color: var(--primary);
  font-size: 1.85rem;
  line-height: 1;
}

.admin-stat span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.admin-split {
  display: grid;
  grid-template-columns: minmax(260px, 0.36fr) minmax(0, 1fr);
  gap: 1rem;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  align-items: end;
  gap: 0.9rem;
}

.admin-form-wide {
  grid-column: 1 / -1;
}

.admin-form-submit {
  justify-self: start;
}

.admin-details summary {
  color: var(--primary);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}

.admin-reset-form {
  margin-top: 0.5rem;
}

.admin-reset-form input {
  width: 190px;
}

.import-ok {
  color: var(--success);
  font-weight: 700;
}

.import-errors,
.import-row-error td:last-child {
  color: var(--danger);
  font-weight: 650;
}

.import-row-error {
  background: var(--danger-soft);
}

/* Grading workspace */

.session-bar,
.grade-toolbar,
.bulk-panel,
.session-note,
.save-bar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.session-bar {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.9rem;
}

.session-bar .field-inline:first-child {
  min-width: 220px;
  flex: 1 1 320px;
}

.session-bar .field-period {
  flex: 0 0 84px;
}

.grade-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem 0.9rem;
}

.toolbar-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.bulk-panel {
  display: none;
  margin-bottom: 0.75rem;
  padding: 0.75rem 0.9rem;
}

.bulk-panel summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 750;
}

.bulk-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.bulk-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
}

.bulk-buttons,
.gh-setall {
  display: flex;
  justify-content: center;
  gap: 0.2rem;
}

.mini {
  display: inline-grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.mini:hover,
.mini:focus-visible {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  outline: none;
}

.grade-scroll {
  overflow: auto;
  max-height: calc(100vh - 270px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overscroll-behavior: contain;
}

.grade-grid {
  min-width: calc(300px + var(--item-count) * 126px + 220px);
}

.grade-head,
.grade-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.4fr) repeat(var(--item-count), minmax(126px, 0.8fr)) 130px 92px;
}

.grade-head {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 82px;
  border-bottom: 1px solid var(--line-strong);
  background: #f8f9fc;
  box-shadow: 0 2px 4px rgb(16 24 40 / 0.06);
}

.grade-row {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.grade-row:last-child {
  border-bottom: 0;
}

.grade-row:nth-child(odd) {
  background: #fcfcfe;
}

.gh,
.gc {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 0.6rem;
}

.gh:last-child,
.gc-total {
  border-right: 0;
}

.gh {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: #475467;
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
}

.gh-name,
.gc-name {
  position: sticky;
  z-index: 10;
  left: 0;
  background: inherit;
  box-shadow: 2px 0 4px rgb(16 24 40 / 0.05);
}

.gh-name {
  z-index: 30;
  align-items: flex-start;
  padding-left: 1rem;
}

.gh-label {
  display: block;
  overflow: hidden;
  width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gc-name {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-content: center;
  column-gap: 0.5rem;
  min-height: 74px;
  padding: 0.65rem 0.8rem;
}

.row-num {
  grid-row: 1 / 3;
  align-self: center;
  color: #98a2b3;
  font-size: 0.75rem;
  font-weight: 750;
  text-align: center;
}

.student-name {
  overflow: hidden;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-code {
  color: var(--muted);
  font-size: 0.75rem;
}

.gc-item,
.gc-status,
.gc-total {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
}

.gc-label {
  display: none;
}

.chips {
  display: flex;
  justify-content: center;
  gap: 0.18rem;
}

.chip {
  display: block;
  cursor: pointer;
}

.chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
}

.chip span {
  display: grid;
  width: 30px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: #667085;
  font-size: 0.78rem;
  font-weight: 800;
  transition: transform 100ms ease, border-color 100ms ease, background 100ms ease;
}

.chip:hover span {
  border-color: #aaa2ef;
  color: var(--primary);
}

.chip input:focus-visible + span {
  box-shadow: var(--focus);
}

.chip input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 5px rgb(79 70 165 / 0.2);
  transform: translateY(-1px);
}

.gc-status select {
  min-height: 38px;
  padding: 0.4rem 0.5rem;
  font-size: 0.82rem;
}

.gc-total {
  gap: 0.2rem;
  font-variant-numeric: tabular-nums;
}

.total-out {
  min-width: 2ch;
  font-size: 1rem;
  font-weight: 850;
}

.total-max {
  color: #98a2b3;
  font-size: 0.72rem;
}

.score-excellent {
  color: var(--success);
}

.score-good {
  color: var(--accent);
}

.score-fair {
  color: var(--warning);
}

.score-poor {
  color: var(--danger);
}

.score-none {
  color: var(--muted);
  font-size: 0.78rem;
}

.gc-note {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--line);
  border-right: 0;
  padding: 0;
}

.gc-note details {
  padding: 0.35rem 0.8rem 0.55rem 2.95rem;
}

.gc-note summary {
  width: max-content;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.gc-note input {
  margin-top: 0.45rem;
}

.grade-row.is-absent {
  background: #f4f5f7;
}

.grade-row.is-absent .gc-item {
  opacity: 0.38;
}

.grade-row.is-absent .chip {
  cursor: not-allowed;
}

.session-note {
  margin-top: 0.85rem;
  padding: 0.85rem;
}

.save-bar {
  position: sticky;
  z-index: 40;
  bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.85rem;
  padding: 0.8rem 0.9rem;
  box-shadow: 0 10px 35px rgb(31 42 68 / 0.16);
}

.has-unsaved-changes .save-bar {
  border-color: #bcb5f1;
}

.save-summary {
  min-width: 0;
  font-size: 0.84rem;
}

@media (max-width: 900px) {
  .topbar-inner {
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
  }

  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    overflow-x: auto;
    border-top: 1px solid var(--line);
  }

  .nav-link {
    min-height: 42px;
    white-space: nowrap;
  }

  .user-name {
    display: none;
  }

  .page {
    padding-top: 1.5rem;
  }

  .grade-scroll {
    max-height: none;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .topbar-inner,
  .topbar-inner.wide,
  .page,
  .page.wide {
    width: min(100% - 1rem, 100%);
  }

  .topbar-inner {
    min-height: 58px;
  }

  .brand-text {
    max-width: 45vw;
  }

  .topbar-user .btn {
    padding-inline: 0.45rem;
  }

  .page {
    padding-bottom: 6rem;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 1rem;
  }

  .page-actions,
  .page-actions .inline-form {
    width: 100%;
  }

  .page-actions input {
    flex: 1;
  }

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

  .admin-split,
  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-wide {
    grid-column: auto;
  }

  .admin-form-submit {
    width: 100%;
  }

  .session-bar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .session-bar .field-inline:first-child {
    min-width: 100%;
  }

  .session-bar .field-inline:not(:first-child) {
    flex: 1 1 120px;
  }

  .session-bar > .btn {
    flex: 1 1 auto;
  }

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

  .bulk-panel {
    display: block;
  }

  .grade-scroll {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .grade-grid {
    display: grid;
    min-width: 0;
    gap: 0.75rem;
  }

  .grade-head {
    display: none;
  }

  .grade-row {
    grid-template-columns: minmax(0, 1fr) 128px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  .grade-row:nth-child(odd) {
    background: var(--surface);
  }

  .gc {
    border-right: 0;
  }

  .gc-name {
    position: static;
    z-index: auto;
    grid-column: 1;
    min-height: 66px;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }

  .gc-status {
    grid-column: 2;
    grid-row: 1;
    min-height: 66px;
    border-bottom: 1px solid var(--line);
    border-left: 1px solid var(--line);
    padding: 0.55rem;
  }

  .gc-item {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(88px, 0.75fr) minmax(0, 1.4fr);
    min-height: 58px;
    border-bottom: 1px solid var(--line);
    padding: 0.55rem 0.7rem;
  }

  .gc-label {
    display: block;
    overflow: hidden;
    color: #475467;
    font-size: 0.78rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chips {
    justify-content: flex-end;
    gap: clamp(0.12rem, 1.4vw, 0.35rem);
  }

  .chip span {
    width: clamp(36px, 10vw, 42px);
    height: 42px;
  }

  .bulk-panel .mini {
    width: 40px;
    height: 40px;
  }

  .gc-total {
    grid-column: 1 / -1;
    justify-content: flex-end;
    min-height: 48px;
    padding-inline: 0.9rem;
  }

  .gc-total::before {
    margin-right: auto;
    color: var(--muted);
    content: "Total";
    font-size: 0.78rem;
    font-weight: 750;
  }

  .gc-note {
    grid-column: 1 / -1;
  }

  .gc-note details {
    padding-left: 0.9rem;
  }

  .save-bar {
    right: 0.5rem;
    bottom: 0.5rem;
    left: 0.5rem;
    align-items: stretch;
    flex-direction: column;
    gap: 0.55rem;
  }

  .save-actions .btn {
    flex: 1;
  }

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

  .table-wrap {
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 420px) {
  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .brand-text {
    max-width: 38vw;
    font-size: 0.88rem;
  }

  .avatar {
    display: none;
  }

  .bulk-row {
    grid-template-columns: 1fr;
  }

  .bulk-buttons {
    justify-content: flex-start;
  }
}

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

@media print {
  .topbar,
  .page-actions,
  .session-bar,
  .grade-toolbar,
  .bulk-panel,
  .save-bar,
  .row-actions {
    display: none !important;
  }

  body,
  .page {
    width: 100%;
    background: white;
  }
}

/* ------------------------------------------------------------------ Reports */

/* Averages in a column only read as a column when the digits line up. */
.table td.num,
.table th.num {
  font-variant-numeric: tabular-nums;
}

.report-filters {
  align-items: flex-end;
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

.range-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  margin: 0 0 1rem;
}

.range-link {
  border-bottom: 1px solid transparent;
  color: var(--primary);
  text-decoration: none;
}

.range-link:hover {
  border-bottom-color: currentColor;
}

.range-link.is-active {
  color: var(--ink);
  font-weight: 600;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 1.25rem;
}

.export-count {
  margin-inline-start: 0.25rem;
}

/* The absence rule travels with every number derived from it.
   .flash is a flex row, which would break this sentence into one line per
   <strong>; it needs to read as prose. */
.methodology {
  display: block;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.pill-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Bars take their fill from a view-computed custom property, the same mechanism
   the grading grid uses for --item-count. Never an inline width. */
.meter {
  display: block;
  width: 100%;
  max-width: 120px;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.meter > i {
  display: block;
  width: calc(var(--pct, 0) * 1%);
  height: 100%;
  background: var(--primary);
}

.meter.is-excellent > i {
  background: var(--success);
}

.meter.is-good > i {
  background: var(--accent);
}

.meter.is-fair > i {
  background: var(--warning);
}

.meter.is-poor > i {
  background: var(--danger);
}

.meter.is-none > i {
  background: var(--line-strong);
}

/* Server-rendered inline SVG: no charting library, no client JavaScript. */
.spark-wrap {
  margin: 0;
}

.spark {
  display: block;
  width: 100%;
  height: 64px;
  overflow: visible;
}

.spark-area {
  fill: var(--accent-soft);
}

.spark-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.spark-wrap figcaption {
  margin-top: 0.5rem;
}

.note-cell {
  max-width: 22rem;
  white-space: normal;
}

@media (max-width: 720px) {
  .meter {
    max-width: none;
  }
}

@media print {
  .report-filters,
  .range-shortcuts,
  .report-actions {
    display: none !important;
  }

  /* The methodology note is deliberately NOT hidden: a printed average without
     its exclusion rule is the misreading this feature exists to prevent. */
  .meter,
  .spark-wrap {
    break-inside: avoid;
  }
}
