:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #14221f;
  --muted: #61706c;
  --line: #dce4e1;
  --green: #16856a;
  --green-soft: #e5f4ef;
  --amber: #c87a1d;
  --amber-soft: #fff0d8;
  --red: #b64038;
  --red-soft: #fde7e5;
  --blue: #2868a8;
  --blue-soft: #e7f0fb;
  --shadow: 0 14px 36px rgba(28, 43, 38, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #10251f;
  color: #eff8f4;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #e2b75d;
  color: #10251f;
  font-weight: 800;
}

.brand-title {
  font-size: 18px;
  font-weight: 750;
}

.brand-subtitle {
  margin-top: 2px;
  color: #9bb4ad;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  background: transparent;
  color: #cbd8d4;
  padding: 0 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-icon {
  width: 22px;
  color: #e2b75d;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px 18px;
}

.role-switch {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.role {
  height: 32px;
  border-radius: 6px;
  background: transparent;
  color: #cbd8d4;
  font-size: 12px;
}

.role.active {
  background: #eff8f4;
  color: #10251f;
}

.operator {
  margin-top: 12px;
  color: #9bb4ad;
  font-size: 12px;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 247, 0.92);
  backdrop-filter: blur(12px);
}

.topbar.hidden {
  display: none;
}

.filters {
  display: flex;
  gap: 8px;
  align-items: end;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  min-width: 0;
}

select,
input,
textarea {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 9px;
  outline: none;
  font-size: 13px;
}

textarea {
  min-height: 86px;
  resize: vertical;
  padding: 10px 11px;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 133, 106, 0.12);
}

.search-box input {
  width: 200px;
}

.primary-action {
  min-height: 38px;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 720;
}

.page {
  display: none;
  padding: 26px 28px 36px;
}

.page.active {
  display: block;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 760;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 750;
}

h3 {
  margin: 18px 0 10px;
  font-size: 14px;
}

.page-heading p {
  margin-top: 8px;
  color: var(--muted);
}

.heading-actions {
  display: flex;
  flex-shrink: 0;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}

.heading-actions button,
.panel-title button,
.page-heading > button,
.form-actions button,
.drawer-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  font-weight: 680;
  white-space: nowrap;
}

.ai-action-button,
.ai-inline-button {
  border-color: rgba(35, 94, 168, 0.2) !important;
  background: #eef5ff !important;
  color: #235ea8 !important;
}

.week-actions {
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 4px;
}

.week-actions button {
  min-width: auto;
  min-height: 34px;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.week-actions button:first-child {
  background: var(--green);
  color: white;
  box-shadow: 0 6px 14px rgba(0, 130, 118, 0.16);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric span,
.metric small {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 34px;
  line-height: 1;
}

.metric.good strong {
  color: var(--green);
}

.metric.warn strong {
  color: var(--amber);
}

.metric.accent strong {
  color: var(--blue);
}

.metric.danger strong {
  color: var(--red);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.7fr);
  gap: 16px;
}

.panel,
.form-panel,
.profile-main,
.profile-side {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 12px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

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

.data-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-align: left;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  white-space: nowrap;
}

.data-table.selectable th:first-child,
.data-table.selectable td:first-child {
  width: 34px;
  padding-right: 4px;
}

.data-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  accent-color: var(--green);
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tfoot td {
  border-top: 2px solid var(--line);
  border-bottom: 0;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 800;
}

.data-table tfoot td:first-child {
  color: var(--muted);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 720;
}

.tag.good {
  background: var(--green-soft);
  color: var(--green);
}

.tag.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.tag.danger {
  background: var(--red-soft);
  color: var(--red);
}

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

.todo-item {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 0 12px;
  text-align: left;
}

.todo-item strong {
  color: var(--green);
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
}

.dot.accent {
  background: var(--blue);
}

.dot.warn {
  background: var(--amber);
}

.dot.danger {
  background: var(--red);
}

.segmented,
.tabs,
.filter-row {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segmented button,
.tabs button,
.filter-row button {
  min-height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.segmented button.active,
.tabs button.active,
.filter-row button.active {
  background: #10251f;
  color: #ffffff;
}

.schedule-board {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.schedule-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.schedule-note span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 720;
}

.hour-header,
.seat-row {
  display: grid;
  grid-template-columns: 120px repeat(9, 88px);
  min-width: 912px;
}

.hour-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.hour-header > div {
  min-height: 36px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 780;
}

.seat-row {
  position: relative;
  min-height: 78px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(to right, transparent 0 119px, var(--line) 119px 120px, transparent 120px),
    repeating-linear-gradient(to right, transparent 0 87px, var(--line) 87px 88px);
  background-position: 0 0, 120px 0;
  background-size: auto, 88px 100%;
}

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

.seat-label {
  grid-column: 1;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  align-items: center;
  min-height: 78px;
  background: #fbfcfc;
  border-right: 1px solid var(--line);
  color: var(--muted);
}

.seat-label strong {
  color: var(--ink);
  font-size: 16px;
}

.seat-label span {
  font-size: 12px;
  font-weight: 760;
}

.task-card {
  display: grid;
  align-content: center;
  gap: 4px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
}

.hour-block {
  z-index: 1;
  align-self: stretch;
  min-height: 0;
  margin: 5px 3px;
  border: 1px solid rgba(20, 34, 31, 0.08);
  border-radius: 7px;
  box-shadow: 0 6px 14px rgba(20, 34, 31, 0.06);
}

.start-08 {
  grid-column-start: 2;
}

.start-09 {
  grid-column-start: 3;
}

.start-10 {
  grid-column-start: 4;
}

.start-11 {
  grid-column-start: 5;
}

.start-12 {
  grid-column-start: 6;
}

.start-13 {
  grid-column-start: 7;
}

.start-14 {
  grid-column-start: 8;
}

.start-15 {
  grid-column-start: 9;
}

.span-1 {
  grid-column-end: span 1;
}

.span-2 {
  grid-column-end: span 2;
}

.task-card strong {
  font-size: 15px;
}

.task-card span {
  color: var(--muted);
  font-size: 12px;
}

.task-card small {
  width: fit-content;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 700;
}

.task-card.present small,
.week-cell.present {
  background: var(--green-soft);
  color: var(--green);
}

.task-card.pending small,
.week-cell.pending {
  background: var(--blue-soft);
  color: var(--blue);
}

.task-card.incomplete small,
.week-cell.incomplete {
  background: var(--amber-soft);
  color: var(--amber);
}

.task-card.absent small,
.week-cell.absent {
  background: #eef0f0;
  color: var(--muted);
}

.week-grid {
  display: grid;
  grid-template-columns: 110px repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.week-cell {
  min-height: 74px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px;
  line-height: 1.45;
  font-weight: 700;
}

.week-cell.header {
  background: var(--surface-2);
  color: var(--muted);
}

.week-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: -4px 0 14px;
}

.week-toolbar input {
  width: 160px;
}

.capacity,
.compact-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.capacity span,
.compact-hint span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 720;
}

.compact-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.compact-add-seat {
  height: 30px;
  border: 1px solid rgba(0, 130, 118, 0.24);
  border-radius: 8px;
  background: var(--green);
  color: white;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 780;
  cursor: pointer;
}

.compact-week-board {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.compact-header,
.compact-row {
  display: grid;
  grid-template-columns: 72px repeat(5, 118px);
  min-width: 662px;
}

.compact-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.compact-header > div {
  min-height: 28px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 780;
}

.compact-row {
  position: relative;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(to right, transparent 0 71px, var(--line) 71px 72px, transparent 72px),
    repeating-linear-gradient(to right, transparent 0 117px, var(--line) 117px 118px);
  background-position: 0 0, 72px 0;
  background-size: auto, 118px 100%;
}

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

.compact-seat {
  z-index: 1;
  grid-column: 1;
  display: grid;
  place-content: center;
  min-height: 46px;
  background: #fbfcfc;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-weight: 780;
  line-height: 1.25;
  text-align: center;
}

.compact-seat span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.mini-task {
  z-index: 1;
  align-self: stretch;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 3px;
  margin: 3px 2px;
  border: 1px solid rgba(20, 34, 31, 0.08);
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--ink);
  padding: 4px;
  font-size: 11px;
  font-weight: 780;
  line-height: 1.25;
  text-align: left;
  box-shadow: 0 6px 14px rgba(20, 34, 31, 0.06);
  cursor: pointer;
}

.mini-task.present {
  background: var(--green-soft);
}

.mini-task.waiting,
.mini-task.pending {
  background: var(--amber-soft);
}

.mini-task.incomplete {
  background: var(--amber-soft);
}

.mini-task.absent {
  background: var(--amber-soft);
}

.mini-task strong {
  overflow: hidden;
  font-size: 10px;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: keep-all;
}

.result-fields {
  display: grid;
  grid-template-columns: 20px 22px minmax(0, 1fr);
  gap: 2px;
  align-self: end;
  width: 100%;
  max-width: 100%;
}

.result-fields label {
  display: grid;
  min-width: 0;
  text-align: center;
}

.result-fields input,
.result-toggle {
  width: 100%;
  min-width: 0;
  min-height: 17px;
  border: 1px solid rgba(20, 34, 31, 0.14);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.8);
  padding: 0 3px;
  font-size: 9px;
  font-weight: 760;
  text-align: center;
}

.result-toggle {
  color: var(--danger);
  cursor: pointer;
}

.result-toggle.done {
  border-color: rgba(0, 130, 118, 0.22);
  background: var(--green-soft);
  color: var(--green);
}

.result-fields span {
  display: none;
}

.summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.summary-bar span {
  border-radius: 8px;
  background: var(--surface-2);
  padding: 7px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.review-overview {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.review-controls {
  display: grid;
  grid-template-columns: repeat(8, minmax(58px, 1fr));
  gap: 5px;
}

.finance-tabs {
  margin-bottom: 14px;
}

.finance-filter-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(58px, 1fr));
  gap: 5px;
  margin-bottom: 10px;
}

.compact-filter {
  grid-template-columns: repeat(8, minmax(58px, 1fr));
}

.order-filter-grid {
  grid-template-columns: repeat(10, minmax(52px, 1fr));
}

.finance-filter-grid label,
.review-controls label {
  gap: 2px;
  min-width: 0;
  font-size: 9px;
  font-weight: 760;
}

.finance-filter-grid select,
.finance-filter-grid input,
.review-controls select,
.review-controls input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 0 5px;
  overflow: hidden;
  font-size: 10px;
  font-weight: 760;
  text-overflow: ellipsis;
}

.finance-subgrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.consume-action-bar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  margin-bottom: 14px;
  padding: 10px;
}

.consume-action-bar label {
  display: grid;
  gap: 4px;
  min-width: 150px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
}

.consume-action-bar input {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 6px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 760;
}

.consume-action-bar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.panel-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.teaching-review-list {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.subject-review-row {
  display: grid;
  grid-template-columns: 140px minmax(560px, 1fr) 82px;
  gap: 7px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 7px;
  overflow-x: auto;
}

.subject-review-meta {
  display: grid;
  gap: 3px;
}

.subject-review-meta strong {
  font-size: 14px;
}

.subject-review-meta span {
  color: var(--ink);
  font-size: 11px;
  font-weight: 760;
}

.subject-review-meta small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.course-track {
  display: grid;
  grid-template-columns: repeat(17, minmax(35px, 1fr));
  gap: 3px;
  min-width: 650px;
}

.course-track.compact-track {
  grid-template-columns: repeat(12, minmax(36px, 1fr));
  min-width: 470px;
}

.track-cell {
  display: grid;
  gap: 1px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 2px;
  text-align: center;
}

.track-cell b {
  font-size: 10px;
  line-height: 1;
}

.track-cell span {
  font-size: 8px;
  font-weight: 760;
  line-height: 1.15;
}

.track-cell em {
  font-style: normal;
  cursor: pointer;
}

.track-cell.done {
  background: var(--green-soft);
  color: var(--green);
}

.track-cell.current {
  background: var(--blue-soft);
  color: var(--blue);
}

.track-cell.warn,
.track-cell.due {
  background: var(--amber-soft);
  color: var(--warn);
}

.track-cell.future {
  background: #f6f8f7;
  color: var(--muted);
}

.subject-review-action {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.filter-row {
  margin-bottom: 14px;
}

.hours {
  width: 48px;
  min-height: 32px;
  text-align: center;
}

.table-select {
  min-height: 32px;
  width: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 720;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pager button,
.pager strong {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 6px 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
}

.row-action {
  min-height: 32px;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--green);
  color: white;
  font-size: 12px;
  font-weight: 760;
}

.muted-action {
  background: var(--surface-2);
  color: var(--ink);
}

.danger-action {
  background: #fff0ee;
  color: var(--danger);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  margin-bottom: 16px;
}

.settings-grid .panel:first-child {
  grid-column: 1 / -1;
}

.login-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.login-preview label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.login-preview input,
.login-preview select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 10px;
  color: var(--ink);
  font-weight: 760;
}

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

.settings-form label {
  display: grid;
  gap: 6px;
}

.settings-form label:first-of-type,
.settings-form label:last-of-type {
  grid-column: 1 / -1;
}

.settings-empty {
  color: var(--muted);
  text-align: center;
}

.refund-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.refund-summary label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.refund-summary input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 10px;
  color: var(--ink);
  font-weight: 760;
}

.detail-payment-log {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}

.setting-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.setting-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.setting-card h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.setting-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.setting-card span,
.setting-card button {
  border-radius: 8px;
  background: var(--surface-2);
  padding: 7px 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 720;
}

.setting-card button {
  border: 1px solid var(--line);
  cursor: pointer;
}

.attention-row {
  background: #fff9f8;
}

.student-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 12px;
}

.profile-main,
.profile-side,
.form-panel {
  padding: 14px;
}

.student-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.student-head h2 {
  font-size: 22px;
}

.student-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.student-ai-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 250px;
}

.student-ai-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
}

.subject-accounts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.subject-account {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 10px;
}

.subject-account strong {
  font-size: 13px;
}

.subject-account span,
.subject-account small {
  color: var(--muted);
  font-size: 12px;
}

.detail-tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}

.detail-tabs button {
  min-height: 30px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 720;
}

.detail-tabs .active {
  background: #10251f;
  color: #ffffff;
}

.teaching-tabs {
  margin-bottom: 12px;
}

.quality-panel {
  margin-bottom: 14px;
}

.quality-filter {
  margin-bottom: 10px;
}

.quality-panel .panel-title p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.quality-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.quality-metrics span {
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 780;
}

.quality-metrics strong {
  color: var(--ink);
  font-size: 16px;
}

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

.quality-grid article {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 10px;
}

.quality-grid h3 {
  margin: 0;
  font-size: 14px;
}

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

.quality-card-head button {
  min-height: 26px;
  border-radius: 6px;
  background: var(--surface-2);
  padding: 0 8px;
  font-size: 11px;
  font-weight: 760;
}

.quality-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.quality-row {
  display: grid;
  grid-template-columns: 1fr 34px 54px 68px;
  gap: 6px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 7px;
  font-size: 11px;
}

.quality-row strong {
  color: var(--green);
  text-align: center;
}

.quality-row em {
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--warn);
  padding: 4px 5px;
  font-style: normal;
  font-weight: 780;
  text-align: center;
}

.quality-row.danger {
  border-radius: 7px;
  background: rgba(193, 65, 58, 0.08);
  padding: 7px 6px;
}

.quality-row.danger strong {
  color: #c1413a;
}

.quality-row.danger em {
  background: rgba(193, 65, 58, 0.12);
  color: #c1413a;
}

.ai-inline-button {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 780;
}

.quality-formula {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.lesson-overview {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.lesson-overview-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.lesson-overview-head h3 {
  font-size: 16px;
}

.lesson-overview-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.lesson-grid {
  display: grid;
  grid-template-columns: 58px repeat(3, minmax(74px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.lesson-head,
.lesson-cell {
  min-height: 32px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px;
  font-size: 11px;
  font-weight: 760;
  text-align: center;
}

.lesson-head:nth-child(4n),
.lesson-cell:nth-child(4n) {
  border-right: 0;
}

.lesson-cell:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.lesson-head {
  background: #f6f8f7;
  color: var(--muted);
}

.lesson-cell {
  background: #fff;
  color: var(--ink);
}

.lesson-no {
  background: #fbfcfc;
}

.lesson-no.current {
  background: var(--blue-soft);
  color: var(--blue);
}

.lesson-no.future,
.lesson-cell.empty {
  color: var(--muted);
}

.lesson-cell.done {
  background: var(--green-soft);
  color: var(--green);
}

.lesson-cell.pending {
  background: var(--blue-soft);
  color: var(--blue);
}

.lesson-cell.warn,
.lesson-cell.due {
  background: var(--amber-soft);
  color: var(--amber);
}

.lesson-detail {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 9px;
}

.lesson-detail span {
  color: var(--muted);
  font-size: 12px;
}

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

.record-panels article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 8px;
}

.record-panels h3 {
  margin: 0 0 4px;
  font-size: 13px;
}

.record-panels p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.record-panels button {
  margin-top: 6px;
}

.profile-side p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.side-section {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 10px;
}

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

.side-section-head h3 {
  margin: 0;
}

.side-section-head button {
  border-radius: 8px;
  background: var(--surface-2);
  padding: 6px 9px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

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

.mini-record-list article {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 10px;
}

.mini-record-list strong {
  font-size: 13px;
}

.mini-record-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.form-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.form-panel .full,
.form-actions {
  grid-column: 1 / -1;
}

.order-lines {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 14px;
}

.order-lines-head,
.order-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.order-lines-head h3 {
  font-size: 18px;
}

.order-lines-head p,
.order-card-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.order-lines-head button,
.add-term {
  min-height: 34px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 760;
}

.order-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

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

.allocation-check {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 760;
}

.allocation-check span {
  color: var(--muted);
  font-weight: 680;
}

.allocation-check.good {
  background: #e6f6ef;
  color: var(--green);
}

.allocation-check.warn {
  background: #fff1d6;
  color: var(--amber);
}

.payment-grid {
  display: grid;
  grid-template-columns: 1fr 0.8fr 0.9fr 0.9fr 0.9fr 1fr 1.2fr;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--ink);
  font-size: 13px;
}

.payment-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.term-grid {
  display: grid;
  grid-template-columns: 0.8fr 0.7fr 0.8fr 1fr 1fr 0.8fr 0.9fr;
  gap: 8px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
}

.term-head {
  border-top: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.add-term {
  justify-self: start;
  margin-top: 2px;
}

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

.task-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: 430px;
  height: 100vh;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: -18px 0 42px rgba(20, 34, 31, 0.16);
  transform: translateX(105%);
  transition: transform 0.22s ease;
}

.task-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-header button,
.modal-header button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.drawer-section {
  display: grid;
  gap: 10px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

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

.choice {
  min-height: 34px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  padding: 0 12px;
  font-weight: 720;
}

.choice.active {
  background: var(--green-soft);
  color: var(--green);
}

.grid-two {
  grid-template-columns: 1fr 1fr;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 22px;
}

.drawer-actions .primary-action,
.form-actions .primary-action {
  border: 0;
  background: var(--green);
  color: #fff;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  place-items: center;
  background: rgba(15, 28, 24, 0.36);
}

.modal.open {
  display: grid;
}

.modal-card {
  width: 440px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(14, 26, 22, 0.24);
  padding: 20px;
}

.wide-modal {
  width: min(680px, calc(100vw - 40px));
}

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

.modal-card p {
  color: var(--muted);
  margin-bottom: 14px;
}

.check-list,
.rule-box {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.rule-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 14px;
}

.rule-box span {
  color: var(--muted);
  font-size: 14px;
}

.danger-box {
  border-color: rgba(193, 65, 58, 0.22);
  background: #fff7f5;
}

.danger-box strong {
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  min-height: 42px;
  border-radius: 8px;
  background: #10251f;
  color: #fff;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  body {
    min-width: 0;
  }

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

  .sidebar {
    min-height: auto;
  }

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

  .topbar,
  .page-heading,
  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .two-column,
  .student-profile,
  .form-panel,
  .subject-accounts,
  .finance-subgrid,
  .finance-filter-grid,
  .review-controls,
  .quality-grid,
  .login-preview,
  .refund-summary,
  .record-panels,
  .settings-grid,
  .setting-cards {
    grid-template-columns: 1fr;
  }

  .consume-action-bar,
  .table-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .subject-review-row {
    grid-template-columns: 1fr;
  }

  .subject-review-action {
    justify-items: start;
  }

  .schedule-board,
  .data-table {
    overflow-x: auto;
  }

  .hour-header,
  .seat-row {
    grid-template-columns: 120px repeat(9, 88px);
    min-width: 912px;
  }

  .seat-row {
    background:
      linear-gradient(to right, transparent 0 119px, var(--line) 119px 120px, transparent 120px),
      repeating-linear-gradient(to right, transparent 0 87px, var(--line) 87px 88px);
    background-position: 0 0, 120px 0;
    background-size: auto, 96px 100%;
  }

  .task-drawer {
    width: 100%;
  }
}
