:root {
  color-scheme: light;
  --bg: #eef3f3;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --ink: #172426;
  --muted: #627276;
  --faint: #8a999d;
  --line: #dfe8e7;
  --line-strong: #c4d4d2;
  --primary: #176963;
  --primary-strong: #0d524e;
  --primary-soft: #e1f2ef;
  --sakura: #c75f78;
  --sakura-soft: #fae7ec;
  --gold: #9a6718;
  --gold-soft: #fff0cf;
  --blue: #316eb7;
  --blue-soft: #e8f1fb;
  --red: #b73a3a;
  --red-soft: #fde8e8;
  --green: #1f7a4d;
  --green-soft: #e6f5ed;
  --sidebar: #112326;
  --shadow: 0 18px 40px rgba(17, 45, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #edf5f3 0, rgba(237, 245, 243, 0) 310px),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 74px minmax(0, 1fr);
}

.app-shell.locked {
  display: none;
}

.auth-screen {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(360px, 440px);
  gap: 44px;
  align-items: center;
  min-height: 100vh;
  padding: 42px clamp(24px, 7vw, 96px);
  color: #ffffff;
  background:
    linear-gradient(120deg, rgba(8, 31, 35, 0.92), rgba(10, 54, 51, 0.82)),
    radial-gradient(circle at 24% 20%, rgba(246, 205, 214, 0.32), transparent 24%),
    var(--sidebar);
}

.auth-screen.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.auth-brand {
  display: flex;
  gap: 18px;
  align-items: center;
  align-self: start;
}

.brand-mark.large {
  width: 56px;
  height: 56px;
  font-size: 24px;
}

.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand strong {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.15;
}

.auth-brand small {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
}

.auth-card {
  width: 100%;
  padding: 28px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 14px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
}

.auth-copy h1 {
  margin-bottom: 8px;
  font-size: 28px;
}

.auth-copy p {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.auth-tab {
  min-height: 36px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-weight: 800;
}

.auth-tab.active {
  color: #ffffff;
  background: var(--primary);
}

.auth-form {
  display: none;
  gap: 12px;
}

.auth-form.active {
  display: grid;
}

.auth-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 750;
}

.auth-admin {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.auth-admin strong {
  color: var(--ink);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
}

.cloud-chip[data-tone="ok"] {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.cloud-chip[data-tone="pending"] {
  color: #8a5b00;
  background: #fff4d6;
}

.cloud-chip[data-tone="error"] {
  color: #bd3037;
  background: var(--sakura-soft);
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  color: #d8e7e6;
  background:
    radial-gradient(circle at 25% 8%, rgba(246, 205, 214, 0.18), transparent 18%),
    linear-gradient(180deg, rgba(13, 56, 53, 0.2), rgba(7, 22, 26, 0.16)),
    var(--sidebar);
  border-right: 1px solid #091719;
  overflow: hidden;
}

.sidebar::after {
  position: absolute;
  right: -50px;
  bottom: -18px;
  width: 260px;
  height: 260px;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(ellipse at 42% 68%, rgba(255, 255, 255, 0.18), transparent 12%),
    linear-gradient(135deg, transparent 0 42%, rgba(152, 177, 172, 0.32) 43% 47%, transparent 48%),
    linear-gradient(25deg, transparent 0 36%, rgba(210, 223, 217, 0.16) 37% 41%, transparent 42%),
    linear-gradient(160deg, transparent 0 44%, rgba(210, 223, 217, 0.14) 45% 49%, transparent 50%);
  opacity: 0.8;
  filter: blur(0.2px);
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 2px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  color: #0c3836;
  background: linear-gradient(135deg, #fff 0%, #f6cdd6 100%);
  border-radius: 50%;
  font-size: 18px;
  font-weight: 900;
}

.sidebar-toggle {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  color: #d8e7e6;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 850;
}

.sidebar-toggle span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
}

.app-shell.sidebar-collapsed .sidebar {
  padding-inline: 14px;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
  padding-bottom: 10px;
}

.app-shell.sidebar-collapsed .sidebar-note,
.app-shell.sidebar-collapsed .nav-item {
  font-size: 0;
}

.app-shell.sidebar-collapsed .brand div {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle strong {
  display: none;
}

.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.app-shell.sidebar-collapsed .nav-item .icon {
  font-size: 13px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.32;
}

.brand small {
  margin-top: 3px;
  color: #94aaad;
  font-size: 12px;
}

.nav-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 9px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: #cbdbdc;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 750;
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(77, 150, 110, 0.86), rgba(123, 176, 128, 0.74));
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #c7efe8;
  background: rgba(199, 239, 232, 0.12);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

.sidebar-note {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.sidebar-note span,
.sidebar-note p {
  color: #99adb0;
  font-size: 12px;
}

.sidebar-note strong {
  display: block;
  margin: 5px 0 8px;
  color: #ffffff;
}

.sidebar-note p {
  margin: 0;
  line-height: 1.55;
}

.main {
  padding: 18px 28px 28px;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  min-height: 58px;
  margin: -18px -28px 18px;
  padding: 10px 28px;
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.crumb {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.crumb span {
  color: var(--line-strong);
}

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

h1 {
  margin-bottom: 5px;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
}

.topbar p,
.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: grid;
  gap: 8px;
  align-items: stretch;
  justify-items: end;
  max-width: min(100%, 900px);
}

.top-action-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.top-action-row.compact {
  gap: 6px;
}

.top-action-row.compact .secondary-button,
.top-action-row.compact .ghost-button,
.top-action-row.compact .primary-button {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 12px;
}

.student-list-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.student-list-tools select {
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 800;
}

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

.empty-inline {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
}

.campus-select {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
}

.campus-select select {
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
}

.search {
  display: grid;
  grid-template-columns: 28px minmax(190px, 280px);
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.search span {
  color: var(--muted);
  font-size: 18px;
}

.search input {
  width: 100%;
  min-height: 38px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button,
.danger-button,
.status-button {
  min-height: 36px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
}

.primary-button {
  padding: 0 14px;
  color: #ffffff;
  background: var(--primary);
  border: 1px solid var(--primary);
}

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

.ghost-button {
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
}

.text-button {
  padding: 0 6px;
  color: var(--primary-strong);
  background: transparent;
  border: 0;
}

.danger-button {
  padding: 0 10px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #edc2c2;
}

.module-panel {
  display: none;
}

.module-panel.active {
  display: block;
}

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

.metric-card,
.panel {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  position: relative;
  min-height: 118px;
  padding: 18px;
  overflow: hidden;
}

.metric-card::after {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  content: "";
  background: var(--primary-soft);
  border-radius: 8px;
}

.metric-card.warn::after {
  background: var(--sakura-soft);
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
}

.metric-card small {
  display: block;
  margin-top: 10px;
  color: var(--faint);
  font-size: 12px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.lower-grid,
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.55fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.two-column {
  grid-template-columns: 390px minmax(0, 1fr);
  margin-top: 0;
}

.schedule-workspace {
  grid-template-columns: 360px minmax(0, 1fr);
}

.trial-workspace {
  grid-template-columns: 390px minmax(0, 1fr);
}

.side-stack {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 16px;
  border-radius: 10px;
}

.board-panel {
  padding: 0;
  overflow: hidden;
}

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

.board-panel .panel-head {
  padding: 16px 16px 0;
}

.panel-head.compact {
  margin-bottom: 12px;
}

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

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

.filter-row select,
label input,
label select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
}

textarea {
  min-height: 96px;
  padding-top: 10px;
  resize: vertical;
}

.course-strip {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
  overflow-x: auto;
}

.course-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
}

.course-chip.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.attendance-table,
.schedule-table,
.student-admin-list {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.teacher-admin-list {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.attendance-header {
  display: grid;
  grid-template-columns: 96px minmax(128px, 1.1fr) minmax(150px, 1.2fr) minmax(104px, 0.9fr) 84px 92px minmax(210px, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  color: var(--muted);
  background: #f7faf9;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}

.board-panel .attendance-table {
  border-width: 1px 0 0;
  border-radius: 0;
}

.attendance-row,
.schedule-row,
.student-admin-row {
  display: grid;
  gap: 12px;
  align-items: center;
  min-height: 68px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.attendance-row {
  grid-template-columns: 96px minmax(128px, 1.1fr) minmax(150px, 1.2fr) minmax(104px, 0.9fr) 84px 92px minmax(210px, 1fr);
  gap: 10px;
}

.attendance-row:hover {
  background: #fbfdfc;
}

.attendance-row:last-child,
.schedule-row:last-child,
.student-admin-row:last-child {
  border-bottom: 0;
}

.person-cell {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-radius: 8px;
  font-weight: 900;
}

.avatar.warn {
  color: var(--sakura);
  background: var(--sakura-soft);
}

.avatar.photo-avatar,
.student-photo-preview.has-photo {
  overflow: hidden;
  padding: 0;
  background: #eef5f3;
}

.avatar.photo-avatar img,
.student-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-upload-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.student-photo-preview {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.photo-upload-row input[type="file"] {
  flex: 1 1 220px;
}

.main-text strong,
.main-text span {
  display: block;
}

.main-text span,
.meta,
.timeline small,
.renewal-card span,
.message-card span,
.schedule-row span,
.student-admin-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.lesson-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
}

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

.lesson-pill.low {
  color: var(--sakura);
  background: var(--sakura-soft);
}

.status-pending {
  color: var(--muted);
  background: var(--surface-soft);
}

.status-present {
  color: var(--green);
  background: var(--green-soft);
}

.status-leave {
  color: var(--blue);
  background: var(--blue-soft);
}

.status-late {
  color: var(--gold);
  background: var(--gold-soft);
}

.status-absent {
  color: var(--red);
  background: var(--red-soft);
}

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

.status-button {
  padding: 0 8px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}

.status-button.active[data-status="present"] {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b7dfc9;
}

.status-button.active[data-status="leave"] {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #bdd4f0;
}

.status-button.active[data-status="late"] {
  color: var(--gold);
  background: var(--gold-soft);
  border-color: #f1d28d;
}

.status-button.active[data-status="absent"] {
  color: var(--red);
  background: var(--red-soft);
  border-color: #efbcbc;
}

.renewal-list,
.message-list,
.timeline,
.teacher-list,
.insight-list,
.finance-list {
  display: grid;
  gap: 8px;
}

.renewal-card,
.message-card,
.timeline-item,
.teacher-row,
.insight-card {
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.renewal-card {
  display: grid;
  gap: 6px;
}

.renewal-list.large .renewal-card,
.message-list.large .message-card {
  grid-template-columns: minmax(150px, 1fr) minmax(220px, 1.2fr) auto;
  align-items: center;
}

.renewal-card strong,
.message-card strong,
.teacher-row strong,
.insight-card strong {
  display: block;
  font-size: 14px;
}

.message-card.done {
  opacity: 0.64;
}

.timeline-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 10px;
}

.dot {
  width: 8px;
  height: 8px;
  margin-top: 7px;
  background: var(--primary);
  border-radius: 50%;
}

.timeline p {
  margin: 0;
  font-size: 13px;
}

.teacher-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 70px 90px;
  gap: 10px;
  align-items: center;
}

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

.form-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 31, 31, 0.28);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(620px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  box-shadow: 0 24px 70px rgba(13, 52, 49, 0.22);
}

.modal-card.wide-modal {
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-actions > button {
  flex: 1 1 180px;
}

.form-hint {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inline-manage-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.inline-manage-form input {
  min-height: 36px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
}

.settings-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.settings-list.compact-list {
  max-height: min(54vh, 520px);
  padding-right: 4px;
  overflow: auto;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 90px auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.setting-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

label {
  display: grid;
  gap: 7px;
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  min-height: 32px;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
}

label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

label input:focus,
label select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 99, 0.12);
}

.student-admin-row {
  grid-template-columns: 42px minmax(130px, 0.9fr) minmax(130px, 0.85fr) minmax(150px, 0.95fr) 118px 92px 142px;
}

.schedule-row {
  grid-template-columns: 72px minmax(170px, 1fr) 104px 100px 108px minmax(112px, 0.8fr) 72px;
}

.inline-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.student-mini-chip {
  min-height: 24px;
  padding: 0 7px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid #c9e5df;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.mini-select,
.empty-cell-student-select {
  width: 100%;
  min-height: 30px;
  padding: 4px 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
}

.empty-cell-student-select {
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.week-cell:hover .empty-cell-student-select {
  opacity: 1;
}

.finance-row {
  display: grid;
  grid-template-columns: 108px minmax(150px, 1fr) 100px 96px minmax(130px, 0.8fr) 74px;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.finance-row > span,
.finance-row > strong {
  color: var(--muted);
  font-size: 13px;
}

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

.trial-filter-grid.list-filter {
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  padding: 12px;
  margin-bottom: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.wide-filter {
  grid-column: span 2;
}

.trial-items-editor {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trial-items-editor h3 {
  margin: 0;
  font-size: 15px;
}

.trial-items-editor p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.trial-item-list {
  display: grid;
  gap: 10px;
}

.trial-item-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.85fr) 128px minmax(110px, 0.9fr) minmax(110px, 0.95fr) minmax(140px, 1fr) 66px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trial-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.trial-breakdown > div {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trial-breakdown h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.trial-breakdown article {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.trial-breakdown article span {
  color: var(--muted);
  font-size: 12px;
}

.trial-list-panel {
  margin-top: 0;
}

.trial-analytics-panel {
  margin-top: 16px;
}

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

.duty-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
}

.duty-hero h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.duty-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.duty-period-switch {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.duty-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.55fr);
}

.admin-duty-overview,
.admin-review-workspace {
  grid-template-columns: 1fr;
}

.lower-duty,
.duty-month-panel {
  margin-top: 16px;
}

.duty-task-list,
.duty-review-list,
.duty-issue-list,
.duty-month-list {
  display: grid;
  gap: 8px;
}

.duty-task-row,
.duty-review-row,
.duty-issue-row,
.duty-month-row {
  display: grid;
  gap: 12px;
  align-items: center;
  min-height: 70px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.duty-task-row {
  grid-template-columns: minmax(170px, 1fr) 82px minmax(160px, 1fr) minmax(150px, 0.8fr) 132px;
}

.duty-review-row {
  grid-template-columns: 86px minmax(220px, 1.2fr) 82px 112px 240px;
}

.duty-issue-row {
  grid-template-columns: minmax(220px, 1fr) 82px 112px 156px;
}

.duty-month-row {
  grid-template-columns: minmax(120px, 1fr) repeat(5, minmax(72px, 0.45fr)) 92px;
}

.duty-task-row > span,
.duty-review-row > span,
.duty-issue-row > span,
.duty-month-row > span {
  color: var(--muted);
  font-size: 13px;
}

.duty-photo {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 850;
  overflow: hidden;
}

.duty-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.review-actions {
  flex-wrap: wrap;
}

.duty-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  font-weight: 900;
}

.duty-score.green {
  color: var(--green);
  background: var(--green-soft);
}

.duty-score.yellow {
  color: var(--gold);
  background: var(--gold-soft);
}

.duty-score.red {
  color: var(--red);
  background: var(--red-soft);
}

.trial-row {
  display: grid;
  grid-template-columns: 100px minmax(140px, 1fr) 90px 100px 86px minmax(180px, 1.2fr) 210px;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trial-header {
  min-height: 42px;
  color: var(--muted);
  background: #f7faf9;
  font-size: 12px;
  font-weight: 850;
}

.trial-header span,
.trial-header strong {
  color: var(--muted);
}

.trial-row > span,
.trial-row > strong {
  color: var(--muted);
  font-size: 13px;
}

.empty.small {
  padding: 10px 8px;
  font-size: 12px;
}

.followup-history {
  margin-top: 6px;
}

.followup-history summary {
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.followup-history p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.date-filter {
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
}

.compact-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.compact-metrics .metric-card {
  min-height: 96px;
  padding: 14px;
}

.teacher-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.teacher-tab {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
}

.teacher-tab span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  min-height: 20px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-radius: 999px;
  font-size: 12px;
}

.teacher-tab.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.teacher-tab.active span {
  color: var(--primary-strong);
  background: #ffffff;
}

.schedule-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.schedule-tools > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 850;
}

.week-schedule {
  --schedule-zoom: 1;
  display: grid;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: auto;
}

.week-row {
  display: grid;
  grid-template-columns: calc(108px * var(--schedule-zoom)) repeat(7, minmax(calc(126px * var(--schedule-zoom)), 1fr));
  min-width: calc(990px * var(--schedule-zoom));
  border-bottom: 1px solid var(--line);
}

.quick-add-row {
  display: grid;
  grid-template-columns: calc(108px * var(--schedule-zoom)) repeat(7, minmax(calc(126px * var(--schedule-zoom)), 1fr));
  min-width: calc(990px * var(--schedule-zoom));
  background: #fbfdfc;
  border-top: 1px solid var(--line);
}

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

.week-head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: calc(40px * var(--schedule-zoom));
  color: var(--muted);
  background: #f7faf9;
  font-size: calc(13px * var(--schedule-zoom));
  font-weight: 850;
}

.week-head span,
.time-cell {
  display: flex;
  align-items: center;
  padding: calc(10px * var(--schedule-zoom));
  border-right: 1px solid var(--line);
}

.week-head span {
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.week-head small,
.week-range {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.week-head span:last-child,
.week-cell:last-child {
  border-right: 0;
}

.time-cell {
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  color: var(--ink);
  background: #fbfdfc;
  font-size: calc(13px * var(--schedule-zoom));
  font-weight: 850;
}

.time-cell small {
  color: var(--muted);
  font-size: calc(11px * var(--schedule-zoom));
  font-weight: 700;
}

.week-cell {
  min-height: calc(92px * var(--schedule-zoom));
  padding: calc(8px * var(--schedule-zoom));
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.quick-add-cell {
  display: flex;
  align-items: center;
  min-height: calc(56px * var(--schedule-zoom));
  padding: calc(8px * var(--schedule-zoom));
  border-right: 1px solid var(--line);
}

.quick-add-cell:last-child {
  border-right: 0;
}

.quick-add-cell .secondary-button {
  width: 100%;
  min-height: 32px;
}

.schedule-empty-state {
  min-width: calc(990px * var(--schedule-zoom));
  padding: 22px;
  color: var(--muted);
  background: #ffffff;
  border-top: 1px solid var(--line);
  text-align: center;
  font-weight: 800;
}

.week-cell.drag-over {
  background: var(--primary-soft);
  outline: 2px solid rgba(23, 105, 99, 0.3);
  outline-offset: -2px;
}

.schedule-block {
  display: grid;
  gap: calc(4px * var(--schedule-zoom));
  padding: calc(8px * var(--schedule-zoom));
  color: var(--primary-strong);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--campus-color, #176963) 42%, #ffffff);
  border-left: calc(4px * var(--schedule-zoom)) solid var(--campus-color, #176963);
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(17, 45, 51, 0.08);
}

.schedule-block.temporary {
  background: #fff8ea;
}

.schedule-block + .schedule-block {
  margin-top: 6px;
}

.schedule-block strong {
  font-size: calc(13px * var(--schedule-zoom));
}

.schedule-block span,
.schedule-block small {
  color: var(--muted);
  font-size: calc(12px * var(--schedule-zoom));
}

.teacher-assignment {
  width: fit-content;
  color: var(--primary-strong);
  font-weight: 850;
}

.teacher-assignment.substitute {
  min-height: calc(20px * var(--schedule-zoom));
  padding: 0 calc(7px * var(--schedule-zoom));
  color: #8a4b12;
  background: #fff3d6;
  border: 1px solid #f0c16d;
  border-radius: 999px;
}

.schedule-block-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.tiny-button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 11px;
}

.campus-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: calc(20px * var(--schedule-zoom));
  padding: 0 calc(7px * var(--schedule-zoom));
  color: var(--campus-color, var(--primary-strong));
  background: color-mix(in srgb, var(--campus-color, #176963) 12%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--campus-color, #176963) 28%, #ffffff);
  border-radius: 999px;
  font-size: calc(11px * var(--schedule-zoom));
  font-weight: 850;
}

.schedule-block:active {
  cursor: grabbing;
}

.schedule-list-head {
  margin-top: 4px;
}

.teacher-admin-row {
  display: grid;
  grid-template-columns: 42px minmax(150px, 0.9fr) minmax(160px, 0.85fr) minmax(150px, 0.85fr) 92px minmax(280px, auto);
  gap: 12px;
  align-items: center;
  min-height: 70px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

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

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.subject-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 230px;
  padding: 10px;
  overflow: auto;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}

.room-picker {
  max-height: 170px;
}

.subject-option {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 30px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.subject-option input {
  width: 15px;
  height: 15px;
}

.tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-list span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 800;
}

.room-tags span {
  color: var(--gold);
  background: var(--gold-soft);
}

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

.row-actions button {
  min-width: max-content;
  white-space: nowrap;
}

.empty {
  padding: 28px 18px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1220px) {
  .dashboard-grid,
  .lower-grid,
  .two-column,
  .duty-workspace {
    grid-template-columns: 1fr;
  }

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

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

  .trial-filter-grid,
  .trial-breakdown,
  .trial-item-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .auth-screen {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

  .nav-item {
    justify-content: center;
  }

  .nav-item .icon,
  .sidebar-note,
  .sidebar-toggle {
    display: none;
  }

  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
    width: 100%;
  }

  .top-action-row {
    justify-content: flex-start;
  }

  .top-action-row > * {
    flex: 1 1 150px;
  }

  .top-action-row .icon-only {
    flex: 0 0 40px;
  }

  .compact-metrics {
    grid-template-columns: 1fr;
  }

  .attendance-row,
  .student-admin-row,
  .teacher-admin-row,
  .finance-row,
  .trial-row,
  .duty-task-row,
  .duty-review-row,
  .duty-issue-row,
  .duty-month-row,
  .schedule-row,
  .renewal-list.large .renewal-card,
  .message-list.large .message-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .attendance-row > *,
  .student-admin-row > *,
  .teacher-admin-row > *,
  .finance-row > *,
  .trial-row > *,
  .duty-task-row > *,
  .duty-review-row > *,
  .duty-issue-row > *,
  .duty-month-row > *,
  .schedule-row > *,
  .renewal-list.large .renewal-card > *,
  .message-list.large .message-card > * {
    grid-column: 1 / -1;
  }

  .attendance-row .avatar,
  .student-admin-row .avatar,
  .duty-review-row .duty-photo {
    grid-column: 1;
  }

  .attendance-row .main-text,
  .student-admin-row .main-text,
  .teacher-admin-row .main-text,
  .duty-review-row .main-text {
    grid-column: 2;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

  .metric-grid,
  .nav-list,
  .form-split,
  .inline-manage-form,
  .setting-row,
  .subject-picker {
    grid-template-columns: 1fr;
  }

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

  .duty-period-switch {
    width: 100%;
  }

  .duty-period-switch .teacher-tab {
    flex: 1 1 0;
    justify-content: center;
  }

  .search {
    grid-template-columns: 28px minmax(0, 1fr);
  }

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