:root {
  --bg: #f5f6f4;
  --surface: #fff;
  --soft: #f0f4f1;
  --line: #d7dfd9;
  --line-strong: #bdc9c1;
  --text: #1f2723;
  --muted: #66736d;
  --green: #1f7a55;
  --green-dark: #145a3d;
  --amber: #a76512;
  --red: #b33b3b;
  --red-soft: #fff0f0;
  --yellow-soft: #fff7db;
  --shadow: 0 12px 28px rgba(32, 40, 35, .07);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif; }
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 23px; line-height: 1.2; }
h2 { font-size: 16px; }
.hidden { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 18px; }
.login-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 24px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.7; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 72px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.subline { margin-top: 5px; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; align-items: end; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.balance-alert-button strong { margin-left: 5px; color: inherit; }
.balance-alert-button.has-alert { border-color: #d9a34a; background: var(--yellow-soft); color: #7d4a08; }
.layout { display: grid; grid-template-columns: 166px minmax(0,1fr); min-height: calc(100vh - 72px); }
.side-nav { position: sticky; top: 72px; align-self: start; display: flex; flex-direction: column; gap: 7px; height: calc(100vh - 72px); padding: 16px 12px; border-right: 1px solid var(--line); background: #ebefec; }
.nav-item { min-height: 40px; padding: 0 13px; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 700; text-align: left; }
.nav-item:hover { background: #dfe8e2; color: var(--text); }
.nav-item.active { background: var(--green); color: #fff; }
.content { width: 100%; max-width: 1520px; padding: 18px; }
.view { display: none; }
.view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.metric, .panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.metric { min-height: 92px; padding: 16px; }
.metric span { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { display: block; margin-top: 10px; font-size: 30px; line-height: 1; }
.balance-alert-panel { border-left: 3px solid #d9a34a; }
.balance-alert-panel .panel-head > div { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.work-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 14px; margin-bottom: 14px; }
.panel { margin-bottom: 14px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 13px 15px; border-bottom: 1px solid var(--line); background: var(--soft); }
.head-note { color: var(--muted); font-size: 13px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(3,minmax(130px,1fr)); gap: 12px; padding: 15px; }
.lesson-mode-switch { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.schedule-mode-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.schedule-mode-switch .lesson-mode-option { min-height: 58px; }
#scheduleStudentMultiSelect, #cardTypeSubjectSelect { min-height: 112px; padding: 5px; }
.card-renewal-mode-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lesson-mode-option { position: relative; display: grid; gap: 4px; min-height: 64px; padding: 10px 12px 10px 38px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; cursor: pointer; }
.lesson-mode-option:hover { border-color: var(--green); background: #f5f9ff; }
.lesson-mode-option.selected { border-color: var(--green); background: var(--accent-soft); box-shadow: 0 0 0 3px rgba(0,113,227,.12); }
.lesson-mode-option input { position: absolute; left: 12px; top: 13px; width: 16px; min-height: 16px; height: 16px; padding: 0; accent-color: var(--green); }
.lesson-mode-option strong { color: var(--text); font-size: 14px; line-height: 1.25; }
.lesson-mode-option span { color: var(--muted); font-size: 12px; font-weight: 700; }
.field { display: grid; gap: 5px; min-width: 0; }
.field span { color: var(--muted); font-size: 12px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--text); outline: none; }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,113,227,.15); }
.field input[readonly] { background: #f7f9f7; color: var(--muted); }
.field-note { display: flex; align-items: center; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #f7f9f7; color: var(--muted); font-size: 13px; line-height: 1.4; }
.field-note.warning { border-color: #e2bf72; background: #fff8e7; color: #926114; }
.field-note.negative { border-color: #edb0b0; background: var(--red-soft); color: var(--red); }
.field-note.positive { border-color: #b7dfc8; background: #eef8f2; color: var(--green-dark); }
.field.compact { width: 164px; }
.note-tip { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-left: 6px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; color: var(--muted); font-family: Georgia, "Times New Roman", serif; font-size: 12px; font-weight: 700; line-height: 1; vertical-align: middle; cursor: help; }
.note-tip:hover, .note-tip:focus-visible { color: var(--green-dark); border-color: var(--green); background: #f5f9ff; }
.note-tip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.note-tip::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 280px; padding: 8px 11px; border-radius: 8px; background: #26322a; color: #fff; font-family: inherit; font-size: 12px; font-weight: 400; line-height: 1.55; letter-spacing: 0; text-align: left; white-space: normal; opacity: 0; visibility: hidden; transition: opacity .15s ease; pointer-events: none; z-index: 40; box-shadow: 0 8px 22px rgba(15,35,20,.25); }
.note-tip.tip-left::after { left: auto; right: 0; transform: none; }
.note-tip:hover::after, .note-tip:focus-visible::after { opacity: 1; visibility: visible; }
.field.wide { grid-column: span 2; }
.form-actions { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
#consultantStudentForm .consultant-student-owner { grid-column: span 2; }
#consultantStudentForm .field.wide,
#consultantStudentForm .form-actions { grid-column: 1 / -1; }
#consultantStudentForm .form-actions { justify-content: flex-end; align-items: center; }
@media (max-width: 900px) {
  #consultantStudentForm .consultant-student-owner,
  #consultantStudentForm .field.wide,
  #consultantStudentForm .form-actions { grid-column: span 1; }
  #consultantStudentForm .form-actions { justify-content: stretch; }
  #consultantStudentForm .form-actions .primary { width: 100%; }
}
.inline-form { display: grid; grid-template-columns: minmax(160px, 1fr) auto; align-items: end; gap: 12px; padding: 15px; border-bottom: 1px solid var(--line); }
.course-type-form { grid-template-columns: minmax(180px, 1fr) minmax(120px, 160px) auto; }
.card-type-form { grid-template-columns: minmax(180px, 1fr) minmax(120px, 160px) minmax(220px, 1fr) auto; }
.inline-form-actions { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.primary, .ghost, .small-action { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 12px; border-radius: 7px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.primary { background: var(--green); color: #fff; }
.primary:hover { background: var(--green-dark); }
.ghost { border: 1px solid var(--line-strong); background: #fff; color: var(--text); }
.link-button { display: inline-flex; align-items: center; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--green-dark); font-weight: 700; white-space: normal; text-align: left; }
.link-button:hover { text-decoration: underline; }
.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap.tall { max-height: calc(100vh - 180px); overflow: auto; }
.compact-table table { min-width: 420px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { height: 42px; padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: 14px; }
th { position: sticky; top: 0; z-index: 2; background: #fbfcfb; color: var(--muted); font-size: 13px; font-weight: 700; }
tbody tr:hover { background: #f8faf8; }
.actions-col { width: 132px; }
.row-actions { display: flex; gap: 6px; }
.small-action { min-height: 30px; padding: 0 9px; background: #edf5f0; color: var(--green-dark); font-size: 13px; }
.small-action.danger { background: var(--red-soft); color: var(--red); }
.small-action:disabled { opacity: .45; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 58px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.pending { background: var(--yellow-soft); color: var(--amber); }
.badge.approved { background: #e6f3eb; color: var(--green-dark); }
.badge.rejected { background: var(--red-soft); color: var(--red); }
.permission-box { display: grid; gap: 12px; padding: 15px; color: var(--muted); line-height: 1.7; }
.filter-row { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; padding: 15px; border-bottom: 1px solid var(--line); }
.balance-filter-row { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.lesson-filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lesson-filter-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; padding: 15px; border-bottom: 1px solid var(--line); }
.lesson-filter-keyword { grid-column: span 2; }
.lesson-filter-summary { min-height: 42px; padding: 11px 15px; border-bottom: 1px solid var(--line); background: #fbfcfb; color: var(--muted); font-size: 13px; font-weight: 700; }
.settlement-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}
.settlement-summary { padding: 11px 15px; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 700; }
.schedule-head { align-items: flex-end; }
.schedule-week-actions { display: flex; align-items: end; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.schedule-metrics { padding: 15px 15px 0; margin-bottom: 0; }
.schedule-filter-grid { grid-template-columns: repeat(6, minmax(130px, 1fr)); }
.schedule-board-wrap { padding: 0; }
.schedule-board-table { min-width: 1180px; table-layout: fixed; }
.schedule-board-table th { text-align: center; }
.schedule-board-table thead th:first-child, .schedule-time-head { width: 106px; min-width: 106px; background: #f4f7f5; color: var(--text); font-weight: 800; }
.schedule-board-table thead th span { display: block; color: var(--text); font-size: 14px; }
.schedule-board-table thead th strong { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.schedule-board-table td { height: 116px; padding: 5px; vertical-align: top; background: #fff; }
.schedule-cell { display: grid; gap: 3px; height: 104px; align-content: start; overflow: hidden; }
.schedule-card { display: block; width: 100%; min-height: 23px; padding: 3px 5px; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 6px; background: #fbfdfb; color: var(--text); text-align: left; box-shadow: 0 2px 8px rgba(32, 40, 35, .04); outline: none; }
.schedule-card.cancelled { border-left-color: var(--red); background: var(--red-soft); opacity: .82; }
.schedule-card:hover, .schedule-card:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(0, 113, 227, .12); }
.schedule-card-main { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.25; font-weight: 700; }
.schedule-more { min-height: 23px; padding: 0 6px; border: 1px dashed var(--line-strong); border-radius: 6px; background: #f7faf8; color: var(--green-dark); font-size: 12px; font-weight: 800; text-align: left; }
.schedule-more:hover, .schedule-more:focus { border-style: solid; background: #edf5f0; }
.schedule-card-actions { gap: 5px; flex-wrap: wrap; }
.schedule-card-actions .small-action { min-height: 28px; padding: 0 8px; }
.schedule-empty, .schedule-empty-cell { color: var(--muted); font-size: 13px; }
.schedule-empty { padding: 30px 15px; text-align: center; }
.schedule-empty-cell { display: inline-flex; min-height: 84px; align-items: center; justify-content: center; width: 100%; border: 1px dashed var(--line); border-radius: 7px; background: #fafbfa; }
.schedule-admin-panel .form-grid { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
.weekday-choice-group { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-height: 36px; }
.weekday-choice-group label { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--text); font-size: 13px; font-weight: 700; }
.weekday-choice-group input { width: 16px; min-height: 16px; height: 16px; padding: 0; accent-color: var(--green); }
.settings-tabs { display: flex; gap: 0; margin-bottom: 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.settings-tab { flex: 1 0 auto; min-height: 44px; padding: 0 18px; border-right: 1px solid var(--line); background: #fff; color: var(--muted); font-weight: 700; }
.settings-tab:last-child { border-right: 0; }
.settings-tab:hover { background: var(--soft); color: var(--text); }
.settings-tab.active { background: var(--green); color: #fff; }
.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-table-wrap { max-height: calc(100vh - 330px); overflow: auto; border-top: 1px solid var(--line); }
.profile-form { border-bottom: 1px solid var(--line); }
.system-form .field.wide { grid-column: span 3; }
.update-panel { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.update-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; }
.update-row strong { display: block; margin-bottom: 4px; }
.time-slot-summary { display: grid; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.time-slot-summary-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.time-slot-summary-head strong { font-size: 14px; }
.time-slot-summary-head span, .time-slot-dialog-meta { color: var(--muted); font-size: 12px; font-weight: 700; }
.time-slot-chip-list { display: flex; gap: 7px; flex-wrap: wrap; }
.time-slot-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 13px; font-weight: 800; }
.time-slot-chip strong { color: var(--muted); font-size: 12px; }
.time-slot-dialog { width: min(560px, calc(100vw - 32px)); }
.time-slot-panel { display: grid; gap: 14px; padding: 18px; }
.time-slot-dialog-list { display: grid; gap: 9px; max-height: min(520px, calc(100vh - 230px)); overflow: auto; padding-right: 4px; }
.time-slot-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) 72px; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.time-slot-index { display: inline-flex; align-items: center; justify-content: center; width: 34px; min-height: 36px; border: 1px solid var(--line); border-radius: 7px; background: #f7f9f7; color: var(--muted); font-size: 12px; font-weight: 800; }
.time-slot-row .time-slot-input { min-height: 36px; }
.time-slot-editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.time-slot-dialog-actions { justify-content: flex-end; flex-wrap: wrap; }
.muted { color: var(--muted); }
.positive { color: var(--green-dark); font-weight: 700; }
.warning { color: var(--amber); font-weight: 700; }
.negative { color: var(--red); font-weight: 700; }
.empty { height: 86px; color: var(--muted); text-align: center; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 40; max-width: min(360px, calc(100vw - 36px)); padding: 11px 13px; border-radius: 8px; background: var(--text); color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.account-dialog { width: min(430px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--text); box-shadow: 0 24px 60px rgba(24, 32, 27, .24); }
.account-dialog::backdrop { background: rgba(22, 29, 25, .42); }
.student-transfer-dialog { width: min(600px, calc(100vw - 32px)); }
.schedule-slot-dialog { width: min(1180px, calc(100vw - 32px)); }
.schedule-slot-panel { display: grid; gap: 14px; padding: 18px; }
.schedule-slot-meta { margin-top: 5px; color: var(--muted); font-size: 13px; font-weight: 700; }
.student-transfer-meta { margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.student-transfer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.schedule-slot-table { max-height: min(560px, calc(100vh - 230px)); overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.schedule-slot-table table { min-width: 1080px; }
.schedule-slot-table .actions-col { width: 186px; }
.schedule-series-cell { color: var(--muted); font-size: 13px; line-height: 1.4; }
.password-form { display: grid; gap: 14px; padding: 18px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.dialog-close { width: 34px; height: 34px; border-radius: 7px; background: transparent; color: var(--muted); font-size: 25px; line-height: 1; }
.dialog-close:hover { background: var(--soft); color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.correction-dialog { width: min(720px, calc(100vw - 32px)); }
.correction-dialog .correction-panel { display: grid; gap: 14px; padding: 18px; }
.correction-meta { margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.correction-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.correction-review { display: grid; gap: 14px; }
.correction-review-reason { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.correction-review-reason strong { color: var(--muted); font-size: 12px; font-weight: 800; }
.correction-review-reason p { margin: 6px 0 0; line-height: 1.5; }
.correction-review-reason.rejected { border-color: #edb0b0; background: var(--red-soft); }
.correction-diff { border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.correction-diff table { min-width: 440px; }
.correction-diff th, .correction-diff td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: normal; }
.correction-diff thead th { background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 800; }
.correction-diff tr:last-child td { border-bottom: 0; }
.correction-changed { background: #fff8e7; }
.correction-changed td:first-child { color: #926114; font-weight: 800; }
.installer-shell { min-height: 100vh; padding: 28px 18px; }
.installer-panel { width: min(920px, 100%); margin: 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.installer-head { padding: 22px 24px; border-bottom: 1px solid var(--line); background: var(--soft); }
.installer-head p { margin: 8px 0 0; color: var(--muted); }
.installer-form { padding: 20px 24px 24px; }
.installer-form fieldset { margin: 0 0 20px; padding: 0; border: 0; }
.installer-form legend { width: 100%; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-weight: 700; }
.install-grid { padding: 0; }
.check-field { display: flex; align-items: center; gap: 9px; min-height: 36px; color: var(--text); font-size: 14px; }
.check-field input { width: 17px; height: 17px; accent-color: var(--green); }
.demo-password { max-width: 420px; margin-top: 10px; }
.installer-actions { display: flex; justify-content: flex-end; }
.install-error { margin: 20px 24px 0; padding: 11px 13px; border: 1px solid #e9baba; border-radius: 7px; background: var(--red-soft); color: var(--red); }
.install-result { display: grid; justify-items: start; gap: 12px; padding: 28px 24px; }
.install-result p { margin: 0; color: var(--muted); }
.success-message { border-left: 4px solid var(--green); }
.warning-message { border-left: 4px solid var(--amber); }
.install-result-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.install-result-note { color: var(--muted); font-size: 13px; font-weight: 700; }
.install-config { width: 100%; min-height: 280px; margin: 0; padding: 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: #f8faf8; color: var(--text); font-family: Consolas, "Courier New", monospace; font-size: 12px; line-height: 1.5; resize: vertical; }
@media (max-width: 1280px) {
  .lesson-filter-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}
@media (max-width: 900px) {
  .topbar { position: static; align-items: stretch; flex-direction: column; }
  .top-actions { width: 100%; align-items: stretch; justify-content: flex-start; }
  .top-actions > * { flex: 1 1 160px; }
  .layout { grid-template-columns: 1fr; }
  .side-nav { position: sticky; top: 0; z-index: 20; flex-direction: row; height: auto; padding: 9px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-item { flex: 0 0 auto; text-align: center; }
  .metric-grid, .work-grid, .form-grid, .filter-row, .balance-filter-row, .lesson-filter-grid, .schedule-admin-panel .form-grid, .lesson-mode-switch, .correction-form-grid { grid-template-columns: 1fr; }
  .multi-select-options { grid-template-columns: 1fr; max-height: 220px; }
  .inline-form { grid-template-columns: 1fr; }
  .course-type-form, .card-type-form { grid-template-columns: 1fr; }
  .inline-form-actions { justify-content: flex-start; }
  .field.compact { width: 100%; }
  .field.wide { grid-column: span 1; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .row-actions { flex-wrap: wrap; }
  .update-row { align-items: flex-start; flex-direction: column; }
  .time-slot-row { grid-template-columns: 38px minmax(0, 1fr) 72px; }
  .time-slot-dialog-actions { justify-content: flex-start; }
  .lesson-filter-keyword { grid-column: span 1; }
  .schedule-head { align-items: stretch; flex-direction: column; }
  .schedule-week-actions { justify-content: flex-start; }
  .schedule-table-wrap { max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px); overflow: auto; -webkit-overflow-scrolling: touch; }
}

/* System identity settings */
.brand-settings-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  padding: 14px 15px;
  border-top: 1px solid #dfe7f2;
  border-bottom: 1px solid #dfe7f2;
  background: #f8fbff;
}
.brand-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand-settings-title {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.brand-settings-title strong {
  color: var(--text);
  font-size: 15px;
}
.brand-settings-title span,
.brand-preview-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.brand-preview {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 9px;
  min-width: 190px;
  padding: 8px 10px;
  border: 1px solid #d7e2ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-light);
}
.brand-preview-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border: 1px solid rgba(47,125,246,.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #60b2ff, #2f7df6 58%, #1e5fd1);
}
.brand-preview-mark:not(.has-logo)::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 3px solid rgba(255,255,255,.92);
  border-radius: 4px;
  box-shadow: 7px 7px 0 -3px rgba(255,255,255,.74);
}
.brand-preview-mark.has-logo {
  border-color: #d6e2ef;
  background: #fff;
}
.brand-preview-mark .brand-logo {
  width: 100%;
  height: 100%;
}
.brand-preview-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.brand-preview-copy strong {
  max-width: 180px;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-settings-grid {
  display: grid;
  grid-template-columns: minmax(220px, .75fr) minmax(0, 1.25fr);
  gap: 14px;
  min-width: 0;
}
.logo-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 8px;
}
.logo-control-row > input {
  min-width: 0;
}
.file-picker {
  cursor: pointer;
}
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.visually-hidden:focus + .field-note {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .brand-settings-head {
    align-items: stretch;
    flex-direction: column;
  }
  .brand-preview {
    min-width: 0;
  }
  .brand-settings-grid {
    grid-template-columns: 1fr;
  }
  .logo-control-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .logo-control-row button {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* Account and settlement details remain readable in wide tables. */
.student-card-balances {
  display: grid;
  min-width: 260px;
  gap: 6px;
}
.student-card-balances > div {
  display: grid;
  gap: 2px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.student-card-balances > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.student-card-balances span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.settlement-rate-input {
  width: 92px;
  min-width: 72px;
}

/* Brand, range controls, and compact mobile navigation */
.topbar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}
.topbar h1::before,
.login-card::before {
  display: none;
}
.brand-copy {
  min-width: 0;
}
.topbar-brand .subline {
  padding-left: 0;
}
.brand-copy h1 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-mark,
.login-brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border: 1px solid rgba(47,125,246,.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #60b2ff, #2f7df6 58%, #1e5fd1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.52), 0 10px 22px rgba(47,125,246,.2);
}
.login-brand-mark {
  width: 42px;
  height: 42px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}
.brand-mark:not(.has-logo)::before,
.login-brand-mark:not(.has-logo)::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 3px solid rgba(255,255,255,.92);
  border-radius: 4px;
  box-shadow: 7px 7px 0 -3px rgba(255,255,255,.74);
}
.brand-mark.has-logo,
.login-brand-mark.has-logo {
  border-color: #d6e2ef;
  background: #fff;
  box-shadow: 0 8px 18px rgba(31,56,88,.12);
}
.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.period-filter {
  display: grid;
  grid-template-columns: 112px 138px 138px;
  align-items: end;
  gap: 8px;
}
.period-filter .field {
  width: auto;
  min-width: 0;
}
.period-filter .field span {
  white-space: nowrap;
}
.logo-setting-field {
  align-content: start;
}
.logo-setting-field input[type="file"] {
  padding: 5px 7px;
  font-size: 12px;
}
.logo-setting-field .field-note {
  min-height: 32px;
  font-size: 12px;
}
.logo-setting-field .ghost {
  justify-self: start;
}
.nav-item[data-view="fees"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5Zm2 0v14h12V5H6Zm2 3h8v2H8V8Zm0 4h5v2H8v-2Zm0 4h3v2H8v-2Z'/%3E%3C/svg%3E"); }

@media (max-width: 900px) {
  .topbar {
    padding: 12px;
    gap: 10px;
  }
  .topbar-brand {
    width: 100%;
  }
  .topbar h1 {
    font-size: 18px;
  }
  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    align-items: stretch;
  }
  .top-actions > * {
    width: 100%;
    min-width: 0;
    flex: none;
  }
  .period-filter {
    grid-column: 1 / -1;
    grid-template-columns: minmax(100px, .72fr) repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .period-filter .field input,
  .period-filter .field select {
    min-width: 0;
  }
  .top-actions .ghost,
  .top-actions a.ghost {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
    padding-left: 8px;
  }
  .brand-copy h1 {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  .content {
    min-width: 0;
    padding: 10px;
  }
  .panel-head,
  .form-grid,
  .filter-row,
  .lesson-filter-grid {
    min-width: 0;
  }
  .panel-head h2,
  .head-note {
    max-width: 100%;
  }
  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }
  .nav-item {
    min-width: 94px;
    padding-right: 10px;
    padding-left: 10px;
    gap: 7px;
    font-size: 13px;
  }
  .nav-item::before {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }
  .logo-setting-field .ghost {
    width: auto;
  }
}

/* fnOS-inspired management-console polish */
:root {
  --bg: #f4f7fb;
  --surface: #fff;
  --surface-strong: #f9fbff;
  --soft: #f1f5fb;
  --line: #dfe7f2;
  --line-strong: #c7d2e2;
  --text: #172033;
  --muted: #66758d;
  --accent: #2f7df6;
  --accent-dark: #1e5fd1;
  --accent-soft: #eaf2ff;
  --green: var(--accent);
  --green-dark: var(--accent-dark);
  --amber: #b56a08;
  --red: #d33f49;
  --red-soft: #fff0f2;
  --yellow-soft: #fff7df;
  --shadow: 0 14px 36px rgba(31, 56, 88, .08);
  --shadow-light: 0 2px 10px rgba(31, 56, 88, .06);
}

html { min-height: 100%; }
body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,.72), rgba(244,247,251,.88)),
    linear-gradient(90deg, rgba(47,125,246,.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(47,125,246,.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 28px 28px, 28px 28px, auto;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(47,125,246,.35);
  outline-offset: 2px;
}

.login-shell {
  background:
    linear-gradient(135deg, rgba(47,125,246,.08), transparent 38%),
    linear-gradient(180deg, #f8fbff, #eef4fb 58%, #f7f9fc);
}
.login-card {
  position: relative;
  gap: 16px;
  padding: 28px;
  border-color: rgba(201,213,229,.85);
  border-radius: 8px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 22px 64px rgba(45, 75, 118, .16);
  backdrop-filter: blur(16px);
}
.login-card::before {
  content: "";
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #52a4ff, #2f7df6),
    var(--accent);
  box-shadow: 0 10px 24px rgba(47,125,246,.32);
}
.login-card h1 {
  margin-top: 2px;
  font-size: 24px;
}

.app-shell {
  min-height: 100vh;
}
.topbar {
  min-height: 66px;
  padding: 10px 18px 10px 20px;
  border-bottom: 1px solid rgba(203,215,230,.84);
  background: rgba(255,255,255,.86);
  box-shadow: 0 1px 0 rgba(255,255,255,.9), 0 10px 32px rgba(42, 67, 100, .08);
  backdrop-filter: blur(18px);
}
.topbar h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  letter-spacing: 0;
}
.topbar h1::before {
  content: "";
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.42), transparent 45%),
    linear-gradient(135deg, #60b2ff, #2f7df6 58%, #1e5fd1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.52), 0 10px 22px rgba(47,125,246,.24);
}
.subline {
  margin-top: 4px;
  padding-left: 42px;
  color: var(--muted);
}
.top-actions {
  align-items: center;
  gap: 8px;
}
.layout {
  grid-template-columns: 214px minmax(0,1fr);
  min-height: calc(100vh - 66px);
}
.side-nav {
  top: 66px;
  gap: 5px;
  height: calc(100vh - 66px);
  padding: 14px 12px;
  border-right: 1px solid rgba(205,216,230,.84);
  background: rgba(240,245,251,.9);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.85);
  backdrop-filter: blur(14px);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #526174;
  font-size: 14px;
  font-weight: 800;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.nav-item::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-color: currentColor;
  opacity: .88;
  -webkit-mask: var(--nav-icon) center / contain no-repeat;
  mask: var(--nav-icon) center / contain no-repeat;
}
.nav-item[data-view="dashboard"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h7v7H4zM13 4h7v7h-7zM4 13h7v7H4zM13 13h7v7h-7z'/%3E%3C/svg%3E"); }
.nav-item[data-view="schedule"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 2h2v3h6V2h2v3h3a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h3V2Zm13 8H4v10h16V10ZM6 12h5v4H6v-4Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="lessons"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm0 2v12h12V6H6Zm2 3h8v2H8V9Zm0 4h8v2H8v-2Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="renewals"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 2a9 9 0 1 0 8.94 10H19a7 7 0 1 1-2.05-4.95L14 10h8V2l-2.82 2.82A8.96 8.96 0 0 0 12 2Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="renewal-details"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M21 18v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v1h-9a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h9Zm-9-2h10V8H12v8Zm4-2.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="fees"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7.41 13.41 6 12l-4 4 4 4 1.41-1.41L5.83 17H20v-2H5.83l1.58-1.59Zm9.18-2.82L18.17 9H4V7h14.17l-1.58-1.59L18 4l4 4-4 4-1.41-1.41Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="cards"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6Zm2 0v12h12V6H6Zm1 3h10v2H7V9Zm0 4h6v2H7v-2Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="accounting"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm1 2v14h12V5H6Zm2 3h8v2H8V8Zm0 4h3v2H8v-2Zm5 0h3v2h-3v-2Zm-5 4h3v2H8v-2Zm5 0h3v2h-3v-2Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="settlements"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 5h16v14H4V5Zm2 2v10h12V7H6Zm2 2h5v2H8V9Zm0 4h8v2H8v-2Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="students"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4Zm0 2c-4.42 0-8 2.24-8 5v1h16v-1c0-2.76-3.58-5-8-5Zm6.5-6.5h1v-2h-1v-1h-2v1h-1v2h1v1h2v-1Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="reports"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M5 3h14a2 2 0 0 1 2 2v14H3V5a2 2 0 0 1 2-2Zm1 4v10h12V7H6Zm2 7h2V9H8v5Zm4 0h2V6h-2v8Zm4 0h2v-4h-2v4Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="call-tasks"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6.62 10.79a15.05 15.05 0 0 0 6.59 6.59l2.2-2.2a1 1 0 0 1 1.02-.24 11.36 11.36 0 0 0 3.57.57 1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1 11.36 11.36 0 0 0 .57 3.57 1 1 0 0 1-.25 1.02l-2.2 2.2Z'/%3E%3C/svg%3E"); }
.nav-item[data-view="settings"] { --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19.14 12.94a7.43 7.43 0 0 0 .05-.94 7.43 7.43 0 0 0-.05-.94l2.03-1.58a.5.5 0 0 0 .12-.64l-1.92-3.32a.5.5 0 0 0-.6-.22l-2.39.96a7.08 7.08 0 0 0-1.63-.94l-.36-2.54a.5.5 0 0 0-.5-.42H9.1a.5.5 0 0 0-.5.42l-.36 2.54c-.58.23-1.12.54-1.63.94l-2.39-.96a.5.5 0 0 0-.6.22L1.7 8.84a.5.5 0 0 0 .12.64l2.03 1.58c-.03.31-.05.62-.05.94s.02.63.05.94L1.82 14.52a.5.5 0 0 0-.12.64l1.92 3.32a.5.5 0 0 0 .6.22l2.39-.96c.51.4 1.05.71 1.63.94l.36 2.54a.5.5 0 0 0 .5.42h3.78a.5.5 0 0 0 .5-.42l.36-2.54c.58-.23 1.12-.54 1.63-.94l2.39.96a.5.5 0 0 0 .6-.22l1.92-3.32a.5.5 0 0 0-.12-.64l-2.03-1.58ZM11 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6Z'/%3E%3C/svg%3E"); }
.nav-item:hover {
  background: rgba(255,255,255,.72);
  color: var(--text);
  box-shadow: var(--shadow-light);
}
.nav-item.active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 10px 22px rgba(47,125,246,.14), inset 3px 0 0 var(--accent);
}
.content {
  max-width: none;
  padding: 18px 20px 24px;
}

.metric-grid {
  gap: 14px;
}
.metric,
.panel {
  border: 1px solid rgba(203,215,230,.86);
  border-radius: 8px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
}
.metric {
  position: relative;
  min-height: 96px;
  overflow: hidden;
  padding: 16px 18px;
}
.metric::after {
  content: "";
  position: absolute;
  right: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(47,125,246,.18), rgba(47,125,246,.04));
}
.metric span {
  position: relative;
  color: #65748a;
  font-size: 12px;
  letter-spacing: .02em;
}
.metric strong {
  position: relative;
  margin-top: 12px;
  color: #102033;
  font-size: 30px;
  font-weight: 850;
}
.panel {
  overflow: hidden;
}
.panel-head {
  min-height: 54px;
  padding: 14px 16px;
  border-bottom-color: rgba(222,231,242,.92);
  background: linear-gradient(180deg, #fff, #f8fbff);
}
.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #172033;
  font-size: 16px;
  font-weight: 850;
}
.panel-head h2::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 4px;
  background: var(--accent);
}
.head-note {
  color: #728197;
  font-size: 12px;
}
.work-grid {
  gap: 14px;
}

.field {
  gap: 6px;
}
.field span {
  color: #6a778c;
  font-size: 12px;
  font-weight: 800;
}
.field input,
.field select,
.field textarea {
  min-height: 38px;
  padding: 8px 10px;
  border-color: #cfd9e8;
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: inset 0 1px 2px rgba(27, 48, 78, .035);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #aebdd0;
  background: #fff;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,125,246,.12), inset 0 1px 2px rgba(27,48,78,.025);
}
.field input[readonly] {
  background: #f3f7fc;
  color: #738197;
}
.multi-select-control {
  position: relative;
  display: grid;
  gap: 7px;
  min-width: 0;
}
.multi-select-control::after {
  position: absolute;
  top: 14px;
  right: 13px;
  width: 7px;
  height: 7px;
  border-right: 2px solid #72829a;
  border-bottom: 2px solid #72829a;
  transform: rotate(45deg);
  pointer-events: none;
  content: "";
}
.multi-select-control.open::after {
  top: 17px;
  transform: rotate(225deg);
}
.multi-select-search,
.multi-select-trigger {
  width: 100%;
  padding-right: 32px !important;
}
.multi-select-trigger {
  min-width: 0;
  min-height: 38px;
  overflow: hidden;
  padding: 8px 32px 8px 10px;
  border: 1px solid #cfd9e8;
  border-radius: 8px;
  background: #fbfdff;
  color: var(--text);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.multi-select-trigger:hover,
.multi-select-trigger:focus-visible {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47,125,246,.12);
}
.multi-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.multi-select-control.edit-mode .multi-select-trigger,
.multi-select-control.edit-mode .multi-select-options {
  display: none;
}
.multi-select-control.edit-mode .multi-select-native {
  position: static;
  width: 100%;
  height: auto;
  opacity: 1;
  pointer-events: auto;
}
.multi-select-options {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 40;
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 190px;
  overflow: auto;
  padding: 6px;
  border: 1px solid #cfd9e8;
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: 0 10px 24px rgba(28, 55, 92, .16);
}
.multi-select-control.open .multi-select-options {
  display: grid;
}
.multi-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #d8e2ef;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}
.multi-select-option:hover,
.multi-select-option.selected {
  border-color: #91b9f9;
  background: #f2f7ff;
}
.multi-select-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.multi-select-check {
  flex: 0 0 auto;
  color: var(--accent);
  opacity: 0;
  font-size: 16px;
  line-height: 1;
}
.multi-select-option.selected .multi-select-check {
  opacity: 1;
}
.multi-select-empty {
  grid-column: 1 / -1;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.multi-select-count {
  margin-left: 6px;
  color: var(--accent);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}
.multi-select-count:empty {
  display: none;
}
.schedule-board-section {
  padding: 12px 0 0;
}
.schedule-board-section + .schedule-board-section {
  margin-top: 14px;
  border-top: 1px solid #dfe7f2;
}
.schedule-board-section-title {
  margin: 0 14px 9px;
  color: var(--text);
  font-size: 15px;
}
.field-note,
.time-slot-summary,
.update-panel {
  border-color: #d8e2ef;
  background: #f7faff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
.form-grid,
.filter-row,
.lesson-filter-grid,
.inline-form {
  background: rgba(255,255,255,.82);
}

.primary,
.ghost,
.small-action {
  min-height: 36px;
  border-radius: 8px;
  font-weight: 850;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.primary {
  background: linear-gradient(180deg, #428dff, #2f7df6);
  color: #fff;
  box-shadow: 0 10px 20px rgba(47,125,246,.18), inset 0 1px 0 rgba(255,255,255,.32);
}
.primary:hover {
  background: linear-gradient(180deg, #347ff2, #1f66de);
  box-shadow: 0 12px 26px rgba(47,125,246,.22), inset 0 1px 0 rgba(255,255,255,.28);
}
.ghost {
  border-color: #cfd9e8;
  background: rgba(255,255,255,.86);
  color: #263449;
  box-shadow: 0 1px 2px rgba(28, 48, 76, .035);
}
.ghost:hover {
  border-color: #aebdd0;
  background: #f8fbff;
  color: var(--accent-dark);
  box-shadow: var(--shadow-light);
}
.balance-alert-button.has-alert {
  border-color: #e8ba55;
  background: #fff8e7;
  color: #8d5609;
}
.review-alert-button {
  gap: 8px;
}
.review-alert-button .review-alert-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: #c4cfdd;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
}
.review-alert-button strong {
  min-width: 24px;
  height: 22px;
  margin-left: 0;
  padding: 0 7px;
  border-radius: 999px;
  background: #edf2f8;
  color: #526174;
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}
.review-alert-button.has-alert {
  border-color: #ef9c9c;
  background: #fff2f2;
  color: var(--red);
  box-shadow: 0 0 0 3px rgba(179,59,59,.08), 0 10px 20px rgba(179,59,59,.08);
}
.review-alert-button.has-alert .review-alert-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(179,59,59,.14);
}
.review-alert-button.has-alert strong {
  background: var(--red);
  color: #fff;
}
.small-action {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.small-action:hover {
  background: #dcebff;
}
.small-action.danger {
  background: var(--red-soft);
  color: var(--red);
}

.table-wrap {
  background: #fff;
}
.table-wrap.tall {
  max-height: calc(100vh - 190px);
}
table {
  border-collapse: separate;
  border-spacing: 0;
}
th,
td {
  height: 40px;
  padding: 8px 11px;
  border-bottom-color: #edf2f8;
}
th {
  background: #f8fbff;
  color: #69788e;
  font-size: 12px;
  letter-spacing: .01em;
}
tbody tr {
  transition: background .12s ease;
}
tbody tr:hover {
  background: #f5f9ff;
}
.badge {
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.62);
}
.badge.approved {
  background: #e9f8ee;
  color: #187347;
}
.badge.pending {
  background: #fff5da;
  color: #a25e08;
}
.badge.rejected {
  background: var(--red-soft);
  color: var(--red);
}

.schedule-metrics {
  padding: 14px 14px 0;
}
.schedule-filter-grid {
  background: #fbfdff;
}
.schedule-table-wrap {
  border-top: 1px solid #edf2f8;
  background: #f6f9fe;
}
.schedule-board-table {
  border-spacing: 6px;
  border-collapse: separate;
  background: #f6f9fe;
}
.schedule-board-table thead th,
.schedule-board-table thead th:first-child,
.schedule-time-head {
  position: static;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-light);
}
.schedule-board-table .schedule-weekday-head,
.schedule-board-table .schedule-weekday-cell {
  width: 106px;
  min-width: 106px;
  text-align: center;
}
.schedule-board-table .schedule-weekday-head {
  position: static;
  color: var(--text);
  font-weight: 850;
}
.schedule-weekday-cell {
  position: static;
  vertical-align: middle;
  background: #fff;
  box-shadow: var(--shadow-light);
}
.schedule-weekday-cell span,
.schedule-weekday-cell strong {
  display: block;
}
.schedule-weekday-cell span {
  color: var(--text);
  font-size: 14px;
}
.schedule-weekday-cell strong {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.schedule-day-card-row td {
  height: 62px;
  padding: 6px 9px;
  vertical-align: middle;
  border-color: #dce8f6;
  background: #f8fbff;
}
.schedule-card-lane {
  min-height: 50px;
}
.schedule-card-lane-label {
  display: inline-flex;
  min-width: 68px;
  min-height: 23px;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  padding: 0 8px;
  border: 1px solid #b9d5f8;
  border-radius: 6px;
  background: #eaf3ff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
  vertical-align: middle;
}
.schedule-card-lane-content {
  display: inline-flex;
  max-width: calc(100% - 86px);
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  vertical-align: middle;
}
.schedule-card-lane-content .schedule-card {
  width: auto;
  min-width: 150px;
  max-width: 260px;
}
.schedule-card.card-schedule {
  border-left-color: #1c9a72;
  background: linear-gradient(180deg, #fff, #f0fbf6);
}
.schedule-empty-card-lane {
  color: #8a9ab0;
  font-size: 12px;
}
.schedule-board-table td {
  height: 108px;
  padding: 6px;
  border: 1px solid #e3ebf5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(28,48,76,.025);
}
.schedule-board-table .schedule-day-card-row td {
  height: 62px;
  padding: 6px 9px;
  vertical-align: middle;
  border-color: #dce8f6;
  background: #f8fbff;
}
.schedule-cell {
  height: 94px;
  gap: 4px;
}
.schedule-card {
  min-height: 24px;
  padding: 4px 6px;
  border-color: #d4e2f3;
  border-left-color: var(--accent);
  border-radius: 7px;
  background: linear-gradient(180deg, #fff, #f8fbff);
  box-shadow: 0 2px 7px rgba(31, 56, 88, .055);
}
.schedule-card:hover,
.schedule-card:focus {
  border-color: #91b9f9;
  box-shadow: 0 0 0 2px rgba(47,125,246,.1), 0 6px 14px rgba(31,56,88,.08);
}
.schedule-card-main {
  color: #243147;
  font-size: 12px;
}
.schedule-more {
  border-color: #b8cae0;
  background: #f2f7ff;
  color: var(--accent-dark);
}
.schedule-empty-cell {
  border-color: #dfe7f2;
  background: #f9fbff;
}
.schedule-board-table td.schedule-today-col {
  border-color: #d5e4fb;
  background: #f4f8ff;
}
.schedule-board-table .schedule-day-card-row td.schedule-today-col {
  border-color: #cfe0fa;
  background: #eef5ff;
}
.schedule-board-table thead th.schedule-slot-current {
  background: var(--accent);
  color: #fff;
}
.schedule-board-table thead th.schedule-slot-upcoming {
  background: #ff9f0a;
  color: #fff;
}
.schedule-board-table td.schedule-slot-current {
  border-color: #bcd5fb;
  background: #e8f1ff;
  box-shadow: inset 0 3px 0 var(--accent);
}
.schedule-board-table td.schedule-slot-upcoming {
  border-color: #ffd9a8;
  background: #fff7e8;
  box-shadow: inset 0 3px 0 #ff9f0a;
}
.schedule-weekday-cell.schedule-today-cell {
  background: #e8f1ff;
}
.schedule-weekday-cell.schedule-today-cell strong {
  color: var(--accent-dark);
}
.schedule-today-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .schedule-board-table {
    min-width: 1040px;
  }
  .schedule-board-table .schedule-weekday-head,
  .schedule-board-table .schedule-weekday-cell {
    width: 82px;
    min-width: 82px;
  }
  .schedule-card-lane-content .schedule-card {
    min-width: 132px;
    max-width: 220px;
  }
}

.settings-tabs {
  border-color: #dfe7f2;
  background: rgba(255,255,255,.86);
  box-shadow: var(--shadow-light);
}
.settings-tab {
  border-right-color: #e8eef6;
  color: #607086;
}
.settings-tab:hover {
  background: #f5f9ff;
}
.settings-tab.active {
  background: #fff;
  color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.time-slot-chip,
.weekday-choice-group label {
  border-color: #d7e2ef;
  background: #fff;
  box-shadow: var(--shadow-light);
}
.weekday-choice-group input {
  accent-color: var(--accent);
}
.toast {
  background: #152033;
  box-shadow: 0 18px 50px rgba(21,32,51,.22);
}
.account-dialog {
  border-color: #d3dfed;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(31, 56, 88, .28);
}
.account-dialog::backdrop {
  background: rgba(27, 42, 64, .38);
  backdrop-filter: blur(2px);
}

@media (max-width: 1280px) {
  .layout { grid-template-columns: 196px minmax(0,1fr); }
}
@media (max-width: 900px) {
  .topbar {
    position: static;
    min-height: auto;
    align-items: stretch;
    flex-direction: column;
  }
  .subline { padding-left: 0; }
  .layout { grid-template-columns: 1fr; }
  .side-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    height: auto;
    padding: 9px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav-item {
    flex: 0 0 auto;
    min-height: 38px;
    text-align: center;
  }
  .nav-item.active { box-shadow: inset 0 -3px 0 var(--accent), var(--shadow-light); }
  .content { padding: 12px; }
  .metric-grid,
  .work-grid,
  .form-grid,
  .filter-row,
  .balance-filter-row,
  .lesson-filter-grid,
  .schedule-admin-panel .form-grid {
    grid-template-columns: 1fr;
  }
  .field.wide,
  .system-form .field.wide,
  .lesson-filter-keyword {
    grid-column: span 1;
  }
  .schedule-table-wrap { max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px); overflow: auto; -webkit-overflow-scrolling: touch; }
}

/* Keep the brand section spacing after the shared field rules. */
.brand-settings-panel {
  gap: 14px;
}

/* Keep the global period controls stable when month/range fields switch. */
.topbar {
  align-items: flex-start;
}
.topbar-brand {
  flex: 1 1 240px;
}
.top-actions {
  flex: 0 1 auto;
  min-width: 0;
  align-items: flex-end;
}
.period-filter {
  flex: 0 1 400px;
  width: min(400px, 100%);
  grid-template-columns: 104px minmax(108px, 1fr);
}
.period-filter.range {
  grid-template-columns: 104px repeat(2, minmax(108px, 1fr));
}
.period-filter .field input,
.period-filter .field select {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 1180px) and (min-width: 901px) {
  .topbar {
    flex-wrap: wrap;
  }
  .topbar-brand {
    flex-basis: 280px;
  }
  .top-actions {
    flex: 1 1 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
  }
  .topbar-brand {
    flex: 0 0 auto;
    width: 100%;
  }
  .top-actions {
    flex: none;
    align-items: stretch;
  }
  .period-filter,
  .period-filter.range,
  .period-filter:not(.range) {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .period-filter .field {
    width: 100%;
  }
}

/* Final layout overrides for full-page balance and schedule views. */
.topbar { position: static; }
.side-nav { top: 0; height: 100vh; }
#studentsView .work-grid { grid-template-columns: minmax(0, 1fr); }
.schedule-board-table { width: 100%; min-width: 0; }
.schedule-cell { height: auto; min-height: 94px; overflow: visible; }

@media (max-width: 900px) {
  .side-nav { height: auto; }
  .schedule-table-wrap { max-height: calc(100vh - 210px); max-height: calc(100dvh - 210px); overflow: auto; -webkit-overflow-scrolling: touch; }
  .schedule-board-table { min-width: 980px; }
}

/* ============================================================
   Apple Mac-inspired light refresh (1.0.24)
   色板 / 字体 / 圆角 / 阴影 / 毛玻璃 / 核心组件轻度焕新
   ============================================================ */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-strong: #f5f5f7;
  --soft: #efeff1;
  --line: #d9d9de;
  --line-strong: #b8b8c0;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --accent-dark: #005bb8;
  --accent-soft: #e8f1fd;
  --green: #0071e3;
  --green-dark: #005bb8;
  --amber: #a85f00;
  --red: #d70015;
  --red-soft: #fdecee;
  --yellow-soft: #fef3df;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .06);
  --shadow-light: 0 1px 2px rgba(0, 0, 0, .05), 0 1px 6px rgba(0, 0, 0, .04);
  --radius-card: 14px;
  --radius-control: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(0, 113, 227, .28);
  outline-offset: 2px;
}

/* 登录页：干净浅灰底 + 白色浮卡 */
.login-shell {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0, 113, 227, .07), transparent 60%),
    linear-gradient(180deg, #fbfbfd, #f0f0f2);
}
.login-card {
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .05), 0 24px 70px rgba(0, 0, 0, .12);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.login-card::before {
  border-radius: 10px;
  background: linear-gradient(135deg, #2997ff, #0071e3);
  box-shadow: 0 8px 20px rgba(0, 113, 227, .28);
}
.login-card h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* 顶栏与侧栏：浅色毛玻璃 */
.topbar {
  border-bottom: 1px solid rgba(0, 0, 0, .07);
  background: rgba(255, 255, 255, .72);
  box-shadow: none;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.topbar h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}
.topbar h1::before {
  border-radius: 9px;
  background: linear-gradient(135deg, #2997ff, #0071e3);
  box-shadow: 0 4px 12px rgba(0, 113, 227, .25);
}
.side-nav {
  border-right: 1px solid rgba(0, 0, 0, .07);
  background: rgba(245, 245, 247, .78);
  box-shadow: none;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

/* 侧栏导航：macOS 式克制选中态 */
.nav-item {
  border-radius: 9px;
  color: var(--text);
  font-weight: 600;
}
.nav-item::before { opacity: .72; }
.nav-item:hover {
  background: rgba(0, 0, 0, .05);
  color: var(--text);
  box-shadow: none;
}
.nav-item.active {
  background: rgba(0, 0, 0, .07);
  color: var(--text);
  box-shadow: none;
}
.nav-item.active::before { opacity: .95; }

/* 卡片与面板：大圆角、细边、柔阴影 */
.metric,
.panel {
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow);
}
.metric::after {
  background: linear-gradient(180deg, rgba(0, 113, 227, .22), rgba(0, 113, 227, .04));
}
.metric span { color: var(--muted); font-weight: 500; }
.metric strong {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.panel-head {
  border-bottom: 1px solid rgba(0, 0, 0, .06);
  background: #fff;
}
.panel-head h2 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.head-note { color: var(--muted); }
.field span { color: var(--muted); font-weight: 600; }

/* 输入控件 */
.field input,
.field select,
.field textarea,
.multi-select-trigger {
  border: 1px solid #d2d2d7;
  border-radius: var(--radius-control);
  background: #fff;
  box-shadow: none;
}
.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #b8b8bf;
  background: #fff;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.multi-select-trigger:focus,
.multi-select-trigger:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, .15);
}
.field input[readonly] { background: #f5f5f7; color: var(--muted); }

/* 按钮：Apple 蓝实色 + 浅灰次级 */
.primary,
.ghost,
.small-action {
  border-radius: var(--radius-control);
  font-weight: 600;
}
.primary {
  background: var(--accent);
  box-shadow: none;
}
.primary:hover { background: #0077ed; box-shadow: 0 2px 8px rgba(0, 113, 227, .25); }
.primary:active { background: var(--accent-dark); }
.ghost {
  border: 1px solid #d2d2d7;
  background: #fff;
  color: var(--text);
  box-shadow: none;
}
.ghost:hover {
  border-color: #b8b8bf;
  background: #f5f5f7;
  color: var(--text);
  box-shadow: none;
}
.small-action { background: var(--accent-soft); color: var(--accent); }
.small-action:hover { background: #d8e9fc; }
.small-action.danger { background: var(--red-soft); color: var(--red); }

/* 表格 */
th {
  background: #fafafc;
  color: var(--muted);
  font-weight: 600;
}
th, td { border-bottom-color: #eeeef0; }
tbody tr:hover { background: #f7f9fc; }

/* 弹窗与提示 */
.account-dialog {
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08), 0 24px 80px rgba(0, 0, 0, .22);
}
.account-dialog::backdrop {
  background: rgba(0, 0, 0, .28);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.toast {
  border-radius: 12px;
  background: rgba(29, 29, 31, .92);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}

/* 细滚动条 */
.schedule-table-wrap::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar { width: 9px; height: 9px; }
.schedule-table-wrap::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(0, 0, 0, .22);
  background-clip: padding-box;
}
.schedule-table-wrap::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, .34); background-clip: padding-box; }
.schedule-table-wrap::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track { background: transparent; }

/* ====================================================================
   响应式表格行转卡片（窄屏 / 手机端）
   适用：所有 .table-wrap 内的标准表格（已通过 JS 给 td 加 data-label）
   排除：schedule-board-table、schedule-slot-table（结构特殊，单独处理）
   ==================================================================== */
@media (max-width: 700px) {
  .table-wrap > table,
  .table-wrap.compact-table > table {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .table-wrap > thead,
  .table-wrap > table > thead {
    display: none;
  }
  .table-wrap > table > tbody,
  .table-wrap.compact-table > table > tbody {
    display: block;
  }
  .table-wrap tr {
    display: block;
    margin: 0 0 12px;
    padding: 4px 12px 8px;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
  }
  .table-wrap td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 9px 2px;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
    text-align: right;
    font-size: 14px;
    white-space: normal;
  }
  .table-wrap tr > td:last-child {
    border-bottom: 0;
  }
  .table-wrap td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    text-align: left;
  }
  .table-wrap td > * {
    flex: 1 1 auto;
    justify-content: flex-end;
    text-align: right;
  }
  .table-wrap .actions-col,
  .table-wrap .row-actions {
    width: auto;
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .table-wrap .row-actions {
    gap: 6px;
  }
  /* 空行（colspan 占位）不卡片化，保持单行居中显示 */
  .table-wrap td.empty,
  .table-wrap tr > td[colspan] {
    display: block;
    width: 100%;
    padding: 14px 8px;
    text-align: center;
    color: var(--muted);
    border-bottom: 0;
  }
  .table-wrap td.empty::before,
  .table-wrap tr > td[colspan]::before {
    display: none;
  }
  /* 紧凑设置表（科目/课程类型/卡类/老师等）也卡片化，但保持更紧凑 */
  .table-wrap.compact-table tr {
    margin-bottom: 8px;
    padding: 4px 10px 6px;
  }
  .table-wrap.compact-table td {
    padding: 6px 2px;
  }
  /* 结算操作栏窄屏按钮全宽，方便点击 */
  .settlement-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .settlement-actions > button {
    width: 100%;
  }
}

/* 窄屏强制约束原生 date/month 输入框宽度，防止固有最小宽度导致页面横向溢出 */
@media (max-width: 900px) {
  .period-filter .field input[type="date"],
  .period-filter .field input[type="month"],
  .field input[type="date"],
  .field input[type="month"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
  }
}

/* ====================================================================
   排课大屏手机端：今日课程列表卡片视图
   - 窄屏隐藏整周网格，渲染 .schedule-mobile-list 由 JS 填充
   - 桌面端 .schedule-mobile-list 隐藏
   ==================================================================== */
.schedule-mobile-list { display: none; }
.schedule-mobile-list-empty {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}
.schedule-mobile-day {
  margin-bottom: 14px;
  border: 1px solid rgba(0, 0, 0, .07);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}
.schedule-mobile-day.is-today {
  border-color: rgba(0, 113, 227, .35);
  box-shadow: 0 4px 14px rgba(0, 113, 227, .12);
}
.schedule-mobile-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  background: rgba(0, 0, 0, .03);
  border-bottom: 1px solid rgba(0, 0, 0, .05);
  font-weight: 700;
  font-size: 14px;
}
.schedule-mobile-day.is-today .schedule-mobile-day-head {
  background: rgba(0, 113, 227, .08);
  color: var(--accent-dark, #1e5fd1);
}
.schedule-mobile-day-tag {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #0071e3;
  padding: 2px 8px;
  border-radius: 999px;
}
.schedule-mobile-cards {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}
.schedule-mobile-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  line-height: 1.5;
}
.schedule-mobile-card.is-current {
  border-color: rgba(0, 113, 227, .4);
  background: rgba(0, 113, 227, .04);
}
.schedule-mobile-card.is-upcoming {
  border-color: rgba(255, 138, 0, .45);
  background: rgba(255, 138, 0, .05);
}
.schedule-mobile-card-slot {
  grid-column: 1 / -1;
  font-weight: 700;
  color: var(--accent-dark, #1e5fd1);
  font-size: 12px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, .05);
  margin-bottom: 4px;
}
.schedule-mobile-card-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
}
.schedule-mobile-card-value {
  color: var(--text);
  font-weight: 500;
  text-align: right;
}
.schedule-mobile-card-value.full {
  grid-column: 1 / -1;
  text-align: left;
}
.schedule-mobile-card-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 4px;
}
.schedule-mobile-empty-slot {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.schedule-mobile-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.schedule-mobile-toolbar-info {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 900px) {
  /* 手机端：隐藏整周网格，显示今日列表 */
  .schedule-table-wrap { display: none; }
  .schedule-mobile-list { display: block; }
}

/* ============================================================
   自动锁定层（长时间无操作）
   ============================================================ */
.lock-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(245, 245, 247, .66);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
}
.lock-layer.hidden { display: none !important; }
.lock-card {
  display: grid;
  gap: 16px;
  width: min(390px, 100%);
  padding: 28px;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .05), 0 24px 70px rgba(0, 0, 0, .14);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.lock-head {
  display: grid;
  justify-items: start;
  gap: 6px;
}
.lock-shield {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background:
    linear-gradient(135deg, #2997ff, #0071e3);
  box-shadow: 0 8px 20px rgba(0, 113, 227, .28);
}
.lock-shield::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  margin: 14px;
  border: 3px solid rgba(255, 255, 255, .95);
  border-radius: 50%;
  border-bottom-color: transparent;
  border-top-color: transparent;
  position: absolute;
  transform: none;
}
.lock-shield {
  position: relative;
}
.lock-shield::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 11px;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 0 0 2px rgba(0, 113, 227, .25);
}
.lock-card h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.lock-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.lock-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.lock-actions .primary,
.lock-actions .ghost {
  min-width: 96px;
}

/* ============================================================
   星空背景（登录页 / 锁定页）
   - 深空底色 + 远景静态散星 + 银河带缓慢漂移（带内密集星 + 紫蓝带光 + 暗尘埃带）
   ============================================================ */
.login-shell,
.lock-layer {
  overflow: hidden;
  background:
    /* 远处弥散星云 */
    radial-gradient(ellipse 900px 460px at 22% 28%, rgba(96, 130, 200, .16), transparent 60%),
    radial-gradient(ellipse 760px 400px at 78% 72%, rgba(140, 100, 200, .14), transparent 60%),
    /* 远景静态散星（不参与漂移，作为"近景"固定星） */
    radial-gradient(1.1px 1.1px at 7% 14%, rgba(255,255,255,.72), transparent 100%),
    radial-gradient(1.0px 1.0px at 22% 78%, rgba(255,255,255,.68), transparent 100%),
    radial-gradient(1.2px 1.2px at 38% 22%, rgba(255,255,255,.74), transparent 100%),
    radial-gradient(1.0px 1.0px at 51% 64%, rgba(255,255,255,.7), transparent 100%),
    radial-gradient(1.1px 1.1px at 67% 18%, rgba(255,255,255,.72), transparent 100%),
    radial-gradient(1.0px 1.0px at 81% 88%, rgba(255,255,255,.7), transparent 100%),
    radial-gradient(1.2px 1.2px at 92% 36%, rgba(255,255,255,.74), transparent 100%),
    radial-gradient(1.0px 1.0px at 14% 50%, rgba(255,255,255,.7), transparent 100%),
    radial-gradient(1.1px 1.1px at 33% 92%, rgba(255,255,255,.72), transparent 100%),
    radial-gradient(1.0px 1.0px at 56% 8%, rgba(255,255,255,.68), transparent 100%),
    radial-gradient(1.1px 1.1px at 75% 70%, rgba(255,255,255,.72), transparent 100%),
    radial-gradient(1.2px 1.2px at 88% 12%, rgba(255,255,255,.74), transparent 100%),
    radial-gradient(1.0px 1.0px at 5% 86%, rgba(255,255,255,.68), transparent 100%),
    radial-gradient(1.1px 1.1px at 45% 38%, rgba(255,255,255,.7), transparent 100%),
    radial-gradient(1.0px 1.0px at 62% 82%, rgba(255,255,255,.68), transparent 100%),
    radial-gradient(1.2px 1.2px at 95% 60%, rgba(255,255,255,.74), transparent 100%),
    radial-gradient(1.0px 1.0px at 28% 14%, rgba(255,255,255,.68), transparent 100%),
    radial-gradient(1.1px 1.1px at 70% 44%, rgba(255,255,255,.72), transparent 100%),
    /* 深空底色（深蓝紫黑） */
    linear-gradient(180deg, #04061a 0%, #070b28 45%, #0a0e30 70%, #05071e 100%);
  background-attachment: fixed;
}
/* 登录壳随文档流；锁屏层必须保持 fixed 全屏覆盖（勿与上一条合并写 position） */
.login-shell { position: relative; }
.lock-layer { position: fixed; background-attachment: scroll; }
.lock-layer.hidden { background: none; }

/* 螺旋星系背景：屏幕中央缓慢自转的星系盘
   - 旋臂由 SVG 星点组成（app.js 注入），整体仅做 transform: rotate（GPU 合成，不重绘，不卡顿）
   - 置于登录卡片(z-index:6)之下作为背景 */
.galaxy-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(110vmin, 1050px);
  height: min(110vmin, 1050px);
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
  animation: galaxySpin 140s linear infinite;
  will-change: transform;
}
@keyframes galaxySpin {
  0%   { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}
.galaxy-bg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.galaxy-bg .arm-glow { filter: blur(7px); }
.galaxy-bg .arm-soft { filter: blur(3px); }
.galaxy-bg .hii { filter: blur(2.2px); mix-blend-mode: screen; }

/* 星系中心 bulge（橙黄椭圆光晕，比 core 更大更柔和） */
.galaxy-bulge {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34%;
  height: 26%;
  margin: -13% 0 0 -17%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%,
    rgba(255,232,180,.55) 0%,
    rgba(255,210,150,.32) 30%,
    rgba(230,170,120,.16) 55%,
    transparent 75%);
  filter: blur(10px);
}

/* 星系辉光盘（中心亮、边缘羽化） */
.galaxy-disc {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(255,244,214,.85) 0%,
    rgba(255,226,170,.42) 7%,
    rgba(190,175,240,.2) 20%,
    rgba(110,135,225,.11) 42%,
    rgba(50,60,140,.05) 62%,
    transparent 74%);
  filter: blur(8px);
}
/* 星系明亮核心 */
.galaxy-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13%;
  height: 13%;
  margin: -6.5% 0 0 -6.5%;
  border-radius: 50%;
  background: radial-gradient(circle,
    #fffdf4 0%,
    rgba(255,240,200,.9) 24%,
    rgba(255,210,150,.3) 50%,
    transparent 72%);
  box-shadow: 0 0 70px 22px rgba(255,228,170,.28);
}

/* 锚定亮星层：极慢呼吸，让画面不至于死板（不参与漂移） */
.login-shell::after,
.lock-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(2.4px 2.4px at 24% 36%, rgba(255,255,255,1), transparent 100%),
    radial-gradient(2.2px 2.2px at 72% 58%, rgba(255,255,255,.98), transparent 100%),
    radial-gradient(2.4px 2.4px at 52% 80%, rgba(255,255,255,1), transparent 100%),
    radial-gradient(2.0px 2.0px at 16% 70%, rgba(255,255,255,.94), transparent 100%),
    radial-gradient(2.2px 2.2px at 88% 22%, rgba(255,255,255,.96), transparent 100%);
  animation: anchorStarBreath 6s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes anchorStarBreath {
  0%, 100% { opacity: .35; }
  50%      { opacity: 1; }
}

/* 尊重用户偏好：减少动态 */
@media (prefers-reduced-motion: reduce) {
  .galaxy-bg,
  .login-shell::after,
  .lock-layer::after { animation: none !important; opacity: .7 !important; }
}

.login-card,
.lock-card {
  position: relative;
  z-index: 6;
}

/* 深空玻璃卡片：半透明深色毛玻璃，让旋转星系透出 */
.login-card,
.lock-card {
  border: 1px solid rgba(168, 188, 255, .22);
  background: rgba(10, 15, 40, .42);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .1);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  color: #eef2ff;
}
.login-card h1,
.lock-card h2 {
  color: #f6f8ff;
}
.login-card .hint,
.lock-card .lock-note {
  color: rgba(214, 224, 255, .72);
}
.login-card .field span,
.lock-card .field span {
  color: rgba(198, 210, 245, .85);
}
.login-card .field input,
.lock-card .field input {
  border-color: rgba(168, 188, 255, .28);
  background: rgba(6, 10, 30, .5);
  color: #f2f5ff;
}
.login-card .field input::placeholder,
.lock-card .field input::placeholder {
  color: rgba(190, 202, 240, .45);
}
.login-card .field input:hover,
.lock-card .field input:hover {
  border-color: rgba(190, 208, 255, .45);
  background: rgba(6, 10, 30, .6);
}
.login-card .field input:focus,
.lock-card .field input:focus {
  border-color: #79a8ff;
  box-shadow: 0 0 0 3px rgba(90, 140, 255, .25);
}
.login-card .primary,
.lock-card .primary {
  background: linear-gradient(135deg, #3f8bff, #2361e8);
  box-shadow: 0 8px 24px rgba(47, 113, 235, .4);
}
.login-card .primary:hover,
.lock-card .primary:hover {
  background: linear-gradient(135deg, #4f97ff, #2a6cf2);
}
.lock-card .ghost {
  border-color: rgba(168, 188, 255, .3);
  background: rgba(255, 255, 255, .06);
  color: #dce4ff;
}
.lock-card .ghost:hover {
  border-color: rgba(190, 208, 255, .5);
  background: rgba(255, 255, 255, .12);
}
/* 浏览器自动填充保持深色玻璃观感 */
.login-card .field input:-webkit-autofill,
.lock-card .field input:-webkit-autofill {
  -webkit-text-fill-color: #f2f5ff;
  -webkit-box-shadow: 0 0 0 1000px rgba(6, 10, 30, .85) inset;
  caret-color: #f2f5ff;
  transition: background-color 999999s ease-in-out 0s;
}

/* ====================================================================
   后台深色模式（html.app-dark，由顶栏"深色/浅色"按钮切换）
   仅覆盖变量与 Apple 主题区块的硬编码浅色；登录页/锁屏保持深空星系
   ==================================================================== */
html.app-dark {
  --bg: #0c1018;
  --surface: #141a26;
  --surface-strong: #1a2130;
  --soft: #1e2635;
  --line: #2a3344;
  --line-strong: #3a465c;
  --text: #e6eaf4;
  --muted: #97a2b8;
  --accent: #3f8bff;
  --accent-dark: #2a6cf2;
  --accent-soft: rgba(63, 139, 255, .16);
  --green: #3f8bff;
  --green-dark: #2a6cf2;
  --amber: #f0b352;
  --red: #ff6b7a;
  --red-soft: rgba(255, 107, 122, .16);
  --yellow-soft: rgba(240, 179, 82, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-light: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
html.app-dark body {
  background: var(--bg);
}
/* 顶栏与侧栏：深色毛玻璃 */
html.app-dark .topbar {
  border-bottom-color: rgba(255, 255, 255, .08);
  background: rgba(16, 21, 33, .82);
}
html.app-dark .side-nav {
  border-right-color: rgba(255, 255, 255, .08);
  background: rgba(18, 23, 36, .85);
}
html.app-dark .nav-item:hover {
  background: rgba(255, 255, 255, .07);
}
html.app-dark .nav-item.active {
  background: rgba(63, 139, 255, .18);
}
/* 卡片与面板 */
html.app-dark .metric,
html.app-dark .panel {
  border-color: rgba(255, 255, 255, .09);
  background: var(--surface);
}
html.app-dark .panel-head {
  border-bottom-color: rgba(255, 255, 255, .08);
  background: transparent;
}
/* 输入控件 */
html.app-dark .field input,
html.app-dark .field select,
html.app-dark .field textarea,
html.app-dark .multi-select-trigger {
  border-color: #3a465c;
  background: #10151f;
  color: var(--text);
}
html.app-dark .field input:hover,
html.app-dark .field select:hover,
html.app-dark .field textarea:hover {
  border-color: #4a5870;
  background: #10151f;
}
html.app-dark .field input[readonly] {
  background: #171d29;
  color: var(--muted);
}
html.app-dark .field input::placeholder {
  color: rgba(151, 162, 184, .55);
}
/* 按钮 */
html.app-dark .ghost {
  border-color: #3a465c;
  background: rgba(255, 255, 255, .05);
  color: var(--text);
}
html.app-dark .ghost:hover {
  border-color: #4a5870;
  background: rgba(255, 255, 255, .1);
  color: var(--text);
}
html.app-dark .small-action:hover { background: rgba(63, 139, 255, .28); }
/* 表格 */
html.app-dark th {
  background: #171d29;
  color: var(--muted);
}
html.app-dark th, html.app-dark td { border-bottom-color: #232b3b; }
html.app-dark tbody tr:hover { background: #171e2c; }
/* 弹窗与滚动条 */
html.app-dark .account-dialog {
  border-color: rgba(255, 255, 255, .12);
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .5), 0 28px 90px rgba(0, 0, 0, .55);
}
html.app-dark .schedule-table-wrap::-webkit-scrollbar-thumb,
html.app-dark .table-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .22);
  background-clip: padding-box;
}
html.app-dark .schedule-table-wrap::-webkit-scrollbar-thumb:hover,
html.app-dark .table-wrap::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .34); background-clip: padding-box; }
/* 窄屏行卡片 */
@media (max-width: 700px) {
  html.app-dark .table-wrap tr {
    border-color: rgba(255, 255, 255, .1);
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  }
  html.app-dark .table-wrap td { border-bottom-color: rgba(255, 255, 255, .06); }
}
/* 补漏：表格容器与表单区白底 */
html.app-dark .table-wrap {
  background: transparent;
}
html.app-dark .form-grid,
html.app-dark .filter-row,
html.app-dark .lesson-filter-grid,
html.app-dark .inline-form {
  background: rgba(255, 255, 255, .04);
}
/* 补漏：课时模式选项 */
html.app-dark .lesson-mode-option {
  border-color: #3a465c;
  background: #10151f;
}
html.app-dark .lesson-mode-option:hover {
  border-color: #4a5870;
  background: #171e2c;
}
/* 补漏：字段提示条 */
html.app-dark .field-note {
  border-color: #3a465c;
  background: #171d29;
  color: var(--muted);
}
html.app-dark .field-note.warning {
  border-color: rgba(240, 179, 82, .5);
  background: rgba(240, 179, 82, .12);
  color: var(--amber);
}
html.app-dark .field-note.positive {
  border-color: rgba(80, 200, 140, .4);
  background: rgba(80, 200, 140, .12);
  color: #6fd5a0;
}
/* 补漏：i 提示按钮 */
html.app-dark .note-tip {
  border-color: #3a465c;
  background: #171d29;
  color: var(--muted);
}
html.app-dark .note-tip:hover,
html.app-dark .note-tip:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
/* 补漏：顶栏提醒按钮 */
html.app-dark .review-alert-button .review-alert-dot {
  background: #4a5870;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
}
html.app-dark .review-alert-button strong {
  background: #232b3b;
  color: var(--muted);
}
html.app-dark .review-alert-button.has-alert {
  border-color: rgba(255, 107, 122, .55);
  background: rgba(255, 107, 122, .14);
}
/* 补漏：余额提醒等 has-alert 数字徽章 */
html.app-dark .balance-alert-button strong {
  background: #232b3b;
  color: var(--muted);
}
/* 补漏：排课大屏 */
html.app-dark .schedule-board-table {
  background: #10151f;
}
html.app-dark .schedule-board-table thead th,
html.app-dark .schedule-board-table thead th:first-child,
html.app-dark .schedule-time-head {
  background: #141a26;
  box-shadow: none;
}
html.app-dark .schedule-weekday-cell {
  background: #141a26;
  box-shadow: none;
}
html.app-dark .schedule-board-table td {
  border-color: #2a3344;
  background: #141a26;
  box-shadow: none;
}
html.app-dark .schedule-board-table .schedule-day-card-row td {
  border-color: #2a3344;
  background: #121826;
}
html.app-dark .schedule-card-lane-label {
  border-color: rgba(63, 139, 255, .4);
  background: rgba(63, 139, 255, .16);
  color: #9cc0ff;
}
html.app-dark .schedule-card {
  border-color: #2f3a4e;
  background: linear-gradient(180deg, #1a2130, #1e2635);
  box-shadow: 0 2px 7px rgba(0, 0, 0, .3);
}
html.app-dark .schedule-card:hover,
html.app-dark .schedule-card:focus {
  border-color: #4a6fa8;
  box-shadow: 0 0 0 2px rgba(63, 139, 255, .18), 0 6px 14px rgba(0, 0, 0, .35);
}
html.app-dark .schedule-card.card-schedule {
  border-left-color: #2fbf8f;
  background: linear-gradient(180deg, #16241f, #1a2c25);
}
html.app-dark .schedule-card-main {
  color: #dfe5f2;
}
html.app-dark .schedule-more {
  border-color: #3a465c;
  background: #232b3b;
  color: #9cc0ff;
}
html.app-dark .schedule-empty-cell {
  border-color: #232b3b;
  background: #10151f;
}
html.app-dark .schedule-empty-card-lane {
  color: var(--muted);
}
html.app-dark .schedule-board-table td.schedule-today-col {
  border-color: rgba(63, 139, 255, .4);
  background: rgba(63, 139, 255, .09);
}
html.app-dark .schedule-board-table .schedule-day-card-row td.schedule-today-col {
  border-color: rgba(63, 139, 255, .45);
  background: rgba(63, 139, 255, .12);
}
html.app-dark .schedule-board-table td.schedule-slot-current {
  border-color: rgba(63, 139, 255, .5);
  background: rgba(63, 139, 255, .16);
}
html.app-dark .schedule-board-table td.schedule-slot-upcoming {
  border-color: rgba(255, 159, 10, .45);
  background: rgba(255, 159, 10, .12);
}
html.app-dark .schedule-weekday-cell.schedule-today-cell {
  background: rgba(63, 139, 255, .16);
}
html.app-dark .schedule-weekday-cell.schedule-today-cell strong {
  color: #9cc0ff;
}
/* 补漏：排课弹窗内时段表与设置页 tabs */
html.app-dark .schedule-slot-table {
  background: #10151f;
}
html.app-dark .settings-tabs {
  border-color: #2a3344;
  background: rgba(255, 255, 255, .04);
  box-shadow: none;
}
html.app-dark .settings-tab {
  border-right-color: #232b3b;
  color: var(--muted);
}

/* ====================================================================
   通话任务模块（独立业务，号码绝不导出）
   顾问端：大点击区拨号按钮 + 一次一个号码的拨号卡片
   管理员端：号码池管理 + 任务分配 + 汇报看板
   ==================================================================== */
.call-queue-empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}
.call-queue-card {
  margin: 0 15px 15px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}
.call-queue-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.call-queue-name { font-size: 18px; font-weight: 700; }
.call-queue-meta { margin-top: 4px; color: var(--muted); font-size: 13px; }
.call-dial-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  text-decoration: none;
}
.call-dial-btn:hover { background: var(--green-dark); }
html.app-dark .call-dial-btn { color: #fff; }
.call-result-form { grid-template-columns: minmax(150px, 1fr) minmax(180px, 2fr) auto; }
.call-import-text {
  margin: 0 15px 15px;
  padding: 10px;
  width: calc(100% - 30px);
  min-height: 84px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  font-family: inherit;
}
.call-assign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 15px; }
.call-assign-grid h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.call-assign-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}
.call-assign-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.call-assign-item:hover { background: var(--soft); }
.call-assign-name { min-width: 72px; font-weight: 600; }
.call-assign-phone { color: var(--text); font-family: monospace; }
.call-assign-note { margin-left: auto; color: var(--muted); font-size: 12px; }
.call-assign-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.empty-hint {
  padding: 20px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.totals-row td {
  font-weight: 700;
  border-top: 2px solid var(--line-strong);
  background: var(--soft);
}
@media (max-width: 800px) {
  .call-assign-grid { grid-template-columns: 1fr; }
  .call-result-form { grid-template-columns: 1fr; }
}
html.app-dark .call-queue-card { background: #10151f; border-color: #2a3344; }
html.app-dark .call-assign-item:hover { background: rgba(255, 255, 255, .05); }
html.app-dark .call-import-text { background: #10151f; border-color: #2a3344; color: #e6edf3; }
html.app-dark .totals-row td { background: #161d29; }
html.app-dark .settings-tab:hover {
  background: rgba(255, 255, 255, .05);
}
html.app-dark .settings-tab.active {
  background: #141a26;
  color: var(--accent);
}
html.app-dark .weekday-choice-group label {
  border-color: #3a465c;
  background: #10151f;
  box-shadow: none;
}
/* 补漏二：多选下拉面板与选项 */
html.app-dark .multi-select-options {
  border-color: #3a465c;
  background: #171d29;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .5);
}
html.app-dark .multi-select-option {
  border-color: #3a465c;
  background: #10151f;
  color: var(--text);
}
html.app-dark .multi-select-option:hover,
html.app-dark .multi-select-option.selected {
  border-color: rgba(63, 139, 255, .6);
  background: rgba(63, 139, 255, .16);
}
/* 补漏二：筛选摘要条与时段摘要 */
html.app-dark .lesson-filter-summary,
html.app-dark .time-slot-summary {
  border-bottom-color: rgba(255, 255, 255, .08);
  background: #171d29;
  color: var(--muted);
}
html.app-dark .time-slot-summary {
  border: 1px solid #2a3344;
}
/* 补漏二：设置页 tabs 非激活态白底 */
html.app-dark .settings-tab {
  background: transparent;
}
/* 补漏二：设置页品牌面板与更新面板 */
html.app-dark .brand-settings-panel {
  border-color: #2a3344;
  background: #171d29;
}
html.app-dark .update-panel {
  border-color: #2a3344;
  background: #171d29;
}

/* ====================================================================
   顶部细进度条：所有 API 操作（登录/提交/查询/导出）请求期间在页面顶部
   显示一条平滑增长的进度动效，让用户明确知道"操作正在进行中"。
   ==================================================================== */
.page-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  z-index: 99999;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
  box-shadow: 0 0 8px 1px rgba(47, 125, 246, .55);
  opacity: 0;
  transition: opacity .25s ease, width .28s ease;
  pointer-events: none;
}
.page-progress.active {
  opacity: 1;
}
/* 末端光点，增强"正在推进"的感知 */
.page-progress::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 46px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(47,125,246,0), var(--accent));
  opacity: .85;
}
/* 深色模式：进度条与主题保持一致（accent 已统一，无需额外覆盖） */
@media (prefers-reduced-motion: reduce) {
  .page-progress {
    transition: none;
  }
}

/* 号码导入：按钮横排 + 文本域自适应 */
.call-import-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.call-import-text {
  width: 100%;
  resize: vertical;
  min-height: 96px;
}
.call-import-tabs {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.call-import-tab {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.call-file-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.call-file-input {
  font-size: 13px;
}
.call-import-hint {
  font-size: 12px;
  color: var(--muted, #888);
  margin: 4px 0 0;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.hidden {
  display: none;
}
.modal-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  max-width: 520px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.modal-card .form-actions {
  margin-top: 12px;
}
html.app-dark .modal-card {
  background: #1a2030;
}
