:root {
  --bg: #f8f9fa;
  --card: #ffffff;
  --border: #dadce0;
  --text: #3c4043;
  --accent: #1a73e8;
  --muted: #5f6368;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand a { color: var(--text); text-decoration: none; font-weight: 600; }
.nav a { margin-left: 12px; color: var(--accent); text-decoration: none; }
.who { color: var(--muted); margin: 0 8px; }
.container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.app-shell {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 53px);
}
.sidebar {
  width: 270px;
  flex-shrink: 0;
  background: #f3f4f8;
  border-right: 1px solid var(--border);
  padding: 14px 12px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 14px;
  margin-bottom: 6px;
}
.sidebar-logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #2f3138;
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}
.sidebar-meta strong {
  display: block;
  font-size: 0.92rem;
}
.sidebar-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0;
}
.sidebar-section {
  margin: 10px 10px 4px;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.35;
  border: 1px solid transparent;
}
.sidebar-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a3a8b5;
  flex-shrink: 0;
}
.sidebar-link:hover {
  background: #fff;
  color: #1f3f90;
  border-color: #e1e3ea;
}
.sidebar-link.is-active {
  background: #fff;
  color: #1f3f90;
  font-weight: 600;
  border-color: #d8dced;
  box-shadow: 0 1px 2px rgba(22, 27, 45, 0.08);
}
.sidebar-link.is-active .sidebar-dot {
  background: #5b62ea;
}
.sidebar-disclosure {
  width: 100%;
  border-radius: 8px;
}
.sidebar-disclosure-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.35;
  border: 1px solid transparent;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.sidebar-disclosure-summary::-webkit-details-marker {
  display: none;
}
.sidebar-disclosure-summary:hover {
  background: #fff;
  color: #1f3f90;
  border-color: #e1e3ea;
}
.sidebar-disclosure[open] > .sidebar-disclosure-summary {
  background: #f8f9fc;
  border-color: #e1e3ea;
}
.sidebar-disclosure-summary.is-active-branch {
  color: #1f3f90;
  font-weight: 600;
}
.sidebar-disclosure-summary.is-active-branch .sidebar-dot {
  background: #5b62ea;
}
.sidebar-disclosure-summary-text {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.sidebar-disclosure-chevron {
  flex-shrink: 0;
  width: 0.45em;
  height: 0.45em;
  margin-left: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.sidebar-disclosure[open] .sidebar-disclosure-chevron {
  transform: rotate(225deg);
  margin-top: 2px;
}
.sidebar-disclosure-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 10px 6px;
  margin: 0 4px 0 10px;
  border-left: 2px solid #e1e3ea;
}
.sidebar-sublink {
  display: block;
  padding: 7px 10px 7px 14px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.86rem;
  line-height: 1.35;
  border: 1px solid transparent;
}
.sidebar-sublink:hover {
  background: #fff;
  color: #1f3f90;
  border-color: #e8eaf0;
}
.sidebar-sublink.is-active {
  background: #fff;
  color: #1f3f90;
  font-weight: 600;
  border-color: #d8dced;
}
.main-area {
  flex: 1;
  min-width: 0;
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 20px 32px;
  width: 100%;
}
.center-info-display {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.center-info-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.center-info-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.center-info-value {
  font-size: 0.95rem;
  line-height: 1.45;
}
.text-prewrap {
  white-space: pre-wrap;
  word-break: break-word;
}
.weekly-schedule {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}
.weekly-day-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
}
.weekly-day-row .checkbox-inline {
  min-width: 132px;
  margin-bottom: 0;
}
.weekly-day-time {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.weekly-day-time.is-hidden {
  display: none;
}
.weekly-day-time select {
  width: auto;
  min-width: 4.25rem;
}
.attendance-student-block {
  position: relative;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  margin-bottom: 12px;
  outline: none;
}
.attendance-student-block:hover,
.attendance-student-block:focus-within {
  border-color: #c5cad8;
  box-shadow: 0 1px 4px rgba(22, 27, 45, 0.06);
}
.attendance-student-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  justify-content: space-between;
}
.attendance-student-name {
  font-weight: 600;
  font-size: 1.05rem;
}
.attendance-current-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.attendance-current-attended {
  color: #137333;
  border-color: #b7dfc4;
  background: #e8f5e9;
}
.attendance-current-postpone {
  color: #b06000;
  border-color: #f0d4a8;
  background: #fff8e6;
}
.attendance-current-tbd {
  color: var(--muted);
  background: #f3f4f8;
}
.attendance-current-absent {
  color: #8a1f1f;
  border-color: #e8bdbd;
  background: #fdf2f2;
}
.attendance-hover-hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
}
.attendance-choice-pop {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(100% - 4px);
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(22, 27, 45, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.14s ease, visibility 0.14s ease;
}
.attendance-student-block:hover .attendance-choice-pop,
.attendance-student-block:focus-within .attendance-choice-pop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.subject-name-with-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  min-width: 0;
}
.student-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.student-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.student-status-pill-active {
  color: #137333;
  border-color: #b7dfc4;
  background: #e8f5e9;
}
.student-status-pill-active .student-status-dot {
  background: #1e8e3e;
}
.student-status-pill-inactive {
  color: #5f6368;
  border-color: #dadce0;
  background: #f1f3f4;
}
.student-status-pill-inactive .student-status-dot {
  background: #9aa0a6;
}
.student-row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}
.student-edit-panel-row.hidden,
.enrollment-edit-panel-row.hidden,
.admin-center-edit-row.hidden {
  display: none;
}
.admin-center-edit-cell {
  padding: 14px 16px;
  background: #f8f9fa;
}
.student-edit-inline-cell {
  padding: 14px 16px;
  background: #f8f9fa;
  border-top: none;
}
.student-edit-inline-cell .student-edit {
  margin: 0;
}
.student-edit label.checkbox-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 0;
}
.student-edit label.checkbox-inline input[type="checkbox"] {
  width: auto;
  margin-bottom: 0;
  flex-shrink: 0;
}
.student-edit label.checkbox-inline span {
  display: block;
  width: auto;
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}
.stack button.attendance-choice-btn {
  display: inline-block;
  width: auto;
  margin-bottom: 0;
}
.attendance-choice-btn {
  font: inherit;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fafbfc;
  color: var(--text);
  font-size: 0.9rem;
}
.attendance-choice-btn:hover {
  background: #fff;
  border-color: #c5cad8;
}
.attendance-choice-primary {
  border-color: #a8c7fa;
  background: #e8f0fe;
  color: #174ea6;
}
@media (max-width: 768px) {
  .attendance-hover-hint {
    display: none;
  }
  .attendance-choice-pop {
    position: static;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    margin-top: 12px;
    box-shadow: none;
    border-style: dashed;
  }
  .app-shell {
    flex-direction: column;
    min-height: auto;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 10px;
  }
  .sidebar-brand {
    padding: 4px 4px 10px;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
  }
  .sidebar-section {
    width: 100%;
    margin: 8px 0 2px;
  }
  .sidebar-link {
    padding: 8px 10px;
    font-size: 0.875rem;
  }
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.stack label, .stack input, .stack textarea, .stack button { display: block; width: 100%; margin-bottom: 10px; }
.stack label.checkbox-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.stack label.checkbox-inline input[type="checkbox"] {
  display: block;
  width: auto;
  margin-bottom: 0;
  flex-shrink: 0;
}
.stack label.checkbox-inline span {
  display: block;
  width: auto;
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid2 .full { grid-column: 1 / -1; }
input, textarea, select, button {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.color-input {
  padding: 0;
  width: 56px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
}
button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
  width: auto;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; }
.table-sort-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  font-weight: inherit;
}
.table-sort-link:hover {
  text-decoration: underline;
}
.table-sort-link.is-active {
  color: var(--accent);
}
.table-sort-indicator {
  font-size: 0.85em;
  line-height: 1;
}
.enrollment-class-count-cell { vertical-align: top; }
.enrollment-lesson-summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  list-style: none;
}
.enrollment-lesson-summary::-webkit-details-marker { display: none; }
.enrollment-lesson-dropdown[open] > .enrollment-lesson-summary {
  text-decoration: underline;
}
.enrollment-lesson-panel {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f7f8fc;
  border-radius: 8px;
  border: 1px solid var(--border);
  min-width: min(320px, 90vw);
  overflow: visible;
}
.enrollment-lesson-range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.enrollment-lesson-range strong {
  font-weight: 600;
  margin-right: 4px;
}
.enrollment-class-count-cell,
.enrollment-lesson-dropdown {
  overflow: visible;
}
.enrollment-lesson-dropdown[open] {
  position: relative;
  z-index: 12;
}
.enrollment-lesson-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.enrollment-lesson-li {
  display: block;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.enrollment-lesson-li:last-child { border-bottom: none; }
.enrollment-lesson-inline-wrap {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.enrollment-lesson-when {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.enrollment-lesson-datetime {
  display: inline-block;
  max-width: 100%;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.enrollment-lesson-datetime:hover { text-decoration: underline; }
.enrollment-lesson-attendance-inline {
  flex-shrink: 0;
}
.enrollment-reschedule-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: min(400px, 96vw);
  box-shadow: 0 18px 48px rgba(22, 27, 45, 0.18);
}
.enrollment-reschedule-dialog::backdrop {
  background: rgba(18, 22, 32, 0.38);
}
.enrollment-reschedule-form {
  padding: 22px 24px;
}
.enrollment-reschedule-title {
  margin: 0 0 10px;
  font-size: 1.25rem;
}
.enrollment-reschedule-lead {
  margin: 0 0 16px;
  font-size: 0.9rem;
}
.enrollment-reschedule-fields {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}
.enrollment-reschedule-fields label {
  display: block;
  font-weight: 600;
  font-size: 0.82rem;
  margin-bottom: 6px;
}
.enrollment-reschedule-fields input[type="date"],
.enrollment-reschedule-fields input[type="time"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
}
.enrollment-reschedule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.links { list-style: none; padding: 0; }
.links li { margin: 8px 0; }
.links a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.subject-item { padding: 12px 14px; }
.subject-row1 { display: flex; align-items: center; gap: 10px; }
.subject-dot { width: 12px; height: 12px; border-radius: 999px; display: inline-block; }
.subject-row2 { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.subject-title { display: flex; flex-direction: column; min-width: 0; }
.subject-subname { font-size: 0.82rem; line-height: 1.2; margin-top: 2px; }
.subject-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.inline-form { display: inline; margin: 0; }
.password-input-wrap {
  position: relative;
}
.password-input-wrap input {
  width: 100%;
  padding-right: 2.75rem;
}
.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #5b6170;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.password-toggle-btn:hover {
  background: #eef2ff;
  color: #2d3341;
}
.password-toggle-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e1e3ea;
  color: #3a3f4b;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.icon-btn:hover { background: #f7f8fc; border-color: #cfd4e2; }
.icon-btn.danger { color: #b4232d; }
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #f7f8fc; }
#calendar { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.calendar-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.calendar-toolbar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.calendar-toolbar-title {
  flex: 1;
  text-align: center;
  min-width: 200px;
}
.calendar-view-tabs {
  display: flex;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  background: #f7f8fc;
}
.calendar-view-tab {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.calendar-view-tab.is-active {
  background: var(--accent);
  color: #fff;
}
.day-schedule {
  background: var(--card);
  border: 2px solid #1a1a1a;
  margin: 0 auto;
  overflow-x: auto;
}
.day-schedule-header {
  text-align: center;
  font-weight: 700;
  font-size: 1.35rem;
  padding: 10px 12px;
  border-bottom: 2px solid #1a1a1a;
  background: #fff;
}
.day-schedule-grid-wrapper {
  display: contents;
}
.day-schedule-teacher-header-row,
.day-schedule-slot-row {
  display: grid;
  grid-template-columns: 90px repeat(var(--teacher-cols), minmax(160px, 1fr));
  border-bottom: 2px solid #1a1a1a;
}
.day-schedule-slot-row:last-child {
  border-bottom: none;
}
.day-schedule-teacher-header-row {
  background: #fff;
}
.day-schedule-teacher-header {
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 8px;
  border-right: 1px dotted #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}
.day-schedule-teacher-header:last-child {
  border-right: none;
}
.day-schedule-corner {
  background: #fff;
  border-right: 1px dotted #1a1a1a;
}
.day-schedule-slot-bar {
  text-align: center;
  font-weight: 700;
  padding: 8px 6px;
  background: #d9d9d9;
  border-right: 1px dotted #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: 0.9rem;
}
.day-schedule-teacher-col {
  display: flex;
  flex-direction: column;
  border-right: 1px dotted #1a1a1a;
  min-height: 44px;
  min-width: 0;
  overflow: visible;
  position: relative;
}
.day-schedule-student.attendance-student-block {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 0;
  border: none;
  border-radius: 0;
  background: inherit;
  outline: none;
  cursor: default;
  justify-content: flex-start;
  text-align: left;
  min-height: 40px;
  box-shadow: none;
}
.day-schedule-student.attendance-student-block:hover,
.day-schedule-student.attendance-student-block:focus-within {
  border: none;
  box-shadow: none;
}
.day-schedule-student.attendance-student-block .day-schedule-student-label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.day-schedule-student.attendance-student-block .day-schedule-student-name {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
}
.day-schedule-attendance-inline {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
.day-schedule-attendance-inline .calendar-attendance-icon-btn {
  width: 1.65rem;
  height: 1.65rem;
  font-size: 0.85rem;
}
.day-schedule-student-subject {
  font-weight: 600;
}
.day-schedule-attended-check {
  display: none;
  flex-shrink: 0;
  color: #16a34a;
  line-height: 0;
}
.day-schedule-student-attended .day-schedule-attended-check {
  display: inline-flex;
}
.day-schedule-attended-check-icon {
  display: block;
}
a.day-schedule-student-name {
  color: inherit;
  text-decoration: none;
}
a.day-schedule-student-name:hover {
  text-decoration: underline;
}
.calendar-attendance-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.calendar-attendance-icon-btn span {
  display: block;
  margin-top: 1px;
}
.calendar-attendance-icon-btn:hover {
  filter: brightness(1.08);
}
.calendar-attendance-icon-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.calendar-attendance-icon-attended {
  background: #22c55e;
}
.calendar-attendance-icon-postpone {
  background: #f97316;
}
.calendar-attendance-icon-reschedule {
  background: #9333ea;
}
.enrollment-renew-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: #ef4444;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
}
.enrollment-renew-icon-btn span {
  display: block;
  margin-top: 1px;
}
.enrollment-renew-icon-btn:hover {
  filter: brightness(1.08);
  color: #fff;
}
.day-schedule-teacher-col:last-child {
  border-right: none;
}
.day-schedule-student {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 10px;
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  min-height: 40px;
}
.day-schedule-student:hover:not(.attendance-student-block) {
  text-decoration: underline;
  filter: brightness(0.97);
}
.day-schedule-slot-row {
  overflow: visible;
}
.day-schedule-student-bordered {
  border-top: 1px dotted #1a1a1a;
}
.day-schedule-student.attendance-student-block.day-schedule-student-alt {
  box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.07);
}
.day-schedule-student-default {
  background: #b8e6b8;
}
.day-schedule-student-attended {
  background: #fff200;
}
.day-schedule-student-postpone {
  background: #ffb6c1;
}
.day-schedule-student-rescheduled {
  background: #fdba74;
}
.day-schedule-student-absent {
  background: #fca5a5;
}
.day-schedule-student-current {
  font-weight: 700;
  text-decoration: underline;
}
.day-schedule-dayoff {
  margin: 0;
}
@media (max-width: 560px) {
  .day-schedule-teacher-header-row,
  .day-schedule-slot-row {
    grid-template-columns: 72px repeat(var(--teacher-cols), minmax(130px, 1fr));
  }
  .day-schedule-teacher-header,
  .day-schedule-slot-bar,
  .day-schedule-student {
    font-size: 0.85rem;
    padding: 6px 6px;
  }
}
.fc .fc-bg-event.fc-center-day-off {
  opacity: 1;
}
.fc .fc-daygrid-day.fc-day-center-off .fc-daygrid-day-frame,
.fc .fc-timegrid-col.fc-day-center-off {
  background: #e8eaed;
}
.fc .fc-daygrid-day.fc-day-center-off .fc-daygrid-day-number {
  color: #6b7280;
}
.hidden { display: none; }
.dayoff-calendar-card {
  background: #fff;
}
.year-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}
.year-toolbar h2 {
  margin: 0;
  font-size: 1.3rem;
  min-width: 84px;
  text-align: center;
}
.year-nav {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #d7dbe7;
  border-radius: 50%;
  text-decoration: none;
  color: var(--text);
  background: #fff;
}
.year-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 12px 18px;
  margin-top: 12px;
}
.month-card {
  padding: 4px 6px;
}
.month-card h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 600;
}
.month-weekdays,
.month-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.month-weekdays span {
  text-align: center;
  color: #7b8190;
  font-size: 0.66rem;
}
.day-cell {
  border: none;
  border-radius: 4px;
  width: 100%;
  min-height: 26px;
  background: transparent;
  cursor: pointer;
  color: #2d3341;
  font-size: 0.72rem;
  padding: 0;
  justify-self: stretch;
}
.day-cell:hover {
  background: #eef2ff;
}
.day-cell.is-today {
  box-shadow: inset 0 0 0 1px #9aa7d4;
}
.day-cell.is-off {
  background: #e5e7eb;
  color: #6b7280;
  font-weight: 600;
}
.day-cell.is-off:hover {
  background: #d1d5db;
}
.day-cell.blank {
  visibility: hidden;
  pointer-events: none;
}
@media (max-width: 1100px) {
  .year-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
}
@media (max-width: 860px) {
  .year-grid { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
}
@media (max-width: 560px) {
  .year-grid { grid-template-columns: 1fr; }
}

.outstanding-balance {
  color: #c5221f;
  font-weight: 600;
}
.student-enrollment-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}
.student-enrollment-subject {
  font-weight: 600;
}
.lessons-outstanding-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 4px;
  border-radius: 999px;
  border: 2px solid #9ca3af;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  color: #1a1a1a;
  flex-shrink: 0;
}
.lessons-outstanding-badge-many {
  border-color: #84cc16;
  color: #38761d;
}
.lessons-outstanding-badge-one {
  border-color: #f97316;
  color: #f97316;
}
.lessons-outstanding-badge-none {
  border-color: #ef4444;
  color: #b4232d;
}
.enrollment-course-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
a.payments-outstanding-select-link {
  text-decoration: underline;
}
a.payments-outstanding-select-link:hover {
  opacity: 0.88;
}
.payments-outstanding-banner {
  border-color: #f0c4c0;
  background: #fff8f7;
}
.payments-outstanding-lead {
  margin: 0;
  font-size: 1rem;
}
.students-split-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}
.students-list-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 12px;
  max-height: calc(100vh - 180px);
  min-height: 320px;
}
.students-list-search-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
}
.students-list-search {
  width: 100%;
  box-sizing: border-box;
}
.students-list-status-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.students-list-status-form label {
  font-size: 0.85rem;
  font-weight: 600;
}
.students-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.students-list-item {
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.students-list-item:last-child {
  border-bottom: none;
}
.students-list-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 8px;
  color: inherit;
  text-decoration: none;
}
.students-list-link:hover {
  background: #f3f4f8;
}
.students-list-link.is-active {
  background: #e8f0fe;
  font-weight: 600;
}
.students-list-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.students-list-empty {
  padding: 12px 8px;
  list-style: none;
}
.students-detail-panel {
  padding: 16px 18px;
  min-height: 320px;
  max-height: calc(100vh - 180px);
  overflow: auto;
}
.student-enrollments-panel-embed {
  margin-top: 4px;
}
.student-enrollments-panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.student-enrollments-panel-filters {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  flex: 1;
  min-width: 260px;
}
.student-enrollments-panel-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.student-enrollments-add-btn {
  display: inline-block;
  text-decoration: none;
  white-space: nowrap;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  border: 1px solid var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
}
.student-enrollments-table-wrap {
  overflow-x: auto;
}
.students-detail-header-actions {
  justify-content: flex-end;
  width: 100%;
}
.students-detail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.students-detail-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
}
.students-detail-meta {
  margin: 0;
  font-size: 0.9rem;
}
.students-detail-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  max-width: 420px;
}
.students-detail-filters > div {
  flex: 1;
  min-width: 160px;
}
.student-edit-panel {
  margin-bottom: 16px;
  padding: 14px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.students-enrollments-heading {
  margin: 0 0 10px;
  font-size: 1.05rem;
}
.students-detail-empty {
  padding: 24px 8px;
  text-align: center;
}
@media (max-width: 900px) {
  .students-split-layout {
    grid-template-columns: 1fr;
  }
  .students-list-panel {
    max-height: 280px;
  }
}
.app-flash-stack,
.app-flash-live {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.app-flash {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.95rem;
}
.app-flash p {
  margin: 0;
  flex: 1;
  line-height: 1.45;
}
.app-flash-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}
.app-flash-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
.app-flash-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}
.app-flash-dismiss {
  flex-shrink: 0;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 0 2px;
}
.app-flash-dismiss:hover {
  opacity: 1;
}
.error-page h1 {
  margin-top: 0;
}
