:root {
  --blue: #4169f6;
  --blue-strong: #3157e8;
  --blue-soft: #edf2ff;
  --blue-pale: #f6f8ff;
  --green: #28b67a;
  --green-soft: #eaf8f1;
  --orange: #f5a13d;
  --orange-soft: #fff4e7;
  --red: #ef5a64;
  --red-soft: #fff0f1;
  --purple: #8869dc;
  --purple-soft: #f4f0ff;
  --ink: #1f2937;
  --ink-secondary: #596579;
  --muted: #8f99aa;
  --line: #e7ebf1;
  --page: #f4f6f9;
  --surface: #ffffff;
  --shadow: 0 7px 20px rgba(43, 57, 90, 0.055);
  --sidebar-width: 224px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 14px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
}

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

button {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(65, 105, 246, 0.2);
  outline-offset: 2px;
}

svg {
  display: block;
  flex: 0 0 auto;
}

.is-hidden {
  display: none !important;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  height: 74px;
  align-items: center;
  gap: 11px;
  padding: 0 20px;
  border-bottom: 1px solid #eef1f5;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 2px solid #7391ff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: inset 0 0 0 3px #fff;
  color: #fff;
  font-family: STKaiti, KaiTi, serif;
  font-size: 17px;
  font-weight: 700;
}

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

.brand-copy strong,
.brand-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

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

.main-nav {
  display: grid;
  gap: 7px;
  padding: 22px 14px;
}

.nav-item {
  display: flex;
  width: 100%;
  height: 44px;
  align-items: center;
  gap: 13px;
  padding: 0 15px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #727d8f;
  font-weight: 600;
  text-align: left;
  transition: 160ms ease;
}

.nav-item svg {
  width: 19px;
  height: 19px;
}

.nav-item:hover {
  background: #f5f7fb;
  color: var(--ink);
}

html[data-current-view="dashboard"] .nav-item[data-view="dashboard"],
html[data-current-view="register"] .nav-item[data-view="register"],
html[data-current-view="history"] .nav-item[data-view="history"],
html[data-current-view="ranking"] .nav-item[data-view="ranking"],
html[data-current-view="students"] .nav-item[data-view="students"] {
  background: var(--blue);
  box-shadow: 0 6px 14px rgba(65, 105, 246, 0.2);
  color: #fff;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.save-state,
.sidebar-help {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.save-state.is-loading .save-dot {
  background: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-soft);
}

.save-state.is-offline .save-dot,
.save-state.is-error .save-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.save-state.is-saving .save-dot {
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.sidebar-help {
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.sidebar-help:hover {
  background: #f5f7fb;
  color: var(--blue);
}

.sidebar-help:disabled {
  background: transparent;
  color: #b6bdc9;
}

.requires-owner {
  opacity: 0.62;
}

.requires-owner:hover {
  opacity: 0.86;
}

.sidebar-help svg {
  width: 16px;
}

.sidebar-scrim {
  display: none;
}

.app-main {
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 12px;
}

.topbar-kicker {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 10px;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.topbar-actions {
  gap: 10px;
}

.access-badge,
.owner-auth-button {
  display: inline-flex;
  height: 36px;
  align-items: center;
  gap: 7px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.access-badge {
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fafbfc;
  color: var(--ink-secondary);
}

.access-badge.is-owner {
  border-color: #caebdc;
  background: var(--green-soft);
  color: #187b52;
}

.access-badge svg,
.owner-auth-button svg {
  width: 15px;
  height: 15px;
}

.owner-auth-button {
  padding: 0 12px;
  border: 1px solid #d8e0fa;
  background: var(--blue-pale);
  color: var(--blue);
}

.owner-auth-button:hover {
  border-color: #bcc9f8;
  background: var(--blue-soft);
}

.owner-auth-button.is-owner {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-secondary);
}

.today-chip {
  display: flex;
  height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fafbfc;
  color: var(--ink-secondary);
  font-size: 12px;
}

.today-chip svg {
  width: 16px;
  color: var(--blue);
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: #778297;
}

.icon-button:hover {
  border-color: #cfd8f5;
  background: var(--blue-soft);
  color: var(--blue);
}

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

.mobile-menu {
  display: none;
}

.teacher-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--blue-soft);
  box-shadow: 0 0 0 1px #dbe3ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.content {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 22px 24px 40px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.welcome-band {
  position: relative;
  display: flex;
  min-height: 142px;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  padding: 26px 31px;
  border-radius: 8px;
  background: var(--blue);
  box-shadow: 0 8px 24px rgba(49, 87, 232, 0.18);
  color: #fff;
}

.welcome-band h2 {
  margin: 3px 0 7px;
  font-size: 24px;
  letter-spacing: 0;
}

.welcome-band p:not(.eyebrow) {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
}

.welcome-band .eyebrow {
  color: rgba(255, 255, 255, 0.7);
}

.welcome-band .primary-button {
  position: relative;
  z-index: 2;
  margin-right: 120px;
  border-color: #fff;
  background: #fff;
  color: var(--blue-strong);
}

.welcome-decoration {
  position: absolute;
  right: 25px;
  bottom: -24px;
  color: rgba(255, 255, 255, 0.12);
  transform: rotate(-8deg);
}

.welcome-decoration svg {
  width: 130px;
  height: 130px;
  stroke-width: 1.2;
}

.eyebrow {
  margin: 0;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  font-weight: 650;
  white-space: nowrap;
}

.primary-button {
  padding: 0 17px;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 5px 12px rgba(65, 105, 246, 0.16);
}

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

.secondary-button {
  padding: 0 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-secondary);
}

.secondary-button:hover {
  border-color: #cbd5f4;
  background: var(--blue-pale);
  color: var(--blue);
}

.primary-button svg,
.secondary-button svg,
.text-button svg {
  width: 17px;
  height: 17px;
}

.compact {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.text-button {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
}

.text-button svg {
  width: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 15px 0;
}

.metric-card {
  display: flex;
  min-height: 100px;
  align-items: center;
  justify-content: space-between;
  padding: 18px 19px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.metric-value strong {
  font-size: 27px;
  line-height: 1;
}

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

.metric-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
}

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

.metric-card.blue .metric-icon { background: var(--blue-soft); color: var(--blue); }
.metric-card.green .metric-icon { background: var(--green-soft); color: var(--green); }
.metric-card.orange .metric-icon { background: var(--orange-soft); color: var(--orange); }
.metric-card.red .metric-icon { background: var(--red-soft); color: var(--red); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.85fr);
  gap: 15px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 17px;
  border-bottom: 1px solid #edf0f4;
}

.panel-header h3 {
  margin: 0;
  font-size: 16px;
}

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

.class-overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 178px;
}

.class-summary {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 22px;
}

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

.class-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.class-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.class-badge {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.class-summary.ten .class-badge {
  background: var(--green-soft);
  color: var(--green);
}

.class-summary small {
  color: var(--muted);
}

.progress-track {
  height: 7px;
  margin: 22px 0 10px;
  overflow: hidden;
  border-radius: 4px;
  background: #eef1f5;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 300ms ease;
}

.class-summary.ten .progress-fill {
  background: var(--green);
}

.class-progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.class-progress-label strong {
  color: var(--ink);
  font-size: 13px;
}

.attention-list,
.recent-list {
  padding: 5px 17px 10px;
}

.attention-item,
.recent-item {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid #f0f2f5;
}

.attention-item:last-child,
.recent-item:last-child {
  border-bottom: 0;
}

.rank-index {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  place-items: center;
  border-radius: 6px;
  background: #f0f2f6;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.attention-item:nth-child(1) .rank-index { background: var(--red-soft); color: var(--red); }
.attention-item:nth-child(2) .rank-index { background: var(--orange-soft); color: var(--orange); }
.attention-item:nth-child(3) .rank-index { background: var(--blue-soft); color: var(--blue); }

.attention-info,
.recent-info {
  min-width: 0;
  flex: 1;
}

.attention-info b,
.attention-info span,
.recent-info b,
.recent-info span {
  display: block;
}

.attention-info b,
.recent-info b {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-info span,
.recent-info span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.attention-count {
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.recent-class {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
}

.recent-class.ten {
  background: var(--green-soft);
  color: var(--green);
}

.recent-missing {
  color: var(--red);
  font-size: 11px;
}

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

.legend-dot {
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
}

.legend-dot.class-nine { background: var(--blue); }
.legend-dot.class-ten { background: var(--green); }

.trend-chart {
  display: grid;
  height: 204px;
  grid-template-columns: repeat(7, minmax(34px, 1fr));
  align-items: end;
  gap: 11px;
  padding: 23px 24px 17px;
}

.chart-day {
  display: grid;
  height: 100%;
  grid-template-rows: 1fr auto;
  gap: 8px;
}

.chart-bars {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 5px;
  border-bottom: 1px solid var(--line);
}

.chart-bar {
  position: relative;
  width: min(18px, 34%);
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
  transition: height 300ms ease;
}

.chart-bar.ten {
  background: var(--green);
}

.chart-bar::after {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  color: var(--muted);
  content: attr(data-value);
  font-size: 9px;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 120ms;
}

.chart-bar:hover::after {
  opacity: 1;
}

.chart-label {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.inline-empty {
  display: grid;
  min-height: 130px;
  place-content: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.inline-empty svg {
  width: 25px;
  margin: 0 auto 8px;
  color: #bdc5d1;
}

.page-heading {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
}

.page-heading h2 {
  margin: 5px 0 5px;
  font-size: 23px;
  letter-spacing: 0;
}

.page-heading p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.workflow {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin-bottom: 15px;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.workflow > svg {
  width: 17px;
  color: #c5ccd7;
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workflow-step > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #eef1f5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.workflow-step.is-current > span {
  background: var(--blue);
  color: #fff;
}

.workflow-step b,
.workflow-step small {
  display: block;
}

.workflow-step b {
  font-size: 12px;
}

.workflow-step small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.form-panel {
  margin-bottom: 15px;
  padding: 18px;
}

.form-controls {
  display: flex;
  align-items: end;
  gap: 22px;
}

.control-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.control-grow {
  flex: 1;
}

.control-group legend,
.date-control,
.filter-row label,
.modal label,
.note-field {
  color: var(--ink-secondary);
  font-size: 11px;
  font-weight: 650;
}

.control-group legend {
  margin-bottom: 8px;
}

.segmented {
  display: inline-flex;
  min-width: 0;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f5f7fa;
}

.segmented button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #6f7a8c;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.segmented button:hover {
  color: var(--blue);
}

.segmented button.is-active {
  background: #fff;
  box-shadow: 0 1px 5px rgba(39, 52, 80, 0.1);
  color: var(--blue);
}

.segmented button svg {
  width: 15px;
  height: 15px;
}

.segmented.small button {
  min-height: 32px;
  padding: 0 13px;
}

.required-tag {
  padding: 2px 4px;
  border-radius: 3px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 8px;
}

.date-control {
  display: grid;
  gap: 8px;
}

input,
select {
  height: 40px;
  border: 1px solid #dfe4eb;
  border-radius: 6px;
  background: #fff;
  padding: 0 11px;
}

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

input:focus,
select:focus {
  border-color: var(--blue);
}

.date-control input {
  width: 155px;
}

.roster-panel {
  overflow: hidden;
}

.roster-header {
  min-height: 78px;
}

.roster-actions,
.selection-summary {
  display: flex;
  align-items: center;
}

.roster-actions {
  gap: 8px;
}

.selection-summary {
  min-height: 34px;
  gap: 5px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 10px;
}

.selection-summary strong {
  color: var(--red);
  font-size: 18px;
}

.selection-summary b {
  color: var(--green);
  font-size: 15px;
}

.selection-summary i {
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: var(--line);
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(90px, 1fr));
  gap: 9px;
  padding: 20px;
}

.student-check {
  position: relative;
  display: flex;
  width: 100%;
  height: 48px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 22px 0 8px;
  border: 1px solid #e3e7ed;
  border-radius: 6px;
  background: #fafbfc;
  color: #4f596a;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: 130ms ease;
}

.student-check::after {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 13px;
  height: 13px;
  border: 1px solid #d7dce4;
  border-radius: 3px;
  background: #fff;
  color: #fff;
  content: "";
  font-size: 9px;
  line-height: 12px;
}

.student-check:hover {
  border-color: #b9c8fd;
  background: var(--blue-pale);
  color: var(--blue);
}

.student-check.is-missing {
  border-color: #f3aab0;
  background: var(--red-soft);
  box-shadow: inset 3px 0 0 var(--red);
  color: #d94752;
}

.student-check.is-missing::after {
  border-color: var(--red);
  background: var(--red);
  content: "✓";
}

.register-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 20px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.note-field {
  display: grid;
  width: min(560px, 70%);
  gap: 7px;
}

.submit-button {
  min-width: 164px;
}

.filter-panel {
  margin-bottom: 15px;
  padding: 15px 17px;
}

.filter-row {
  display: flex;
  align-items: end;
  gap: 11px;
}

.filter-row label {
  display: grid;
  min-width: 145px;
  gap: 7px;
}

.filter-row .search-control {
  position: relative;
  flex: 1;
}

.search-control svg {
  position: absolute;
  bottom: 12px;
  left: 11px;
  width: 15px;
  color: var(--muted);
}

.search-control input {
  width: 100%;
  padding-left: 34px;
}

.filter-row > button {
  height: 40px;
}

.history-panel {
  overflow: hidden;
}

.table-caption {
  display: flex;
  height: 48px;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.table-caption strong {
  color: var(--blue);
}

.data-table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 14px 17px;
  border-bottom: 1px solid #eef1f4;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: #fafbfc;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.data-table td {
  color: var(--ink-secondary);
  font-size: 12px;
}

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

.data-table th:nth-child(1) { width: 115px; }
.data-table th:nth-child(2) { width: 110px; }
.data-table th:nth-child(3) { width: 100px; }
.data-table th:nth-child(5) { width: 160px; }
.data-table th:nth-child(6) { width: 105px; }

.align-right {
  text-align: right !important;
}

.class-pill,
.type-pill,
.zero-pill {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
}

.class-pill { background: var(--blue-soft); color: var(--blue); }
.class-pill.ten { background: var(--green-soft); color: var(--green); }
.type-pill { background: var(--purple-soft); color: var(--purple); }
.zero-pill { background: var(--green-soft); color: var(--green); }

.missing-names {
  display: -webkit-box;
  overflow: hidden;
  color: #c94651;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.table-action {
  display: inline-grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}

.table-action:hover {
  background: var(--blue-soft);
  color: var(--blue);
}

.table-action.danger:hover {
  background: var(--red-soft);
  color: var(--red);
}

.table-action svg {
  width: 15px;
  height: 15px;
}

.mobile-records {
  display: none;
}

.empty-state {
  display: grid;
  min-height: 300px;
  place-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 38px;
  height: 38px;
  margin: 0 auto 10px;
  color: #c7ced8;
}

.empty-state h4 {
  margin: 0 0 6px;
  color: var(--ink-secondary);
  font-size: 14px;
}

.empty-state p {
  margin: 0;
  font-size: 11px;
}

.ranking-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 15px;
}

.summary-tile {
  display: flex;
  min-height: 86px;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary-tile-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
}

.summary-tile:nth-child(2) .summary-tile-icon { background: var(--red-soft); color: var(--red); }
.summary-tile:nth-child(3) .summary-tile-icon { background: var(--green-soft); color: var(--green); }

.summary-tile-icon svg {
  width: 20px;
}

.summary-tile p,
.summary-tile strong {
  display: block;
  margin: 0;
}

.summary-tile p {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.summary-tile strong {
  font-size: 20px;
}

.ranking-panel {
  overflow: hidden;
}

.ranking-list {
  padding: 4px 17px 14px;
}

.ranking-row {
  display: grid;
  min-height: 56px;
  grid-template-columns: 42px minmax(110px, 0.7fr) 80px minmax(160px, 1.4fr) 70px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #eef1f4;
}

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

.ranking-position {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 6px;
  background: #f1f3f6;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.ranking-row:nth-child(1) .ranking-position { background: #fff0d8; color: #d98b1a; }
.ranking-row:nth-child(2) .ranking-position { background: #eef1f5; color: #667084; }
.ranking-row:nth-child(3) .ranking-position { background: #f8eee9; color: #ad7354; }

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

.ranking-bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #eef1f5;
}

.ranking-bar-fill {
  min-width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
}

.ranking-row.is-zero .ranking-bar-fill {
  background: var(--green);
}

.ranking-total {
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.ranking-row.is-zero .ranking-total {
  color: var(--green);
}

.roster-management {
  overflow: hidden;
}

.student-panel-header {
  min-height: 66px;
}

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

.roster-count strong {
  color: var(--blue);
  font-size: 17px;
}

.manage-student-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  padding: 17px;
}

.manage-student {
  display: flex;
  min-width: 0;
  height: 54px;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.student-number {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 9px;
  font-weight: 700;
}

.manage-student-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-actions {
  display: flex;
  opacity: 0.45;
  transition: opacity 120ms;
}

.manage-student:hover .manage-actions,
.manage-student:focus-within .manage-actions {
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 27, 43, 0.38);
  backdrop-filter: blur(3px);
}

.modal {
  display: grid;
  width: min(420px, 100%);
  gap: 17px;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 54px rgba(25, 33, 53, 0.19);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 4px 0 0;
  font-size: 18px;
}

.modal label {
  display: grid;
  gap: 8px;
}

.modal input,
.modal select {
  width: 100%;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 3px;
}

.form-error {
  min-height: 16px;
  margin: -7px 0 0;
  color: var(--red);
  font-size: 11px;
}

.login-copy {
  margin: -5px 0 0;
  color: var(--ink-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  display: flex;
  min-height: 46px;
  max-width: min(380px, calc(100vw - 32px));
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border: 1px solid #caebdc;
  border-radius: 7px;
  background: #f5fffa;
  box-shadow: 0 10px 30px rgba(25, 48, 39, 0.15);
  color: #187b52;
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  border-color: #f4c7cb;
  background: #fff7f7;
  color: #c43843;
}

.toast svg {
  width: 18px;
}

@media (max-width: 1240px) {
  .student-grid { grid-template-columns: repeat(6, minmax(90px, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .manage-student-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .form-controls { flex-wrap: wrap; }
  .control-grow { order: 3; width: 100%; flex-basis: 100%; }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 208px; }
  .content { padding: 18px 18px 36px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .welcome-band .primary-button { margin-right: 95px; }
  .student-grid { grid-template-columns: repeat(5, minmax(88px, 1fr)); }
  .filter-row { flex-wrap: wrap; }
  .filter-row .search-control { min-width: 260px; }
  .data-table { min-width: 880px; }
  .manage-student-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
}

@media (max-width: 760px) {
  .sidebar {
    width: min(270px, 83vw);
    box-shadow: 12px 0 34px rgba(20, 28, 45, 0.16);
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open { transform: translateX(0); }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(25, 32, 47, 0.35);
  }

  .sidebar-scrim.is-visible { display: block; }

  .app-main {
    width: 100%;
    margin-left: 0;
  }

  .topbar {
    height: 64px;
    padding: 0 14px;
  }

  .mobile-menu { display: inline-grid; }
  .topbar-kicker { display: none; }
  .today-chip { display: none; }
  .access-badge span,
  .owner-auth-button span { display: none; }
  .access-badge,
  .owner-auth-button { width: 36px; padding: 0; justify-content: center; }
  .content { padding: 14px 12px 30px; }

  .welcome-band {
    min-height: 166px;
    align-items: flex-start;
    padding: 20px;
  }

  .welcome-band h2 { font-size: 21px; }
  .welcome-band .primary-button { position: absolute; bottom: 18px; left: 20px; margin: 0; }
  .welcome-decoration { right: 5px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 10px 0; }
  .metric-card { min-height: 84px; padding: 13px; }
  .metric-card p { margin-bottom: 6px; font-size: 10px; }
  .metric-value strong { font-size: 22px; }
  .metric-icon { width: 36px; height: 36px; }
  .metric-icon svg { width: 18px; }
  .dashboard-grid { gap: 10px; }
  .class-overview { grid-template-columns: 1fr; }
  .class-summary + .class-summary { border-top: 1px solid var(--line); border-left: 0; }
  .trend-chart { gap: 4px; padding-inline: 12px; }
  .page-heading { align-items: flex-start; margin-bottom: 10px; }
  .page-heading h2 { font-size: 20px; }
  .page-heading > .segmented { width: auto; }
  .page-heading > .segmented button { padding: 0 8px; }
  .workflow { gap: 7px; justify-content: space-between; padding-inline: 12px; }
  .workflow > svg { width: 12px; }
  .workflow-step { gap: 5px; }
  .workflow-step > span { width: 25px; height: 25px; }
  .workflow-step small { display: none; }
  .workflow-step b { font-size: 10px; }
  .form-panel { padding: 14px; }
  .form-controls { display: grid; gap: 16px; }
  .control-grow { order: initial; width: 100%; }
  .segmented { width: 100%; }
  .segmented button { min-width: 0; flex: 1; padding: 0 7px; }
  .date-control input { width: 100%; }
  .roster-header { align-items: flex-start; flex-direction: column; }
  .roster-actions { width: 100%; flex-wrap: wrap; }
  .selection-summary { margin-right: auto; }
  .student-grid { grid-template-columns: repeat(3, minmax(85px, 1fr)); gap: 7px; padding: 12px; }
  .student-check { height: 45px; font-size: 11px; }
  .register-footer { align-items: stretch; flex-direction: column; padding: 14px; }
  .note-field { width: 100%; }
  .submit-button { min-height: 44px; }
  .filter-row { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-row label,
  .filter-row .search-control { min-width: 0; }
  .filter-row .search-control { grid-column: 1 / -1; }
  .filter-row > button { grid-column: 1 / -1; }
  .data-table-wrap { display: none; }
  .mobile-records { display: grid; }
  .mobile-record {
    display: grid;
    gap: 12px;
    padding: 15px;
    border-bottom: 1px solid var(--line);
  }
  .mobile-record-top,
  .mobile-record-meta,
  .mobile-record-actions { display: flex; align-items: center; }
  .mobile-record-top { justify-content: space-between; gap: 10px; }
  .mobile-record-top strong { font-size: 13px; }
  .mobile-record-meta { gap: 7px; }
  .mobile-record-missing { color: var(--ink-secondary); font-size: 11px; line-height: 1.7; }
  .mobile-record-missing b { color: var(--red); }
  .mobile-record-actions { justify-content: flex-end; }
  .ranking-summary { grid-template-columns: 1fr; gap: 8px; }
  .summary-tile { min-height: 70px; }
  .ranking-row { grid-template-columns: 34px minmax(80px, 1fr) 58px 58px; gap: 7px; }
  .ranking-bar-track { display: none; }
  .manage-student-grid { grid-template-columns: 1fr 1fr; gap: 7px; padding: 12px; }
  .manage-actions { opacity: 1; }
}

@media (max-width: 480px) {
  .topbar-actions > .icon-button { display: none; }
  .teacher-avatar { width: 33px; height: 33px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-icon { display: none; }
  .panel-header { padding-inline: 14px; }
  .legend { display: none; }
  .page-heading { min-height: 64px; }
  .page-heading > .primary-button,
  .page-heading > .secondary-button { min-width: 40px; padding: 0 11px; }
  .page-heading > .primary-button svg,
  .page-heading > .secondary-button svg { margin: 0; }
  .student-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .student-check { padding-inline: 5px 18px; }
  .roster-actions .secondary-button { padding: 0 8px; }
  .required-tag { display: none; }
  #registration-type button { font-size: 11px; }
  #registration-type button svg { display: none; }
  .filter-row { grid-template-columns: 1fr; }
  .filter-row .search-control,
  .filter-row > button { grid-column: auto; }
  .ranking-panel .panel-header { align-items: flex-start; }
  .ranking-panel .panel-header p { display: none; }
  .manage-student-grid { grid-template-columns: 1fr; }
}

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