:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #f8fbfa;
  --border: #e2e8e5;
  --text: #18231f;
  --muted: #64736c;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-light: #d7f0ec;
  --blue: #2563eb;
  --blue-light: #e0edff;
  --amber: #d97706;
  --amber-light: #fdf0d7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --purple: #7c3aed;
  --purple-light: #f0e9ff;
  --teal: #0d9488;
  --teal-light: #ccfbf1;
  --shadow: 0 10px 30px rgba(24, 45, 38, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 236px;
  --topbar-h: 62px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.14em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #10231f;
  color: #e8f2ef;
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 20px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, #2dd4bf, #0f766e);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark .icon {
  width: 24px;
  height: 24px;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #cfe0db;
  font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  background: #1d7a70;
  color: #fff;
}

.nav-item .icon {
  font-size: 18px;
}

.main-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

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

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.content {
  flex: 1;
  padding: 22px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0;
}

.page-subtitle {
  color: var(--muted);
  margin: 4px 0 0;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

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

.btn-secondary {
  background: #fff;
  color: var(--primary);
  border-color: #bfddd7;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

.score-stat-grid .stat-card {
  background: #e3edfb;
  border-color: #b9cff2;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 21px;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.clock-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1.25;
  margin-top: 4px;
}

.term-summary {
  font-weight: 800;
  font-size: 16px;
  color: var(--primary-dark);
  margin-top: 2px;
}

.bg-green {
  background: var(--primary-light);
  color: var(--primary);
}

.bg-blue {
  background: var(--blue-light);
  color: var(--blue);
}

.bg-amber {
  background: var(--amber-light);
  color: var(--amber);
}

.bg-purple {
  background: var(--purple-light);
  color: var(--purple);
}

.bg-teal {
  background: var(--teal-light);
  color: var(--teal);
}

.bg-red {
  background: var(--red-light);
  color: var(--red);
}

.section {
  margin-top: 22px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 750;
}

.list {
  display: grid;
  gap: 10px;
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-weight: 700;
}

.item-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.item-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
}

.icon-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.icon-btn.danger:hover {
  color: var(--red);
  border-color: var(--red);
}

.empty {
  border: 1px dashed #b9cbc5;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.empty-icon {
  font-size: 34px;
  margin-bottom: 8px;
  color: #7ba79e;
}

.form-grid {
  display: grid;
  gap: 13px;
}

.field label {
  display: block;
  font-weight: 650;
  margin-bottom: 6px;
}

.field .required {
  color: var(--red);
  margin-left: 3px;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  color: var(--text);
  outline: none;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.textarea {
  resize: vertical;
  min-height: 92px;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.perm-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 13px;
}

.perm-item input {
  accent-color: var(--primary);
}

.chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
}

.chip.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge-green {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-amber {
  background: var(--amber-light);
  color: var(--amber);
}

.badge-red {
  background: var(--red-light);
  color: var(--red);
}

.badge-blue {
  background: var(--blue-light);
  color: var(--blue);
}

.badge-purple {
  background: var(--purple-light);
  color: var(--purple);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 34, 30, 0.45);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 16px;
}

.modal {
  width: min(680px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  display: grid;
  gap: 8px;
  z-index: 200;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  background: #14211d;
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  animation: slide-in 0.22s ease;
}

.toast.error {
  background: #7f1d1d;
}

.toast.success {
  background: #0f766e;
}

@keyframes slide-in {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 15%, rgba(45, 212, 191, 0.18), transparent 34%),
    linear-gradient(145deg, #eef7f4, #f6f8f6 60%, #f2f1fb);
}

.auth-card {
  width: min(430px, 100%);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(22, 52, 45, 0.18);
  padding: 28px;
}

.auth-logo {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: linear-gradient(145deg, #2dd4bf, #0f766e);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  margin: 0 auto 14px;
}

.auth-logo-icon {
  width: 30px;
  height: 30px;
}

.auth-mode-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.auth-mode-label {
  font-size: 13px;
  color: var(--muted);
}

.auth-title {
  font-size: 24px;
  font-weight: 850;
  margin: 0 0 4px;
  text-align: center;
}

.auth-sub {
  color: var(--muted);
  margin: 0 0 20px;
  text-align: center;
}

.auth-switch {
  text-align: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.auth-switch button {
  border: 0;
  background: none;
  color: var(--primary);
  font-weight: 700;
  padding: 0;
}

.bottom-nav {
  display: none;
}

.resource-card {
  position: relative;
}

.resource-card .icon-btn {
  position: static;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(4, 72px);
  gap: 8px;
  margin-top: 8px;
}

.image-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f0f3f2;
}

.upload-box {
  width: 72px;
  height: 72px;
  border: 1px dashed #9bbfb7;
  border-radius: 10px;
  color: var(--primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--surface-2);
}

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

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 680px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

table.data-table.table-compact {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}

.table-compact th,
.table-compact td {
  padding: 8px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
}

.data-table tbody tr.clickable-row:hover,
.data-table tbody tr.clickable-row:focus-visible {
  background: var(--surface-2);
  outline: none;
}

.data-table tbody tr.clickable-row:focus-visible {
  box-shadow: inset 0 0 0 2px var(--primary);
}

.score-hero-card {
  background: #123f3a;
  border-color: #123f3a;
  color: #fff;
  box-shadow: 0 14px 28px rgba(18, 63, 58, 0.18);
}

.score-hero-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.score-hero-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.score-hero-no {
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 600;
}

.score-hero-class {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.score-hero-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.score-hero-tag {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
}

.score-hero-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.22);
  margin: 14px 0 10px;
}

.score-hero-date {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
}

.topbar-center {
  display: flex;
  align-items: center;
  position: relative;
}

.topbar-back {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  z-index: 2;
}

.topbar-center .topbar-back {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.topbar-back:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.topbar-center .topbar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  max-width: calc(100% - 150px);
}

.topbar-center .topbar-right {
  margin-left: auto;
}

.score-highlight-card {
  text-align: center;
  background: #e3edfb;
  border-color: #b9cff2;
}

.score-highlight-icon {
  font-size: 20px;
  line-height: 1;
}

.score-highlight-icon.crown {
  color: #d4a017;
}

.score-highlight-icon.rank {
  color: var(--primary);
}

.score-highlight-icon.chart {
  color: var(--blue);
}

.score-highlight-icon.grade {
  color: var(--purple);
}

.score-highlight-label {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.score-highlight-value {
  font-size: 30px;
  font-weight: 800;
  margin-top: 4px;
  letter-spacing: 0;
}

.score-highlight-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  margin-top: 4px;
}

.score-highlight-trend .icon {
  width: 14px;
  height: 14px;
}

.score-highlight-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.range-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
}

.range-inputs span {
  color: var(--muted);
}

.score-chart {
  display: block;
  width: 100%;
  height: auto;
}

.score-chart-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  text-align: center;
}

.score-chart-header .card-title {
  grid-column: 2;
}

.score-chart-header .muted {
  grid-column: 3;
  justify-self: end;
}

.score-chart text {
  font-family: inherit;
}

.chart-grid-line {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-y-label,
.chart-x-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: var(--primary);
  stroke: #fff;
  stroke-width: 2;
}

.chart-value {
  fill: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.score-history-item {
  align-items: flex-start;
  flex-wrap: wrap;
}

.score-history-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}

.score-history-stats span {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
}

.score-history-stats strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}

.score-record-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.score-record-stats span {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
}

.score-record-stats strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.homework-page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.homework-record-card {
  align-items: stretch;
  flex-direction: column;
  gap: 10px;
}

.homework-record-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 961px) {
  .homework-record-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .homework-detail-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .homework-detail-complete {
    width: auto;
  }

  .homework-detail-desktop-search {
    display: block;
    flex: 1;
    min-width: 0;
  }

  .homework-detail-search-row {
    display: none;
  }

  .homework-student-list {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 8px;
  }

  .homework-student-list .item-card {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px;
  }
}

@media (min-width: 768px) {
  .homework-detail-toolbar {
    display: flex !important;
    align-items: center;
    gap: 8px;
  }

  .homework-detail-complete {
    width: auto !important;
    flex: 1;
  }

  .homework-detail-desktop-search-group {
    display: flex !important;
    flex: 1;
    gap: 6px;
    min-width: 0;
  }

  .homework-detail-desktop-search-group .input {
    flex: 1;
    min-width: 0;
  }

  .homework-detail-desktop-search-group .btn {
    flex: 0 0 auto;
  }

  .homework-detail-desktop-search {
    display: block;
    flex: 1;
    min-width: 0;
  }

  .homework-detail-search-row {
    display: none !important;
  }
}

@media (max-width: 767px) {
  .homework-detail-desktop-search-group {
    display: none !important;
  }

  .homework-detail-desktop-search {
    display: none !important;
  }
}

.homework-record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.homework-record-title {
  flex: 1;
  min-width: 0;
}

.homework-record-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
  margin-left: auto;
}

.homework-register-btn {
  width: 100%;
}

.homework-content {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.homework-record-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.homework-record-stats span {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
}

.homework-record-stats strong {
  display: block;
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
}

.homework-detail-mobile-actions {
  display: none;
}

.homework-detail-page-header {
  display: none;
}

.homework-detail-stats-grid,
.homework-detail-card .chip-row {
  display: none;
}

.homework-detail-mobile-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.homework-detail-mobile-filters .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 4px;
  font-size: 12px;
}

.filter-count {
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.1);
  display: grid;
  place-items: center;
  font-size: 10px;
  padding: 0 4px;
}

.homework-detail-mobile-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.homework-detail-hero-info {
  flex: 1;
  min-width: 0;
}

.homework-detail-rate {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.homework-detail-rate span {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
}

.homework-detail-toolbar {
  margin-top: 12px;
}

.homework-detail-complete {
  width: 100%;
}

.homework-detail-desktop-search-group {
  display: none;
}

.homework-detail-desktop-search {
  display: block;
  flex: 1;
  min-width: 0;
}

.homework-detail-search-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.homework-detail-search-row .input {
  flex: 1;
  min-width: 0;
}

.homework-detail-search-row .btn {
  flex: 0 0 auto;
}

.homework-student-card {
  position: relative;
  cursor: pointer;
  background: #eef5f2;
  border-color: #d4e5df;
}

.homework-student-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  display: grid;
  place-items: center;
  color: transparent;
}

.homework-student-check.done {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.homework-student-check .icon {
  width: 13px;
  height: 13px;
}

.score-record-card {
  align-items: flex-start;
}

.score-record-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 18px;
  flex: 0 0 auto;
}

.score-record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.score-record-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-record-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.score-record-actions .btn {
  padding: 5px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.score-record-actions .icon {
  width: 13px;
  height: 13px;
}

.score-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.score-toolbar .card {
  flex: 1;
  margin-bottom: 0;
}

.score-toolbar .btn {
  flex: 0 0 auto;
}

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

.dashboard-stats-grid .stat-card {
  background: #e3edfb;
  border-color: #b9cff2;
}

.grid-4.dashboard-stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.clock-week {
  font-size: 14px;
  color: var(--muted);
  margin-top: 2px;
}

.clock-time {
  font-size: 18px;
  margin-top: 2px;
}

.term-date {
  font-weight: 700;
  margin-top: 2px;
}

.affairs-page-header {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.attendance-toolbar {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 14px;
}

.attendance-toolbar .card {
  flex: 1;
  margin-bottom: 0;
}

.attendance-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  width: 180px;
}

.attendance-actions .btn {
  width: 100%;
}

.attendance-date-meta {
  white-space: nowrap;
  overflow: visible;
}

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

.leave-type-editor {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.leave-type-editor .input {
  flex: 1;
  min-width: 0;
}

.student-card-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-card-main .item-title {
  flex: 0 0 auto;
}

.student-no {
  color: var(--muted);
  font-size: 13px;
}

.profile-hero-card {
  background: #123f3a;
  border-color: #123f3a;
  color: #fff;
  margin-bottom: 14px;
}

.profile-hero-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.profile-hero-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.profile-hero-no {
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 600;
}

.profile-hero-class {
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
}

.behavior-date-meta {
  white-space: nowrap;
  overflow: visible;
}

.behavior-type-modal-btn {
  display: inline-flex;
}

.behavior-type-editor {
  display: none;
}

.leave-type-modal-btn {
  display: inline-flex;
}

.attendance-type-editor {
  display: none;
}

.student-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-picker-row .select,
.student-picker-row .input {
  flex: 1;
  min-width: 0;
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 5px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  color: inherit;
}

.chip-remove .icon {
  width: 9px;
  height: 9px;
}

.text-up {
  color: #178f76;
}

.text-down {
  color: var(--red);
}

.import-guide {
  display: grid;
  gap: 14px;
}

.import-guide-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f0f7f4;
  border: 1px solid #cfe5dd;
  border-radius: 10px;
  padding: 12px;
  color: #164e41;
  line-height: 1.6;
}

.import-guide-note .icon {
  margin-top: 3px;
}

.import-guide-note code {
  display: inline-block;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #d7e6e0;
  border-radius: 6px;
  padding: 2px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  white-space: nowrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 12px 14px;
}

.summary-item span {
  font-size: 13px;
  color: var(--muted);
}

.summary-item strong {
  font-size: 16px;
  white-space: nowrap;
}

.schedule-grid {
  display: grid;
  grid-template-columns: 90px repeat(5, minmax(110px, 1fr));
  overflow-x: auto;
  gap: 6px;
}

.schedule-cell {
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.12s ease;
}

.schedule-cell:hover {
  border-color: var(--primary);
}

.period-time-list {
  display: grid;
  gap: 8px;
}

.period-row {
  display: grid;
  grid-template-columns: 64px minmax(90px, 1fr) 24px minmax(90px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.period-row input {
  min-width: 0;
}

.course-mini {
  border-radius: 8px;
  padding: 6px 8px;
  color: #fff;
  font-size: 13px;
  line-height: 1.25;
}

.course-blue {
  background: #2563eb;
}

.course-green {
  background: #0f766e;
}

.course-purple {
  background: #7c3aed;
}

.course-amber {
  background: #d97706;
}

.course-red {
  background: #dc2626;
}

.course-teal {
  background: #0f766e;
}

.course-indigo {
  background: #4338ca;
}

.course-orange {
  background: #c2410c;
}

.inline-form {
  display: grid;
  gap: 12px;
}

.student-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.link-card-main {
  display: block;
  min-width: 0;
}

.link-url {
  color: var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 960px) {
  :root {
    --topbar-h: 56px;
  }

  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    display: none;
  }

  .content {
    padding: 16px 14px 84px;
  }

  .page-title {
    font-size: 21px;
  }

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

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

  .grid-3.attendance-stats-grid,
  .grid-3.homework-stats-grid,
  .grid-3.behavior-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .grid-4.dashboard-stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }

  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--muted);
    min-width: 58px;
    padding: 4px;
    border-radius: 10px;
  }

  .bottom-nav a.active {
    color: var(--primary);
    font-weight: 700;
  }

  .bottom-nav .icon {
    font-size: 20px;
  }

  .item-card {
    align-items: flex-start;
  }

  .item-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 560px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

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

  .grid-3.attendance-stats-grid,
  .grid-3.homework-stats-grid,
  .grid-3.behavior-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .attendance-stats-grid .stat-card,
  .homework-stats-grid .stat-card,
  .behavior-stats-grid .stat-card {
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    text-align: center;
  }

  .attendance-stats-grid .stat-icon,
  .homework-stats-grid .stat-icon,
  .behavior-stats-grid .stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 15px;
  }

  .attendance-stats-grid .stat-value,
  .homework-stats-grid .stat-value,
  .behavior-stats-grid .stat-value {
    font-size: 16px;
  }

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

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

  .grid-4.dashboard-stats-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .dashboard-stats-grid .stat-card {
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    text-align: center;
  }

  .dashboard-stats-grid .stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 15px;
  }

  .dashboard-stats-grid .stat-value {
    font-size: 16px;
  }

  .score-stat-grid .stat-card {
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    text-align: center;
  }

  .score-stat-grid .stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 15px;
  }

  .score-stat-grid .stat-value {
    font-size: 17px;
  }

  .score-highlight-card {
    padding: 8px;
  }

  .score-highlight-value {
    font-size: 18px;
  }

  .score-highlight-icon {
    font-size: 16px;
  }

  .score-highlight-trend,
  .score-highlight-sub {
    font-size: 11px;
  }

  .score-history-stats span {
    padding: 5px 3px;
    font-size: 11px;
  }

  .score-history-stats strong {
    font-size: 13px;
  }

  .score-record-stats span {
    padding: 3px 1px;
    font-size: 9px;
  }

  .score-record-stats strong {
    font-size: 11px;
  }

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

  .score-toolbar .btn {
    width: 100%;
    order: -1;
  }

  .score-record-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .score-record-card .stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 15px;
  }

  .score-record-actions {
    gap: 4px;
  }

  .score-record-actions .btn {
    padding: 4px 5px;
    font-size: 10px;
  }

  .homework-page-actions {
    flex-direction: row;
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    background: var(--bg);
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    z-index: 40;
  }

  .homework-page-actions .btn {
    flex: 1;
  }

  .homework-record-head {
    position: relative;
    align-items: flex-start;
    width: 100%;
  }

  .homework-record-actions {
    position: absolute;
    right: 0;
    top: 0;
    margin-left: 0;
  }

  .homework-record-card {
    align-items: stretch;
  }

  .homework-record-title {
    padding-right: 90px;
  }

  .homework-record-stats {
    width: 100%;
    grid-template-columns: repeat(4, 1fr);
  }

  .homework-record-stats span {
    padding: 14px 6px;
    font-size: 14px;
  }

  .homework-record-stats strong {
    font-size: 20px;
  }

  .homework-detail-page-header,
  .homework-detail-stats-grid {
    display: none;
  }

  .homework-detail-mobile-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 12px;
  }

  .homework-detail-hero-info {
    flex: 1;
    min-width: 0;
  }

  .homework-detail-rate {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
  }

  .homework-detail-rate span {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 15px;
  }

  .homework-detail-mobile-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
  }

  .homework-detail-mobile-filters .chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 7px 4px;
    font-size: 12px;
  }

  .filter-count {
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.1);
    display: grid;
    place-items: center;
    font-size: 10px;
    padding: 0 4px;
  }

  .homework-detail-mobile-actions {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    z-index: 40;
  }

  .homework-detail-mobile-actions .btn {
    width: 100%;
  }

  .homework-detail-card .chip-row {
    display: none;
  }

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

  .homework-student-list .item-card {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 10px;
  }

  .homework-student-list .item-card .btn {
    width: 100%;
  }

  .page-header {
    flex-direction: column;
  }

  .affairs-page-header {
    flex-direction: row;
    align-items: center;
  }

  .affairs-page-header > div {
    flex: 1;
  }

  .affairs-page-header > .btn {
    flex: 0 0 auto;
    width: 100%;
  }

  .behavior-type-modal-btn {
    display: none;
  }

  .behavior-type-editor {
    display: flex;
  }

  .leave-type-modal-btn {
    display: none;
  }

  .attendance-type-editor {
    display: flex;
  }

  .behavior-date-meta {
    margin-top: 14px;
  }

  .attendance-toolbar {
    flex-direction: column;
  }

  .attendance-actions {
    order: -1;
    flex-direction: row;
    width: 100%;
  }

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

  .attendance-date-meta {
    margin-top: 14px;
  }

  .grid-2.leave-date-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .leave-date-grid .input {
    max-width: 150px;
    padding: 7px 4px;
    font-size: 12px;
    min-width: 0;
  }

  .page-actions {
    width: 100%;
  }

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

  .modal {
    padding: 16px;
  }

  .topbar {
    padding: 0 14px;
  }
}

.seat-table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.seat-table-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.seat-table-card .card-header {
  margin-bottom: 0;
}

.seat-table-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.seat-table-meta span {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  padding: 8px 6px;
  line-height: 1.4;
}

.seat-table-meta strong {
  color: var(--text);
  font-size: 17px;
}

.seat-table-open-btn {
  width: 100%;
}

.seat-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.seat-board {
  max-width: 1320px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.seat-podium {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 460px;
  min-height: 48px;
  margin: 0 auto 8px;
  border: 2px solid #164e41;
  border-radius: 12px;
  background: #123f3a;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.seat-grid-scroll {
  overflow-x: auto;
  padding: 18px 4px 4px;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(var(--seat-cols, 8), minmax(72px, 1fr));
  gap: 10px;
  min-width: max-content;
  width: 100%;
}

.seat-cell {
  display: flex;
  min-height: 72px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid #cbdad5;
  border-radius: 12px;
  background: #f7faf9;
  color: var(--text);
  padding: 8px 6px;
  text-align: center;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.seat-cell:hover {
  border-color: var(--primary);
  background: #eef7f4;
  transform: translateY(-1px);
}

.seat-cell.occupied {
  border-color: #a9d5ca;
  background: #e0f1ec;
}

.seat-cell-no {
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-cell-name {
  font-size: 14px;
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-cell-empty {
  color: var(--muted);
  font-size: 13px;
}

.seat-cell-code {
  color: #9aaba4;
  font-size: 11px;
}

@media (max-width: 560px) {
  .seat-table-grid {
    grid-template-columns: 1fr;
  }

  .seat-board {
    padding: 16px 12px;
  }

  .seat-podium {
    min-height: 42px;
    margin-bottom: 2px;
  }

  .seat-grid-scroll {
    padding-top: 14px;
  }

  .seat-grid {
    grid-template-columns: repeat(var(--seat-cols, 8), minmax(62px, 1fr));
    gap: 8px;
  }

  .seat-cell {
    min-height: 64px;
    border-radius: 10px;
    padding: 6px 4px;
  }
}
