*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; min-height: 100%; scroll-behavior: smooth; }

body.classes-app {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  background:
    linear-gradient(#024bc806 1px, transparent 1px),
    linear-gradient(90deg, #024bc806 1px, transparent 1px),
    var(--background);
  background-size: 32px 32px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body.classes-app::before {
  position: fixed;
  inset: 56px 0 auto;
  height: 170px;
  background: linear-gradient(180deg, #e4e5e8 0%, #e4e5e8ee 66%, transparent 100%);
  content: "";
  pointer-events: none;
}

button, input, textarea { font: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid #79a6f3;
  outline-offset: 2px;
}
h1, h2, h3, p { margin: 0; }
svg { display: block; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 12000;
  padding: 10px 16px;
  transform: translateY(-150%);
  border-radius: 5px;
  background: #fff;
  color: var(--blue);
  text-decoration: none;
}
.skip-link:focus { transform: none; }

.classes-app > .compact-header { position: sticky; top: 0; background: #fff; }

.classes-main {
  position: relative;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 42px 32px 56px;
}

.classes-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 48px;
  padding: 5px 3px 32px;
}

.eyebrow,
.panel-kicker {
  color: var(--blue);
  font-size: 11px !important;
  font-weight: 700;
  line-height: 18px !important;
  letter-spacing: 1.4px !important;
  text-transform: uppercase;
}

.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.eyebrow-mark { width: 10px; height: 10px; background: var(--blue); box-shadow: 5px 5px 0 #9dbbed; }
.classes-intro h1 { color: var(--blue); font-size: clamp(44px, 5.6vw, 74px); line-height: .93; }
.intro-copy { max-width: 470px; padding-bottom: 3px; color: #424851; text-wrap: balance; }

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

.classes-panel,
.roster-panel {
  border: 1px solid #fff;
  border-radius: 12px;
  background: #f9f9fb;
  box-shadow: 0 12px 40px #17233b0a;
}

.classes-panel {
  position: sticky;
  top: 76px;
  min-width: 0;
  padding: 22px;
}

.panel-heading,
.heading-line,
.roster-heading,
.roster-actions,
.student-section-heading,
.add-panel-heading,
.input-action-row,
.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
}

.panel-heading { justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-kicker { margin-bottom: 4px; }
.heading-line { gap: 9px; }
.heading-line h2 { font-size: 28px; line-height: 1; }
.count-badge {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  padding: 0 5px;
  border: 1px solid #bdc4d0;
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 22px;
  transition: transform .18s ease, background .18s ease;
}
.icon-button:hover { transform: translateY(-2px); background: #003fa9; }

.class-list { display: grid; gap: 7px; padding: 0; margin: 0; list-style: none; }
.class-item { min-width: 0; }
.class-select {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 52px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}
.class-select:hover { background: #edf1f8; }
.class-select[aria-current="true"] { border-color: #b9cef2; background: #e5edfb; color: var(--blue); }
.class-pixel { width: 9px; height: 9px; background: #aeb6c4; box-shadow: 4px 4px 0 #d6dbe4; }
.class-select[aria-current="true"] .class-pixel { background: var(--blue); box-shadow: 4px 4px 0 #94b5ee; }
.class-copy { min-width: 0; }
.class-name { display: block; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.class-meta { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; line-height: 16px; }
.class-select[aria-current="true"] .class-meta { color: #315fAD; }
.class-arrow { font-size: 18px; opacity: 0; transform: translateX(-3px); transition: opacity .16s, transform .16s; }
.class-select:hover .class-arrow,
.class-select[aria-current="true"] .class-arrow { opacity: 1; transform: none; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.button.primary { background: var(--blue); color: #fff; }
.button.primary:hover { background: #003fa9; transform: translateY(-1px); }
.button.secondary { border-color: #cbd0d9; background: #fff; }
.button.secondary:hover { border-color: #9eabc0; background: #f2f5fa; }
.button.danger { background: #b92f37; color: #fff; }
.button.danger:hover { background: #98252c; }
.wide-button { width: 100%; }
.compact-button { flex: none; min-height: 43px; padding-inline: 15px; }
.classes-panel > .wide-button { margin-top: 16px; }

.storage-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid #dde0e6;
  color: var(--muted);
}
.storage-note svg { width: 17px; margin-top: 2px; color: var(--blue); }
.storage-note strong { color: var(--ink); font-weight: 700; }
.storage-note p { font-size: 11px !important; line-height: 17px !important; }

.roster-panel { min-width: 0; overflow: hidden; }
.roster-heading {
  justify-content: space-between;
  gap: 24px;
  min-height: 91px;
  padding: 20px 26px;
  border-bottom: 1px solid #dce0e7;
}
.active-class-title { min-width: 0; }
.active-class-title h2 { overflow: hidden; color: var(--blue); font-size: 36px; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.roster-actions { justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.student-total { margin-right: 6px; padding: 5px 10px; border-radius: 999px; background: #e7edf8; color: #244f99; white-space: nowrap; }
.text-button {
  min-height: 34px;
  padding: 5px 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--blue);
}
.text-button:hover { background: #e7edf8; }
.danger-text { color: #9a2930; }
.danger-text:hover { background: #f7e8e9; }
.text-button:disabled { color: #979ba3; cursor: not-allowed; }
.text-button:disabled:hover { background: transparent; }

.roster-content { display: grid; grid-template-columns: minmax(340px, 1.25fr) minmax(280px, .75fr); min-height: 570px; }
.student-section { min-width: 0; padding: 25px 26px 31px; }
.student-section-heading { justify-content: space-between; gap: 20px; margin-bottom: 19px; }
.student-section-heading h3,
.add-panel-heading h3 { font-size: 24px; line-height: 1.05; }
.student-section-heading p,
.add-panel-heading p { margin-top: 3px; color: var(--muted); }
.list-number { color: #c7d6ef; font: 700 40px/1 'OffBit', monospace; }

.student-list { display: grid; gap: 6px; padding: 0; margin: 0; list-style: none; counter-reset: students; }
.student-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 6px 8px 6px 5px;
  border: 1px solid #e0e3e8;
  border-radius: 6px;
  background: #fff;
  counter-increment: students;
  transition: border-color .16s ease, transform .16s ease;
}
.student-item:hover { border-color: #b9c8e1; transform: translateX(2px); }
.student-index {
  display: grid;
  place-items: center;
  align-self: stretch;
  border-radius: 4px;
  background: #edf2fb;
  color: var(--blue);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.student-name { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.student-actions { display: flex; align-items: center; gap: 2px; }
.student-action {
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}
.student-action:hover { background: #edf1f8; color: var(--blue); }
.student-action.remove:hover { background: #f8e9ea; color: #992a31; }

.empty-state {
  display: grid;
  place-items: center;
  min-height: 365px;
  padding: 40px 24px;
  border: 1px dashed #cbd2dd;
  border-radius: 8px;
  background: #f5f7fa;
  text-align: center;
}
.empty-state[hidden] { display: none; }
.empty-state h3 { margin: 18px 0 4px; color: var(--blue); font-size: 28px; line-height: 1; }
.empty-state p { max-width: 330px; color: var(--muted); }
.empty-state .button { margin-top: 19px; }
.empty-illustration { position: relative; width: 96px; height: 72px; }
.empty-illustration span { position: absolute; width: 18px; height: 18px; background: #b5c9ed; }
.empty-illustration span:nth-child(1) { left: 39px; top: 0; background: var(--blue); }
.empty-illustration span:nth-child(2) { left: 18px; top: 22px; }
.empty-illustration span:nth-child(3) { left: 60px; top: 22px; }
.empty-illustration span:nth-child(4) { left: 0; top: 47px; background: #d6e1f5; }
.empty-illustration span:nth-child(5) { right: 0; top: 47px; background: #d6e1f5; }

.add-students-panel { min-width: 0; padding: 25px 25px 30px; border-left: 1px solid #dce0e7; background: #eef1f5; }
.add-panel-heading { align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.step-number { display: grid; place-items: center; width: 31px; height: 31px; flex: none; border-radius: 4px; background: var(--blue); color: #fff; font-size: 19px; }
.single-student-form,
.bulk-student-form { display: grid; gap: 8px; }
.single-student-form label,
.bulk-student-form label,
.classes-dialog label { font-weight: 700; }
.input-action-row { align-items: stretch; gap: 7px; }
input,
textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #bec5d1;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input { min-height: 43px; }
textarea { display: block; min-height: 150px; resize: vertical; }
input:hover,
textarea:hover { border-color: #929dad; }
input:focus,
textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #024bc818; }
input::placeholder,
textarea::placeholder { color: #858c97; opacity: 1; }
.form-divider { position: relative; justify-content: center; margin: 19px 0; color: #777e89; }
.form-divider::before { position: absolute; inset: 50% 0 auto; height: 1px; background: #d1d5dc; content: ""; }
.form-divider span { position: relative; padding: 0 10px; background: #eef1f5; }
.field-help { color: var(--muted); font-size: 11px !important; line-height: 17px !important; }
.bulk-student-form .button { margin-top: 4px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 11000;
  max-width: min(390px, calc(100vw - 32px));
  padding: 13px 17px;
  border: 1px solid #183f82;
  border-radius: 6px;
  background: #0e3e90;
  color: #fff;
  box-shadow: 0 12px 34px #1020443d;
}
.toast[hidden] { display: none; }
.toast.is-error { border-color: #7d1e24; background: #9f2a32; }

.classes-dialog {
  width: min(500px, calc(100% - 32px));
  max-height: calc(100svh - 40px);
  padding: 0;
  overflow: auto;
  border: 1px solid #fff;
  border-radius: 11px;
  background: #f9f9fb;
  color: var(--ink);
  box-shadow: 0 22px 70px #10234b3d;
}
.classes-dialog::backdrop { background: #14244580; backdrop-filter: blur(4px); }
.classes-dialog[open] { animation: dialog-enter .18s ease both; }
.classes-dialog form { padding: 28px; }
.classes-dialog .dialog-heading { justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 23px; }
.classes-dialog h2 { color: var(--blue); font-size: 34px; line-height: 1; }
.classes-dialog input { margin-top: 7px; }
.dialog-close {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: none;
  padding: 0 0 2px;
  border: 0;
  border-radius: 50%;
  background: #eceff4;
  color: #555b65;
  font-size: 23px;
}
.dialog-close:hover { background: #dfe4ec; color: var(--ink); }
.dialog-help { margin-top: 11px; color: var(--muted); }
.dialog-actions { justify-content: flex-end; gap: 8px; margin-top: 24px; padding-top: 19px; border-top: 1px solid #dfe2e7; }
.form-error { margin-top: 10px; color: #a0252d; }
.form-error[hidden] { display: none; }

.confirmation-dialog { width: min(450px, calc(100% - 32px)); text-align: center; }
.confirmation-dialog form { padding: 36px 31px 30px; }
.confirmation-symbol { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 20px; border-radius: 50%; background: #f5dddd; color: #a0252d; font: 700 29px/1 'OffBit', monospace; }
.student-symbol { background: #e5edfb; color: var(--blue); }
.confirmation-dialog h2 { font-size: 34px; }
.confirmation-dialog > form > p:not(.form-error):not(.student-to-delete) { max-width: 350px; margin: 11px auto 0; color: var(--muted); }
.student-to-delete { margin-top: 16px; padding: 10px 12px; border-radius: 5px; background: #edf1f7; font-weight: 700; overflow-wrap: anywhere; }
.split-actions { display: grid; grid-template-columns: 1fr 1fr; }

@keyframes dialog-enter {
  from { opacity: 0; transform: translateY(8px) scale(.985); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 1050px) {
  .classes-workspace { grid-template-columns: 255px minmax(0, 1fr); }
  .classes-panel { padding: 19px; }
  .roster-content { grid-template-columns: 1fr; }
  .add-students-panel { border-top: 1px solid #dce0e7; border-left: 0; }
  .bulk-student-form textarea { min-height: 115px; }
}

@media (max-width: 760px) {
  body.classes-app::before { display: none; }
  .classes-main { padding: 30px 16px 42px; }
  .classes-intro { display: block; padding: 0 2px 24px; }
  .classes-intro h1 { font-size: clamp(43px, 13vw, 66px); }
  .intro-copy { margin-top: 16px; }
  .classes-workspace { grid-template-columns: 1fr; }
  .classes-panel { position: static; padding: 18px; }
  .class-list { display: flex; gap: 8px; margin-inline: -18px; padding-inline: 18px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
  .class-list::-webkit-scrollbar { display: none; }
  .class-item { flex: 0 0 min(228px, 76vw); scroll-snap-align: start; }
  .classes-panel > .wide-button { width: auto; }
  .storage-note { margin-top: 16px; }
  .roster-heading { align-items: flex-start; flex-direction: column; gap: 13px; padding: 20px; }
  .roster-actions { justify-content: flex-start; }
  .student-section,
  .add-students-panel { padding: 21px 20px 25px; }
}

@media (max-width: 480px) {
  .classes-main { padding-inline: 12px; }
  .classes-intro { padding-inline: 5px; }
  .classes-intro h1 { max-width: 390px; }
  .intro-copy { font-size: 12px !important; }
  .roster-actions { width: 100%; }
  .student-total { width: 100%; margin: 0 0 1px; text-align: center; }
  .roster-actions .text-button { flex: 1; border: 1px solid #d8dde5; }
  .active-class-title h2 { font-size: 32px; }
  .student-item { grid-template-columns: 31px minmax(0, 1fr); }
  .student-actions { grid-column: 2; justify-content: flex-start; margin: -3px 0 2px -8px; }
  .student-action { padding-inline: 8px; }
  .input-action-row { display: grid; grid-template-columns: 1fr; }
  .compact-button { width: 100%; }
  .classes-dialog form { padding: 24px 20px; }
  .classes-dialog h2,
  .confirmation-dialog h2 { font-size: 30px; }
  .toast { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  body.classes-app { background: #fff; }
  body.classes-app::before,
  .classes-intro,
  .classes-panel,
  .roster-actions,
  .add-students-panel,
  .toast { display: none !important; }
  .classes-main { width: 100%; padding: 0; }
  .classes-workspace { display: block; }
  .roster-panel { border: 0; box-shadow: none; }
  .student-section { padding: 20px 0; }
  .student-list { grid-template-columns: repeat(2, 1fr); }
  .student-item { break-inside: avoid; }
  .student-actions { display: none; }
}
