:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6c788d;
  --line: #e3e9f2;
  --primary: #0f8f83;
  --primary-dark: #08786f;
  --ok: #249f65;
  --bad: #d83d5a;
  --warn: #c98112;
  --blue: #2676d9;
  --purple: #8b5cf6;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.06), 0 14px 34px rgba(17, 24, 39, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.62; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 143, 131, 0.12), rgba(38, 118, 217, 0.08)),
    var(--bg);
}

.login-card {
  display: grid;
  width: min(440px, 100%);
  gap: 16px;
  padding: 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card h1 { font-size: 26px; }
.login-card p, .login-card small { color: var(--muted); line-height: 1.65; }
.login-brand { padding: 0; margin-bottom: 4px; }
.login-form { display: grid; gap: 16px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 236px;
  padding: 22px 16px;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
  font-weight: 800;
}

.brand-name { font-size: 18px; font-weight: 800; }
.nav { display: grid; gap: 7px; }

.nav-item {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  color: #596579;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  transition: background 0.18s, color 0.18s;
}

.nav-item:hover, .nav-item.active {
  color: #fff;
  background: var(--primary);
}

.sidebar-courses {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sidebar-courses-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 4px;
}

.sidebar-courses-head .icon-btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
}

.course-mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 9px;
  padding: 4px;
  background: #f3f6fa;
  border-radius: 8px;
}

.course-mode-tabs button {
  min-height: 31px;
  padding: 0 5px;
  color: #64748b;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
}

.course-mode-tabs button.active {
  color: var(--primary-dark);
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  font-weight: 700;
}

.home-course-mode-tabs {
  width: min(500px, 100%);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 14px;
}

.home-course-mode-tabs button { min-height: 36px; font-size: 13px; }

.today-course-list {
  display: grid;
  gap: 6px;
  max-height: 208px;
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar-course-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 7px 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sidebar-course-item > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #64748b;
  background: #e9eef5;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.sidebar-course-item strong,
.sidebar-course-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-course-item strong { font-size: 13px; }
.sidebar-course-item small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.sidebar-course-item.current { background: #e7f6f3; border-color: #9bd5cc; }
.sidebar-course-item.current > span { color: #fff; background: var(--primary); }
.sidebar-course-item.finished { opacity: 0.58; }

.sidebar-course-empty {
  padding: 18px 8px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.teacher-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 10px;
}

.teacher-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--primary);
  background: #e7f6f3;
  border-radius: 8px;
  font-weight: 800;
}

.app-shell {
  min-height: 100vh;
  margin-left: 236px;
  padding: 36px 38px 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 { font-size: 18px; line-height: 1.35; }
h3 { font-size: 16px; }
.topbar p { margin-top: 10px; color: var(--muted); }

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.primary-btn, .ghost-btn, .text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
  white-space: nowrap;
}

.primary-btn { color: #fff; background: var(--primary); }
.primary-btn:hover { background: var(--primary-dark); }
.ghost-btn { color: #334155; background: #f8fafc; border-color: var(--line); }
.ghost-btn:hover { background: #edf3f8; }
.text-btn { min-height: 34px; padding: 0 8px; color: var(--primary); background: transparent; }
.compact { min-height: 38px; padding-inline: 13px; font-size: 13px; }
.full { width: 100%; }
.file-label input { display: none; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: #475569;
  background: #edf2f7;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.ok { color: #0f766e; background: #e7f8f5; }
.status-pill.warn { color: #9a5b00; background: #fff3d7; }
.status-pill.bad { color: #be123c; background: #ffe8ef; }

.view { display: none; }
.view.active { display: block; }
#hygieneView.active { display: flex; flex-direction: column; }
#hygieneView .duty-management-panel { order: -1; }

.home-welcome {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) minmax(220px, 0.72fr);
  align-items: center;
  gap: 16px;
  min-height: 98px;
  margin-bottom: 20px;
  padding: 18px 22px;
  background: #f8f7ff;
  border: 1px solid #e5e1f8;
  border-left: 4px solid #6257d9;
  border-radius: 8px;
}

.home-welcome-avatar {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  color: #fff;
  background: #6257d9;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 800;
}

.home-welcome-copy span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.home-welcome-copy h2 {
  font-size: 22px;
  letter-spacing: 0;
}

.home-welcome-copy p {
  margin-top: 7px;
  color: #667188;
}

.home-welcome-motto {
  padding-left: 18px;
  color: #5c6480;
  border-left: 1px solid #ddd8f1;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.home-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.home-dashboard-grid > .panel {
  min-width: 0;
  margin-bottom: 0;
}

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

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

.metric-card {
  min-height: 128px;
  padding: 22px;
}

.metric-card span {
  display: block;
  margin-bottom: 14px;
  color: #64748b;
}

.metric-card strong {
  display: block;
  min-height: 34px;
  color: var(--primary);
  font-size: 32px;
  line-height: 1;
}

.metric-card small { display: block; margin-top: 10px; color: var(--muted); }
.metric-card .ok { color: var(--ok); }
.metric-card .bad { color: var(--bad); }
.metric-card .warn { color: var(--warn); }

.panel {
  padding: 22px;
  margin-bottom: 20px;
}

.chart-panel { min-height: 394px; }

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

.panel-subtitle, .section-heading p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.calendar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-actions strong {
  min-width: 112px;
  text-align: center;
  font-size: 16px;
}

.icon-btn {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  color: #334155;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

.icon-btn:hover { color: var(--primary); background: #edf8f6; }

.calendar-weekdays, .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 7px;
  color: #64748b;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.calendar-day {
  position: relative;
  display: grid;
  min-height: 52px;
  align-content: start;
  justify-items: start;
  padding: 9px;
  color: #334155;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.calendar-day:hover { border-color: var(--primary); background: #f3fbf9; }
.calendar-day.today { color: #fff; background: var(--primary); border-color: var(--primary); }
.calendar-day.selected:not(.today) { outline: 3px solid rgba(15, 143, 131, 0.16); border-color: var(--primary); }
.calendar-day.weekend:not(.today) { color: #9a5b00; background: #fffbeb; }
.calendar-day.legal-holiday:not(.today) { color: #be123c; background: #fff1f2; border-color: #fecdd3; }
.calendar-day.empty { visibility: hidden; }

.solar-day { font-weight: 700; }

.lunar-day {
  margin-top: 4px;
  color: #94a3b8;
  font-size: 10px;
  line-height: 1;
}

.calendar-day.today .lunar-day { color: rgba(255, 255, 255, 0.82); }
.calendar-day.legal-holiday:not(.today) .lunar-day { color: #e11d48; }

.calendar-day .todo-dot {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  color: #fff;
  background: var(--bad);
  border-radius: 999px;
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

.calendar-day.today .todo-dot { color: var(--bad); background: #fff; }

.holiday-countdown {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  margin-top: 14px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
}

.holiday-countdown small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.holiday-countdown strong {
  display: block;
  color: #0f766e;
  font-size: 16px;
}

.holiday-countdown-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.holiday-countdown-actions > span {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

.holiday-countdown-actions .ghost-btn { min-height: 34px; white-space: nowrap; }

.expectation-countdown {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  margin-top: 9px;
  padding: 10px 14px;
  background: #f5f8ff;
  border: 1px solid #dce6f6;
  border-radius: 8px;
}

.expectation-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 8px;
  font-weight: 800;
}

.expectation-countdown small,
.expectation-countdown strong { display: block; }
.expectation-countdown small { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.expectation-countdown strong { color: #1d4f91; overflow-wrap: anywhere; }
.expectation-countdown > span { color: var(--muted); font-size: 11px; text-align: right; }

.expectation-dialog { width: min(720px, calc(100vw - 32px)); }
.expectation-actions { margin-top: 2px; }
.expectation-actions #clearExpectationDay { margin-right: auto; }

.edit-hint {
  color: var(--muted);
  font-size: 12px;
}

.timetable-table {
  min-width: 760px;
  table-layout: fixed;
}

.timetable-table th, .timetable-table td {
  min-width: 0;
  padding: 8px;
  text-align: center;
}

.timetable-table th:first-child, .timetable-table td:first-child {
  width: 86px;
  color: #64748b;
  font-weight: 700;
}

.period-cell strong, .period-cell small {
  display: block;
}

.period-cell small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  white-space: nowrap;
}

.period-time-input {
  min-height: 28px;
  margin-top: 3px;
  padding: 3px 4px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px dashed #c9c3ed;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 500;
}

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

.timetable-input {
  min-height: 36px;
  padding: 7px 8px;
  text-align: center;
  background: #f8fafc;
  border-color: transparent;
}

.timetable-input:hover { border-color: #cbd5e1; }

.todo-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px 130px auto;
  gap: 10px;
  margin-bottom: 16px;
}

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

.home-dashboard-grid .todo-form {
  grid-template-columns: minmax(0, 1fr) 150px;
}

.home-dashboard-grid .todo-form input[name="title"],
.home-dashboard-grid .todo-form button {
  grid-column: 1 / -1;
}

.home-dashboard-grid .todo-list {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 2px;
}

.todo-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.todo-item input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--primary);
}

.todo-main { min-width: 0; }
.todo-main strong { display: block; overflow-wrap: anywhere; }
.todo-main small { display: block; margin-top: 4px; color: var(--muted); }
.todo-item.completed .todo-main strong { color: #94a3b8; text-decoration: line-through; }

.todo-delete {
  width: 32px;
  height: 32px;
  padding: 0;
  color: #be123c;
  background: #fff1f2;
  border: 1px solid #ffe4e6;
  border-radius: 6px;
  font-size: 18px;
}

.class-management-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.class-management-stack > .panel {
  min-width: 0;
  margin-bottom: 0;
}

.class-management-panel {
  break-inside: avoid;
}

.section-head-actions,
.section-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.section-head-actions {
  flex-wrap: wrap;
}

.class-rule-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.32fr) minmax(280px, 1.4fr) auto;
  gap: 10px;
  margin-bottom: 18px;
}

.class-rule-template-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  background: #f8f8fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.class-rule-template-bar strong,
.class-rule-template-bar span {
  display: block;
}

.class-rule-template-bar span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.class-rule-template-preview {
  margin-bottom: 14px;
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.class-rule-reference-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 12px 14px;
}

.class-rule-reference-empty span,
.class-rule-reference-head span {
  color: var(--muted);
  font-size: 12px;
}

.class-rule-reference-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
  background: #f2f0ff;
  border-bottom: 1px solid #ddd8f7;
}

.class-rule-reference-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.class-rule-reference-item {
  display: grid;
  grid-template-columns: 20px 58px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  color: var(--text);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-weight: 500;
  line-height: 1.55;
}

.class-rule-reference-item:nth-child(2n) { border-right: 0; }
.class-rule-reference-item:nth-last-child(-n + 2) { border-bottom: 0; }

.class-rule-reference-item input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.class-rule-reference-item > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.class-rule-list {
  display: grid;
  gap: 10px;
}

.class-rule-item {
  display: grid;
  grid-template-columns: 36px 76px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.class-rule-number {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 7px;
  font-weight: 700;
}

.class-rule-category {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.class-rule-item p {
  min-width: 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.affairs-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}

.work-log-panel {
  margin-bottom: 18px;
}

.work-log-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.work-log-stats article {
  min-height: 76px;
  padding: 12px 15px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.work-log-stats article.has-follow-up {
  background: #fff8f1;
  border-color: #f5d3b7;
}

.work-log-stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.work-log-stats strong {
  display: block;
  margin-top: 7px;
  color: var(--primary);
  font-size: 24px;
}

.work-log-stats article.has-follow-up strong { color: #d56b32; }

.work-log-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.work-log-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.work-log-filters button {
  min-height: 34px;
  padding: 0 13px;
  color: #596579;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.work-log-filters button.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.work-log-search {
  flex: 0 0 min(280px, 34vw);
  gap: 5px;
  font-size: 12px;
}

.work-log-search input { min-height: 36px; }

.work-log-timeline {
  display: grid;
  gap: 0;
  max-height: 620px;
  padding-right: 4px;
  overflow-y: auto;
}

.work-log-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 14px;
}

.work-log-item:not(:last-child)::before {
  position: absolute;
  top: 18px;
  bottom: -3px;
  left: 8px;
  width: 2px;
  background: #ddd8f7;
  content: "";
}

.work-log-marker {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  margin-top: 16px;
  background: #fff;
  border: 5px solid var(--primary);
  border-radius: 50%;
}

.work-log-item.needs-follow-up .work-log-marker { border-color: #ed8b4a; }

.work-log-entry {
  min-width: 0;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.work-log-item.needs-follow-up .work-log-entry { border-left: 4px solid #ed8b4a; }

.work-log-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.work-log-meta time {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.work-log-student {
  color: #4f5d73;
  font-size: 13px;
  font-weight: 700;
}

.work-log-entry h3 {
  margin-top: 10px;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.work-log-entry > p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.work-log-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid #edf0f5;
}

.work-log-follow-up-state {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  color: #b65725;
  background: #fff3e8;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.work-log-follow-up-state.done {
  color: #278060;
  background: #eaf8f2;
}

.work-log-follow-up-state.plain {
  color: #667085;
  background: #f2f4f7;
}

.work-log-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.work-log-empty { min-height: 190px; }

.work-log-dialog { width: min(780px, calc(100vw - 32px)); }

.work-log-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.parent-contact-fields {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  background: #f6fbfa;
  border: 1px solid #ccebe0;
  border-left: 3px solid #43b987;
  border-radius: 8px;
}

.parent-contact-fields label:nth-child(3),
.parent-contact-fields label:nth-child(4) {
  grid-column: 1 / -1;
}

.parent-contact-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
  padding: 10px 12px;
  color: #426357;
  background: #f6fbfa;
  border-left: 3px solid #43b987;
  font-size: 12px;
}

.parent-contact-summary span {
  padding: 3px 7px;
  color: #25775a;
  background: #e7f7ef;
  border-radius: 4px;
}

.parent-contact-summary p {
  width: 100%;
  margin: 2px 0 0;
  color: #4c6258;
}

.work-log-title-field,
.work-log-content-field,
.work-log-attachment-field {
  grid-column: 1 / -1;
}

.work-log-attachment-field small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.work-log-attachment-draft {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
}

.work-log-attachment-empty {
  min-height: 42px;
  padding: 11px 12px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.work-log-draft-file,
.work-log-attachment {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 11px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.work-log-draft-file.pending {
  background: #f4f2ff;
  border-color: #ddd8f7;
}

.work-log-file-type {
  display: grid;
  width: 42px;
  min-height: 30px;
  place-items: center;
  color: #51479f;
  background: #ebe8ff;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  overflow: hidden;
}

.work-log-draft-file > div,
.work-log-attachment > div:nth-child(2) {
  min-width: 0;
}

.work-log-draft-file strong,
.work-log-attachment strong {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-log-draft-file small,
.work-log-attachment small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.work-log-draft-file > button {
  width: 30px;
  height: 30px;
  padding: 0;
  color: #be123c;
  background: #fff1f2;
  border: 1px solid #ffe4e6;
  border-radius: 6px;
  font-size: 17px;
}

.work-log-attachment-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.work-log-attachment {
  padding-block: 8px;
  background: #fbfcff;
}

.work-log-attachment > div:last-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.work-log-follow-up {
  align-self: center;
}

.affairs-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(0, 1.68fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.affairs-workspace > .panel { min-width: 0; margin-bottom: 0; }

.affairs-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.affairs-stats article {
  min-height: 78px;
  padding: 13px 15px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.affairs-stats span { display: block; color: var(--muted); }
.affairs-stats strong { display: block; margin-top: 8px; color: var(--primary); font-size: 24px; }
.affairs-pending-list { max-height: 520px; padding-right: 2px; overflow-y: auto; }

.notice-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.notice-filters button {
  min-height: 34px;
  padding: 0 14px;
  color: #596579;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.notice-filters button.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.notice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
}

.notice-item {
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 164px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.notice-item.important { border-left: 4px solid var(--bad); }
.notice-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.notice-meta time { color: var(--muted); font-size: 12px; }
.notice-item h3 { margin-top: 12px; overflow-wrap: anywhere; }
.notice-item p { margin-top: 8px; color: var(--muted); line-height: 1.55; overflow-wrap: anywhere; }
.notice-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: auto; padding-top: 12px; }
.danger-text { color: #be123c !important; }

.affairs-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 180px;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.affairs-empty strong { color: #475569; }

.duty-schedule {
  display: grid;
  gap: 12px;
}

.duty-roster-toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}

.duty-roster-toolbar label,
.score-filter-bar label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.duty-roster-toolbar select { min-width: 150px; }
.duty-roster-note { color: var(--muted); font-size: 13px; }
.duty-roster-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.duty-roster-table { min-width: 760px; }
.duty-roster-table th, .duty-roster-table td { text-align: center; }
.duty-roster-table tbody th { text-align: left; color: #334155; background: #fbfcfe; }
.duty-roster-table th.today, .duty-roster-table td.today { background: #fff7e7; }
.duty-roster-table th small { display: block; margin-top: 3px; color: var(--primary); }
.duty-roster-table select { width: 100%; min-height: 34px; border: 1px dashed #cfd7e5; background: #fff; }
.duty-group-row th { color: #4c3fb5; background: #f7f5ff !important; }
.duty-group-members { display: block; min-height: 18px; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.4; }

.hygiene-scoreboard { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.hygiene-scoreboard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.hygiene-scoreboard-head span { color: var(--muted); font-size: 12px; }
.hygiene-scoreboard-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.hygiene-scoreboard-list article { display: grid; gap: 3px; min-height: 78px; padding: 11px 12px; border-left: 3px solid #4ebec7; background: #f7fbfc; }
.hygiene-scoreboard-list article span { color: #0f766e; font-size: 20px; font-weight: 800; }
.hygiene-scoreboard-list article small { color: var(--muted); font-size: 11px; }

.honor-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.honor-summary article { display: grid; gap: 5px; min-height: 92px; padding: 14px 16px; border-left: 4px solid #d08a20; background: #fffaf1; }
.honor-summary article:nth-child(2) { border-left-color: #e26573; background: #fff5f7; }
.honor-summary article:nth-child(3) { border-left-color: #6257d9; background: #f8f7ff; }
.honor-summary span, .honor-summary small { color: var(--muted); font-size: 12px; }
.honor-summary strong { overflow: hidden; color: var(--text); font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.honor-split { margin-bottom: 0; }
.honor-record.honor { border-left: 3px solid #d08a20; }
.honor-record.punishment { border-left: 3px solid #e26573; }

.student-profile-dialog { width: min(900px, calc(100vw - 32px)); }
.student-profile-content { display: grid; gap: 16px; }
.student-profile-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.student-profile-metrics article { display: grid; gap: 4px; min-height: 82px; padding: 12px; background: #f8fafc; border: 1px solid var(--line); border-top: 3px solid #6257d9; }
.student-profile-metrics span, .student-profile-metrics small { color: var(--muted); font-size: 12px; }
.student-profile-metrics strong { color: var(--primary-dark); font-size: 21px; }
.student-profile-section { padding-top: 14px; border-top: 1px solid var(--line); }
.student-profile-section h3 { margin: 0 0 10px; font-size: 15px; }
.student-profile-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; color: #475569; font-size: 13px; }
.profile-chip-list, .profile-score-list { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-chip-list span, .profile-score-list span { display: inline-flex; gap: 7px; align-items: center; padding: 7px 9px; color: #475569; background: #f8fafc; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.profile-score-list strong { color: var(--primary-dark); }
.profile-activity-list { display: grid; gap: 7px; }
.profile-activity-list article { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 9px 11px; background: #fbfcfe; border-left: 3px solid #dbe3f0; }
.profile-activity-list article span { color: var(--muted); font-size: 11px; }
.profile-activity-list article p { grid-column: 1 / -1; margin: 0; color: #64748b; font-size: 12px; line-height: 1.5; }

.home-alert-panel { margin: 18px 0; border-top: 3px solid #6257d9; }
.home-alert-panel.has-urgent { border-top-color: #e26573; }
.home-alert-list { display: grid; gap: 8px; }
.home-alert-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 58px; padding: 10px 12px; background: #fbfcfe; border: 1px solid var(--line); border-left: 3px solid #9ba7c8; }
.home-alert-item.urgent { background: #fff8f8; border-left-color: #e26573; }
.home-alert-item.follow-up { background: #faf9ff; border-left-color: #6257d9; }
.home-alert-item.notice { background: #fffdf7; border-left-color: #d08a20; }
.home-alert-item.birthday { background: #f6fbfa; border-left-color: #43b987; }
.home-alert-indicator { width: 8px; height: 8px; background: #9ba7c8; border-radius: 50%; }
.home-alert-item.urgent .home-alert-indicator { background: #e26573; }
.home-alert-item.follow-up .home-alert-indicator { background: #6257d9; }
.home-alert-item.notice .home-alert-indicator { background: #d08a20; }
.home-alert-item.birthday .home-alert-indicator { background: #43b987; }
.home-alert-item > div { display: grid; gap: 3px; min-width: 0; }
.home-alert-item strong { overflow: hidden; color: var(--text); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.home-alert-item small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.home-alert-empty { display: flex; align-items: baseline; gap: 10px; min-height: 58px; padding: 0 12px; color: #39765e; background: #f6fbfa; border-left: 3px solid #43b987; }
.home-alert-empty span { color: var(--muted); font-size: 13px; }

.score-import-panel, .score-stat-panel { margin-bottom: 18px; }
.exam-form { display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(140px, .72fr) minmax(150px, .82fr) auto; gap: 10px; align-items: end; }
.score-import-form { display: grid; grid-template-columns: minmax(150px, 1.2fr) repeat(3, minmax(120px, .8fr)) auto auto; gap: 10px; align-items: end; }
.score-import-form .file-label { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; }
.score-filter-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.score-filter-bar select { min-width: 170px; }
.score-metrics { margin-bottom: 16px; }
.score-assessment-list { display: grid; gap: 12px; }
.score-assessment-item { padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.score-assessment-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.score-assessment-head h3 { margin: 0; font-size: 16px; }
.score-assessment-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.score-assessment-head > div:last-child { display: flex; align-items: center; gap: 8px; }
.score-student-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 14px; }
.score-student-list span { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 6px; background: #f7f8fb; }
.score-student-list b { font-weight: 600; color: #475569; }
.score-student-list strong { color: var(--primary); }
.score-visual-panel { margin-bottom: 18px; }
.student-score-analysis-panel { margin-bottom: 18px; }
.score-analysis-table-wrap { margin-top: 16px; }
.score-table td strong { color: var(--primary-dark); }
.student-analysis-table td { white-space: nowrap; }
.score-visual-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.score-visual-card { min-height: 260px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fcfdff; }
.score-visual-card h3 { margin: 0 0 14px; font-size: 15px; color: #334155; }
.score-bar-chart { display: flex; min-height: 202px; align-items: end; gap: 10px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.score-bar-item { display: grid; flex: 0 0 46px; height: 202px; grid-template-rows: auto 1fr auto; align-items: end; gap: 6px; text-align: center; }
.score-bar-item strong { color: var(--primary); font-size: 12px; }
.score-bar-item span { display: block; width: 100%; min-height: 4px; background: var(--primary); border-radius: 5px 5px 0 0; }
.score-bar-item small { overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.score-distribution-chart { display: grid; gap: 15px; padding-top: 10px; }
.score-distribution-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) 38px; align-items: center; gap: 8px; font-size: 12px; }
.score-distribution-row > div { height: 12px; overflow: hidden; background: #edf1f6; border-radius: 99px; }
.score-distribution-row i { display: block; height: 100%; border-radius: inherit; }
.score-distribution-row strong { text-align: right; color: #475569; }
.score-ranking-chart { display: grid; gap: 9px; }
.score-ranking-chart > div { display: grid; grid-template-columns: 20px minmax(44px, .7fr) minmax(80px, 1fr) 34px; align-items: center; gap: 6px; font-size: 12px; }
.score-ranking-chart span { color: var(--primary); font-weight: 700; }
.score-ranking-chart b { overflow: hidden; color: #475569; text-overflow: ellipsis; white-space: nowrap; }
.score-ranking-chart i { height: 8px; overflow: hidden; background: #edf1f6; border-radius: 99px; }
.score-ranking-chart em { display: block; height: 100%; background: #4ebec7; border-radius: inherit; }
.score-ranking-chart strong { text-align: right; color: #334155; }
.seat-score-rank { display: inline-flex; margin-top: 5px; padding: 2px 6px; color: #5b4fd0; background: #f0edff; border-radius: 5px; font-size: 11px; font-weight: 800; }
.score-up { color: #18885f; font-weight: 800; }
.score-down { color: #d25264; font-weight: 800; }

.duty-row {
  display: grid;
  grid-template-columns: 66px minmax(130px, 0.55fr) minmax(190px, 0.95fr) minmax(240px, 1.5fr);
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.duty-row.today {
  margin-inline: -10px;
  padding-inline: 10px;
  background: #f0fbf8;
}

.duty-row strong { color: #475569; }
.duty-row.today strong { color: var(--primary); }
.duty-row select, .duty-row input { min-height: 36px; }

.duty-members {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 7px 10px;
  background: #f7f8fb;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.duty-members span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.duty-members strong {
  min-width: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.role-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(180px, 0.85fr) minmax(280px, 1.45fr) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.role-form input[name="responsibilityCustom"]:not([hidden]) {
  grid-column: 1 / 4;
}

.role-form input[name="responsibilityCustom"]:not([hidden]) + button {
  grid-column: 4;
}

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

.role-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.role-item strong { display: block; }
.role-item p { margin-top: 4px; color: var(--muted); line-height: 1.45; }
.role-item .role-owner { color: var(--primary); font-weight: 700; }

.role-delete {
  width: 32px;
  height: 32px;
  padding: 0;
  color: #be123c;
  background: #fff1f2;
  border: 1px solid #ffe4e6;
  border-radius: 6px;
  font-size: 18px;
}

.section-heading {
  margin: 34px 0 16px;
}

.overview-panel .metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 0;
}

.overview-panel .metric-card {
  min-height: 102px;
  padding: 16px;
}

.overview-panel .metric-card span { margin-bottom: 10px; }
.overview-panel .metric-card strong { min-height: 28px; font-size: 26px; }
.overview-panel .metric-card small { margin-top: 7px; }

.course-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.course-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.course-form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.teaching-dialog { width: min(640px, calc(100vw - 32px)); }

.courses-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.course-import-label input { display: none; }

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

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.teaching-overview {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.teaching-overview > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 210px;
  overflow-y: auto;
}

.teaching-overview button {
  min-width: 0;
  padding: 9px 10px;
  color: #334155;
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.teaching-overview span,
.teaching-overview small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teaching-overview small { margin-top: 4px; color: var(--muted); }

.courses-page { min-height: 620px; }

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

.courses-page-header h2 { margin-top: 7px; font-size: 22px; }
.courses-date { color: var(--primary); font-weight: 700; }

.courses-summary {
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) minmax(260px, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.courses-summary article {
  min-height: 100px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.courses-summary span, .courses-summary small { display: block; color: var(--muted); }
.courses-summary strong { display: block; margin: 9px 0 6px; color: var(--primary-dark); font-size: 24px; }

.courses-page-tabs {
  width: min(560px, 100%);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

.courses-page-tabs button { min-height: 38px; font-size: 14px; }

.courses-page-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: none;
  overflow: visible;
}

.courses-page-list .sidebar-course-item {
  grid-template-columns: minmax(124px, 0.55fr) minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 88px;
  padding: 13px 15px;
}

.courses-page-list .course-period {
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.courses-page-list .course-period strong,
.courses-page-list .course-period small,
.courses-page-list .course-detail strong,
.courses-page-list .course-detail small {
  display: block;
}

.courses-page-list .course-period small,
.courses-page-list .course-detail small {
  margin-top: 5px;
  color: var(--muted);
}

.courses-page-list .course-detail strong { font-size: 17px; }

.courses-page-list .course-state {
  display: inline-flex;
  width: auto;
  height: 26px;
  min-width: 54px;
  padding: 0 8px;
  align-items: center;
  justify-content: center;
  color: #64748b;
  background: #e9eef5;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

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

.courses-week-table { min-width: 780px; }

.courses-week-table th,
.courses-week-table td { text-align: center; }

.courses-week-table .period-cell { min-width: 116px; text-align: left; }

.courses-week-table .period-cell strong,
.courses-week-table .period-cell small { display: block; }

.courses-week-table .period-cell small { margin-top: 4px; color: var(--muted); font-weight: 500; }

.week-course-cell {
  display: grid;
  width: 100%;
  min-height: 56px;
  place-content: center;
  gap: 4px;
  padding: 9px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
}

.week-course-cell:hover,
.week-course-cell:focus-visible { border-color: var(--primary); background: #f3f1ff; outline: 0; }
.week-course-cell.empty { color: #cbd5e1; background: #fbfcfe; }
.week-course-cell small { color: var(--muted); font-size: 11px; font-weight: 500; }
.current-day .week-course-cell { background: #f5f3ff; }
.current-period .week-course-cell { color: #fff; background: var(--primary); }
.current-period .week-course-cell small { color: rgba(255, 255, 255, 0.84); }

.courses-page-list .current .course-state { color: #fff; background: var(--primary); }
.courses-page-list .sidebar-course-empty { grid-column: 1 / -1; min-height: 240px; place-content: center; font-size: 14px; }

.course-form .panel-head { margin-bottom: 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: #475569;
  font-size: 12px;
}

.dot {
  display: inline-block;
  width: 20px;
  height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
  border-radius: 4px;
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  min-width: 126px;
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
th { color: #64748b; background: #f8fafc; font-size: 13px; }
td { color: #334155; }

.split-panel {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.form-card, .content-card, .settings-form {
  display: grid;
  gap: 16px;
}

.form-card {
  padding: 18px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.group-member-preview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  background: #f2f0ff;
  border: 1px solid #ddd8f7;
  border-radius: 8px;
}

.group-member-preview span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.group-member-preview strong {
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.group-member-preview small {
  color: #5b4fd0;
  font-weight: 700;
  white-space: nowrap;
}

label {
  display: grid;
  gap: 8px;
  color: #475569;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--text);
  background: #fff;
  border: 1px solid #d7dfeb;
  border-radius: 8px;
  outline: 0;
}

select[multiple] { min-height: 124px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 143, 131, 0.12);
}

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

.student-tile, .student-card, .record-item, .rank-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.student-tile { display: grid; gap: 9px; padding: 14px; }
.student-tile small, .student-card p, .record-item p, .rank-item p {
  color: var(--muted);
  line-height: 1.55;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: #0f766e;
  background: #e7f8f5;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.tag.bad { color: #be123c; background: #ffe8ef; }
.tag.warn { color: #9a5b00; background: #fff3d7; }
.tag.gray { color: #475569; background: #edf2f7; }
.tag.blue { color: #1d4ed8; background: #e8f0ff; }

.record-list, .rank-list { display: grid; gap: 10px; }
.record-item, .rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
}

.record-group-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 5px 0;
  color: #475569;
}

.record-group-members span {
  color: #5b4fd0;
  font-size: 12px;
  font-weight: 800;
}

.student-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.student-form input[name="note"] { grid-column: span 2; }

.student-profile-form {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  margin-bottom: 0;
}

.student-profile-form button { grid-column: 4; }

.auto-group-form {
  display: grid;
  grid-template-columns: minmax(130px, 0.5fr) minmax(200px, 1fr) minmax(180px, 0.85fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
}

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

.student-group-card {
  display: grid;
  gap: 9px;
  min-height: 116px;
  padding: 14px;
  background: #fdfdff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.student-group-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.student-group-card > div span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.student-group-card p {
  color: #344158;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.student-group-card small {
  margin-top: auto;
  color: var(--muted);
}

.student-group-card.unassigned {
  background: #fff8f2;
  border-color: #f3dfd2;
}

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

.student-info-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.75fr) minmax(0, 1.4fr);
  gap: 18px;
}

.student-info-grid > .panel { min-width: 0; margin-bottom: 18px; }

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

.birthday-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 64px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.birthday-item.today { background: #e7f6f3; border-color: #9bd5cc; }

.birthday-date {
  display: grid;
  width: 42px;
  height: 46px;
  place-content: center;
  color: var(--primary-dark);
  text-align: center;
  background: #e7f6f3;
  border-radius: 7px;
}

.birthday-date strong, .birthday-date span { display: block; line-height: 1.1; }
.birthday-date span { margin-top: 3px; font-size: 12px; }
.birthday-item > div:nth-child(2) strong, .birthday-item > div:nth-child(2) small { display: block; }
.birthday-item > div:nth-child(2) small { margin-top: 5px; color: var(--muted); }
.guardian-table a { color: var(--primary-dark); font-weight: 700; text-decoration: none; }
.guardian-table .text-btn { white-space: nowrap; }

.student-edit-dialog { width: min(760px, calc(100vw - 32px)); }
.student-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.student-card {
  display: grid;
  gap: 8px;
  min-height: 152px;
  padding: 16px;
}

.student-card button {
  min-height: 32px;
  color: #be123c;
  background: #fff1f2;
  border: 1px solid #ffe4e6;
  border-radius: 6px;
  font-weight: 700;
}

.student-card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: auto;
}

.student-card-actions button:first-child {
  color: var(--primary-dark);
  background: #e7f6f3;
  border-color: #bfe5df;
}

.student-card-actions button:nth-child(2) {
  color: #475569;
  background: #f8fafc;
  border-color: var(--line);
}

.student-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.danger-btn {
  min-height: 32px;
  padding: 0 10px;
  color: #be123c;
  background: #fff1f2;
  border: 1px solid #ffe4e6;
  border-radius: 6px;
}

.report-box {
  min-height: 390px;
  color: #1f2937;
  line-height: 1.8;
  background: #fbfdff;
}

.settings-form {
  max-width: 940px;
}

.settings-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 18px;
  background: #fafbfe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-form legend {
  padding: 0 8px;
  color: #3d4760;
  font-size: 15px;
  font-weight: 800;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-wide {
  grid-column: 1 / -1;
}

.settings-submit {
  justify-self: start;
  min-width: 140px;
}

.seat-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.seat-size-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.seat-size-controls label { width: 92px; }
.seat-size-controls label:nth-child(3) { width: 130px; }
.seat-size-controls input { min-height: 36px; }

.seat-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.seat-sidebar { display: grid; gap: 14px; }

.seat-side-block {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.seat-side-block .panel-head { margin-bottom: 12px; }

.seat-controls {
  display: grid;
  gap: 14px;
}

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

.seat-plan-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px 32px;
  align-items: center;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.seat-plan-item.active { background: #f0fbf8; border-color: var(--primary); }
.seat-plan-item > button:first-child { min-width: 0; padding: 5px 7px; text-align: left; background: transparent; border: 0; }
.seat-plan-item strong, .seat-plan-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-plan-item small { margin-top: 4px; color: var(--muted); }

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

.check-row input { width: auto; min-height: auto; }

.board-note {
  margin-bottom: 12px;
  padding: 10px 12px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.55;
}

.seat-canvas-panel { min-width: 0; margin-bottom: 0; }
.seat-stage { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.seat-stage.student-view { flex-direction: column-reverse; }

.seat-podium {
  align-self: center;
  width: min(420px, 68%);
  min-height: 42px;
  padding: 10px;
  color: var(--primary-dark);
  text-align: center;
  background: #e7f6f3;
  border: 1px solid #bfe5df;
  border-radius: 8px;
  font-weight: 800;
}

.seat-board {
  display: grid;
  gap: 10px;
  min-width: 520px;
  padding: 16px;
  overflow-x: auto;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.seat-row {
  display: grid;
  gap: 10px;
}

.seat-cell {
  position: relative;
  display: grid;
  min-height: 76px;
  padding: 8px;
  align-content: center;
  gap: 4px;
  color: #334155;
  text-align: center;
  background: #fff;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
}

.seat-cell.aisle-after { margin-right: 18px; }
.seat-cell .seat-lock { position: absolute; top: 5px; right: 6px; color: var(--primary); font-size: 10px; }
.seat-cell .empty-seat-label { color: #a3afbf; }
.seat-cell:not([data-student-id]) { cursor: pointer; }

.seat-cell[data-student-id]:not(.locked) {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.seat-cell.dragging {
  opacity: 0.42;
  cursor: grabbing;
}

.seat-cell.drag-over {
  background: #e7f8f5;
  border-color: var(--primary);
  outline: 3px solid rgba(15, 143, 131, 0.22);
}

.seat-board.seat-dragging .seat-cell:not(.locked) {
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}

.seat-drag-ghost {
  position: fixed;
  z-index: 200;
  display: grid;
  min-height: 76px;
  padding: 8px;
  align-content: center;
  gap: 4px;
  color: #334155;
  text-align: center;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.2);
  pointer-events: none;
}

.seat-drag-ghost strong { font-size: 14px; }
.seat-drag-ghost small { color: var(--muted); }
.seat-cell.locked { border-color: var(--primary); background: #f0fbf8; }
.seat-cell strong { font-size: 14px; }
.seat-cell small { color: var(--muted); }

.unseated-panel { margin-top: 18px; }
.unseated-list { display: flex; flex-wrap: wrap; gap: 9px; min-height: 44px; }

.unseated-list button {
  display: grid;
  gap: 3px;
  min-width: 112px;
  padding: 9px 12px;
  color: #334155;
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.unseated-list button.selected { color: var(--primary-dark); background: #e7f6f3; border-color: var(--primary); }
.unseated-list button small { color: var(--muted); font-size: 11px; }
.empty-row, .empty-state { color: var(--muted); }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  max-width: min(380px, calc(100vw - 48px));
  padding: 12px 16px;
  color: #fff;
  background: #111827;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-panel .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-panel, .seat-layout { grid-template-columns: 1fr; }
  .seat-toolbar { align-items: stretch; flex-direction: column; }
  .student-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-form button { grid-column: 1 / -1; }
  .auto-group-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auto-group-form button { grid-column: 1 / -1; }
  .student-info-grid { grid-template-columns: 1fr; }
  .todo-form { grid-template-columns: minmax(220px, 1fr) 170px 130px; }
  .todo-form button { grid-column: 1 / -1; }
}

@media (max-width: 1080px) {
  .home-dashboard-grid { grid-template-columns: 1fr; }
  .affairs-workspace { grid-template-columns: 1fr; }
  .courses-page-list { grid-template-columns: 1fr; }
  .student-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar .brand { display: none; }
  .nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; min-height: 38px; padding: 0 11px; font-size: 12px; white-space: nowrap; }
  .nav-item .nav-icon { width: 15px; height: 15px; }
  .sidebar-courses, .sidebar-footer { display: none; }
  .app-shell { margin-left: 0; padding: 22px 16px 40px; }
  .topbar, .panel-head { align-items: stretch; flex-direction: column; }
  .todo-panel .panel-head { align-items: flex-start; }
  .top-actions, .legend { justify-content: flex-start; }
  .metric-grid, .student-form { grid-template-columns: 1fr; }
  .group-member-preview { grid-template-columns: 1fr; }
  .overview-panel .metric-grid { grid-template-columns: 1fr; }
  .todo-form { grid-template-columns: 1fr; }
  .home-dashboard-grid .todo-form { grid-template-columns: 1fr; }
  .home-dashboard-grid .todo-form input[name="title"],
  .home-dashboard-grid .todo-form button { grid-column: auto; }
  .home-welcome { grid-template-columns: 46px minmax(0, 1fr); padding: 16px; }
  .home-welcome-avatar { width: 44px; height: 44px; }
  .home-welcome-copy h2 { font-size: 19px; }
  .home-welcome-motto { grid-column: 1 / -1; padding: 12px 0 0; border-left: 0; border-top: 1px solid #ddd8f1; }
  .timetable-actions { justify-content: flex-start; }
  .todo-form button { grid-column: auto; }
  .student-form input[name="note"] { grid-column: auto; }
  h1 { font-size: 24px; }
  .metric-card { min-height: 112px; }
  .seat-board { min-width: 640px; }
  .calendar-actions { flex-wrap: wrap; }
  .calendar-actions strong { min-width: 96px; }
  .calendar-day { min-height: 48px; padding: 7px; }
  .calendar-day .todo-dot { right: 4px; bottom: 4px; min-width: 17px; height: 17px; line-height: 17px; }
  .holiday-countdown { align-items: flex-start; flex-direction: column; gap: 8px; }
  .holiday-countdown-actions { width: 100%; align-items: flex-start; justify-content: space-between; }
  .expectation-countdown { grid-template-columns: 36px minmax(0, 1fr); }
  .expectation-countdown > span { grid-column: 2; text-align: left; }
  .expectation-actions { flex-wrap: wrap; }
  .expectation-actions #clearExpectationDay { width: 100%; margin-right: 0; }
  .todo-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .todo-item .tag { display: none; }
  .duty-row { grid-template-columns: 56px 1fr; }
  .duty-row input { grid-column: 1 / -1; }
  .duty-members { grid-column: 1 / -1; }
  .class-rule-form { grid-template-columns: 1fr; }
  .class-rule-template-bar { grid-template-columns: 1fr; }
  .class-rule-reference-list { grid-template-columns: 1fr; }
  .class-rule-reference-item,
  .class-rule-reference-item:nth-child(2n),
  .class-rule-reference-item:nth-last-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .class-rule-reference-item:last-child { border-bottom: 0; }
  .class-rule-reference-empty,
  .class-rule-reference-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .class-rule-item { grid-template-columns: 36px 64px minmax(0, 1fr) 32px; gap: 8px; }
  .section-head-actions, .section-tools { justify-content: flex-start; }
  .role-form { grid-template-columns: 1fr; }
  .role-form input[name="responsibilityCustom"]:not([hidden]),
  .role-form button { grid-column: auto; }
  .teaching-slot-grid, .teaching-overview > div { grid-template-columns: 1fr; }
  .courses-page-header { align-items: stretch; flex-direction: column; }
  .courses-page-actions { justify-content: flex-start; }
  .courses-summary, .student-metrics, .student-edit-grid { grid-template-columns: 1fr; }
  .courses-page-list { grid-template-columns: 1fr; max-height: none; }
  .courses-page-list .sidebar-course-item { grid-template-columns: 105px minmax(0, 1fr); }
  .courses-page-list .course-state { grid-column: 2; justify-self: start; }
  .student-profile-form { grid-template-columns: 1fr; }
  .student-profile-form button { grid-column: auto; }
  .auto-group-form { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .exam-form, .score-import-form, .score-visual-grid { grid-template-columns: 1fr; }
  .score-visual-card { min-height: 220px; }
  .settings-wide { grid-column: auto; }
  .affairs-toolbar { justify-content: flex-start; flex-wrap: wrap; }
  .work-log-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work-log-stats article { min-height: 70px; padding: 10px; }
  .work-log-tools { align-items: stretch; flex-direction: column; }
  .work-log-search { flex-basis: auto; width: 100%; }
  .work-log-form-grid { grid-template-columns: 1fr; }
  .parent-contact-fields { grid-column: auto; grid-template-columns: 1fr; }
  .parent-contact-fields label:nth-child(3),
  .parent-contact-fields label:nth-child(4) { grid-column: auto; }
  .work-log-title-field,
  .work-log-content-field,
  .work-log-attachment-field { grid-column: auto; }
  .work-log-attachment-draft { grid-column: auto; }
  .work-log-draft-file,
  .work-log-attachment { grid-template-columns: 42px minmax(0, 1fr); }
  .work-log-draft-file > button,
  .work-log-attachment > div:last-child { grid-column: 2; justify-self: start; }
  .work-log-footer { align-items: flex-start; flex-direction: column; }
  .work-log-actions { justify-content: flex-start; }
  .work-log-meta time { width: 100%; margin-left: 0; }
  .home-alert-item { grid-template-columns: 8px minmax(0, 1fr); }
  .home-alert-item > button { grid-column: 2; justify-self: start; }
  .home-alert-empty { align-items: flex-start; flex-direction: column; justify-content: center; gap: 3px; }
  .notice-list { grid-template-columns: 1fr; }
  .seat-size-controls { align-items: stretch; flex-direction: column; }
  .seat-size-controls label, .seat-size-controls label:nth-child(3) { width: 100%; }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  @page timetable {
    size: A4 landscape;
    margin: 10mm;
  }

  body.print-class-section {
    background: #fff;
  }

  body.print-class-section * {
    visibility: hidden !important;
  }

  body.print-class-section .section-print-target,
  body.print-class-section .section-print-target * {
    visibility: visible !important;
  }

  body.print-class-section .section-print-target {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  body.print-class-section #timetablePanel.section-print-target {
    page: timetable;
  }

  body.print-class-section #timetablePanel .table-wrap {
    overflow: visible;
  }

  body.print-class-section #timetablePanel .timetable-table {
    min-width: 0;
  }

  body.print-class-section #timetablePanel .timetable-input,
  body.print-class-section #timetablePanel .period-time-input {
    padding: 2px;
    background: #fff;
    border: 0;
  }

  body.print-class-section .section-print-target [data-export-ignore],
  body.print-class-section .section-print-target .role-delete {
    display: none !important;
  }

  body.print-class-section .class-management-panel .panel-head {
    flex-direction: row;
    align-items: flex-start;
  }

  body.print-class-section .duty-row,
  body.print-class-section .class-rule-item,
  body.print-class-section .role-item {
    break-inside: avoid;
  }

  body.print-seating { background: #fff; }
  body.print-seating .sidebar,
  body.print-seating .topbar,
  body.print-seating .view:not(#seatingView),
  body.print-seating .seat-toolbar,
  body.print-seating .seat-sidebar,
  body.print-seating .board-note,
  body.print-seating .unseated-panel,
  body.print-seating .toast { display: none !important; }
  body.print-seating .app-shell { margin: 0; padding: 0; }
  body.print-seating #seatingView { display: block !important; }
  body.print-seating .seat-layout { display: block; }
  body.print-seating .seat-canvas-panel { padding: 0; border: 0; box-shadow: none; }
  body.print-seating .seat-board { min-width: 0; padding: 8px; overflow: visible; background: #fff; border: 0; }
  body.print-seating .seat-cell { min-height: 62px; break-inside: avoid; }
}
