:root {
  color-scheme: light;
  --bg: #f4fafd;
  --surface: #ffffff;
  --surface-soft: #eef5f7;
  --surface-raised: #ffffff;
  --ink: #161d1f;
  --muted: #5d6370;
  --line: #c4c5d5;
  --primary: #002068;
  --primary-strong: #00164e;
  --primary-soft: #dce1ff;
  --action: #e90614;
  --action-strong: #bc000c;
  --action-soft: #ffdad5;
  --amber: #8a5a00;
  --amber-soft: #fff2d5;
  --rose: #bc000c;
  --rose-soft: #ffdad5;
  --blue: #153ea3;
  --blue-soft: #dce1ff;
  --shadow: 0 4px 12px rgba(0, 32, 104, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  box-sizing: border-box;
  font: inherit;
}

button {
  cursor: pointer;
}

input {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

button,
select,
textarea {
  max-width: 100%;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(0, 32, 104, 0.18);
  outline-offset: 2px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(0, 32, 104, 0.1), transparent 44%),
    var(--bg);
}

.login-card {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 24px;
  border-top: 5px solid var(--primary);
}

.login-brand {
  margin-bottom: 28px;
}

.login-card .brand strong {
  color: var(--primary);
}

.login-card .brand span {
  color: var(--muted);
}

.login-heading {
  margin-bottom: 18px;
}

.login-heading h1 {
  font-size: 28px;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--rose);
  font-size: 13px;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  border-right: 0;
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: #fff;
  object-fit: cover;
  padding: 3px;
  flex: 0 0 auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.brand strong,
.brand span,
.teacher-card strong,
.teacher-card span {
  display: block;
}

.brand strong {
  font-size: 16px;
  color: inherit;
}

.brand span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  margin-top: 3px;
}

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

.account-switch {
  display: grid;
  gap: 8px;
}

.account-switch p {
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 700;
}

.account-button {
  width: 100%;
  min-height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  text-align: left;
}

.account-button strong,
.account-button span {
  display: block;
}

.account-button span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.account-button.active,
.account-button:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
}

.logout-button {
  width: 100%;
}

.nav-item {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item span {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  line-height: 1;
}

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

.nav-item.active span {
  background: var(--action);
  color: #fff;
}

.teacher-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.is-hidden {
  display: none !important;
}

.teacher-card p {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.teacher-card strong {
  font-size: 20px;
}

.teacher-card span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
}

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

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

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

.top-actions,
.action-row,
.segmented {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.top-logout-button {
  border-color: var(--action);
  color: var(--action);
}

.notice-bar {
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.notice-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.notice-heading h2 {
  margin-bottom: 0;
}

.notice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.notice-item {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notice-item.warning {
  background: var(--action-soft);
  border-color: rgba(188, 0, 12, 0.28);
}

.notice-item span,
.schedule-main span,
.schedule-time span,
.schedule-stat span,
.schedule-stat small,
.schedule-day header span {
  color: var(--muted);
}

.notice-item span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.notice-item strong {
  display: block;
  font-size: 15px;
  margin-bottom: 5px;
}

.notice-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.notification-center {
  display: grid;
  gap: 14px;
}

.notification-mail-list {
  display: grid;
  gap: 12px;
}

.mail-notice {
  min-height: 116px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: var(--surface);
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.mail-notice.selected {
  border-left-color: var(--action);
  background: #fffdfb;
}

.mail-notice-meta,
.mail-notice-body {
  display: grid;
  align-content: start;
  gap: 8px;
}

.mail-notice-meta span:not(.tag),
.mail-notice-meta time,
.mail-notice-body p {
  color: var(--muted);
}

.mail-notice-meta time {
  font-size: 13px;
}

.mail-notice-body strong {
  font-size: 18px;
}

.mail-notice-body p {
  margin: 0;
  line-height: 1.65;
}

.primary-button,
.ghost-button,
.segment {
  min-height: 42px;
  border-radius: 4px;
  border: 1px solid transparent;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-button {
  background: var(--action);
  color: #fff;
  border-color: var(--action);
  box-shadow: 0 6px 16px rgba(188, 0, 12, 0.14);
}

.primary-button:hover {
  background: var(--action-strong);
  border-color: var(--action-strong);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ghost-button {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--line);
}

.ghost-button:hover {
  border-color: rgba(0, 32, 104, 0.38);
  color: var(--primary-strong);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

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

.metric {
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.metric span,
.metric small,
.pay-preview span,
.salary-total span,
.workload-item span {
  color: var(--muted);
}

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

.metric.alert strong {
  color: var(--rose);
}

.dashboard-layout,
.confirm-layout,
.scanner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 16px;
  margin-bottom: 16px;
}

.finance-group-panel {
  margin-bottom: 16px;
}

.admin-schedule-scope-panel,
.constraint-panel,
.teacher-pool-panel,
.teacher-rule-panel,
.schedule-generate-panel {
  margin-bottom: 16px;
}

.admin-scope-summary {
  margin-bottom: 0;
}

.admin-schedule-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
  margin-bottom: 16px;
}

.admin-schedule-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.admin-schedule-selectors {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-schedule-selectors .field-label {
  margin-bottom: 0;
}

.admin-schedule-selectors .field-label span {
  display: block;
  margin-bottom: 8px;
}

.admin-schedule-selectors .lesson-select {
  margin-bottom: 0;
}

.schedule-adjust-panel,
.schedule-change-panel {
  margin-bottom: 16px;
}

.schedule-adjust-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.schedule-adjust-grid .field-label {
  margin-bottom: 0;
}

.schedule-adjust-grid .field-label span {
  display: block;
  margin-bottom: 8px;
}

.schedule-adjust-grid .lesson-select {
  margin-bottom: 0;
}

.teacher-import-panel,
.import-feedback-panel {
  margin-bottom: 16px;
}

.import-textarea {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  resize: vertical;
  line-height: 1.55;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
}

.import-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

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

.import-message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}

.import-message.error {
  border-color: rgba(188, 0, 12, 0.24);
  background: var(--rose-soft);
}

.import-message.warning {
  border-color: rgba(138, 90, 0, 0.24);
  background: var(--amber-soft);
}

.import-message strong,
.import-message span {
  display: block;
}

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

.rule-list,
.course-rule-list,
.subject-config-list,
.constraint-list,
.conflict-list,
.teacher-rule-list,
.change-request-list {
  display: grid;
  gap: 10px;
}

.rule-list div,
.course-rule-item,
.constraint-item,
.subject-config-item,
.teacher-rule-item,
.change-request-item,
.check-success {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px 14px;
}

.rule-list strong,
.course-rule-item strong,
.constraint-item strong,
.subject-config-item strong,
.teacher-rule-item strong,
.change-request-item strong,
.check-success strong,
.check-success span {
  display: block;
}

.rule-list p,
.constraint-item p,
.subject-config-item p,
.teacher-rule-item p,
.change-request-item p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.course-rules-panel {
  margin-bottom: 16px;
}

.course-rule-list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
  margin-bottom: 12px;
}

.course-rule-item {
  display: grid;
  gap: 10px;
  align-items: stretch;
}

.course-rule-top {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) minmax(84px, 96px) minmax(132px, 150px) auto;
  gap: 10px;
  align-items: end;
}

.course-rule-item:not(.editing) .course-rule-top {
  grid-template-columns: minmax(112px, 1fr) minmax(84px, 96px) minmax(132px, 150px);
}

.course-rule-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.course-rule-constraint-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

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

.course-builder {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 120px 160px auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  margin-bottom: 12px;
}

.course-builder .field-label {
  margin-bottom: 0;
}

.course-builder .field-label span {
  display: block;
  margin-bottom: 8px;
}

.course-rule-name {
  align-self: center;
  min-width: 0;
}

.course-rule-name small,
.constraint-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.compact-field input {
  min-width: 0;
  width: 100%;
}

.input-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}

.input-with-unit:focus-within {
  outline: 2px solid rgba(0, 32, 104, 0.18);
  outline-offset: 2px;
}

.input-with-unit input {
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding-right: 4px;
}

.input-with-unit input:focus {
  outline: 0;
}

.input-with-unit em {
  padding: 0 10px 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  white-space: nowrap;
}

.compact-actions {
  margin-bottom: 12px;
}

.subsection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 10px;
}

.subsection-heading strong,
.subsection-heading span {
  display: block;
}

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

.constraint-builder {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 140px 160px minmax(180px, 1.2fr) auto;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  margin-bottom: 12px;
}

.constraint-builder .field-label {
  margin-bottom: 0;
}

.constraint-builder .field-label span {
  display: block;
  margin-bottom: 8px;
}

.teacher-rule-builder {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  margin-bottom: 12px;
}

.teacher-rule-builder .field-label {
  margin-bottom: 0;
}

.teacher-rule-builder .field-label span {
  display: block;
  margin-bottom: 8px;
}

.teacher-rule-item {
  display: grid;
  gap: 6px;
}

.teacher-rule-item span,
.change-request-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.change-request-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

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

.constraint-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.constraint-item-content {
  display: grid;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.constraint-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.constraint-item .constraint-rule-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(0, 32, 104, 0.16);
  border-radius: 999px;
  background: #eef4ff;
  padding: 0 9px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.constraint-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.constraint-item .constraint-detail-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 9px 10px;
  min-width: 0;
}

.constraint-item .constraint-detail-card em {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.constraint-item .constraint-detail-card strong {
  color: var(--text);
  line-height: 1.35;
}

.constraint-item .constraint-effect,
.constraint-item .constraint-reason {
  margin: 0;
}

.constraint-item .constraint-effect {
  color: var(--text);
}

.constraint-item .constraint-reason {
  color: var(--muted);
}

.subject-config-item {
  display: grid;
  gap: 12px;
}

.subject-config-item span,
.check-success span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.subject-config-head,
.subject-config-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.subject-config-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.subject-config-meta span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0 10px;
  margin-top: 0;
  color: var(--muted);
}

.teacher-pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.teacher-pool-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
  cursor: pointer;
}

.teacher-pool-card:has(input:checked) {
  border-color: var(--primary);
  background: #eef7f3;
}

.teacher-pool-card input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.teacher-pool-card strong,
.teacher-pool-card small {
  display: block;
}

.teacher-pool-card small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.subject-config-actions {
  color: var(--muted);
  font-size: 13px;
}

.selected-teacher-pool {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.teacher-pool-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7faf9;
}

.teacher-pool-summary-head strong,
.teacher-pool-summary-head span,
.teacher-pool-summary-subject strong,
.teacher-pool-summary-subject span {
  display: block;
}

.teacher-pool-summary-head span,
.teacher-pool-summary-subject span {
  color: var(--muted);
  font-size: 13px;
}

.teacher-pool-summary-list {
  display: grid;
}

.teacher-pool-summary-row {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(0, 1fr);
  gap: 12px;
  padding: 12px 14px;
}

.teacher-pool-summary-row + .teacher-pool-summary-row {
  border-top: 1px solid var(--line);
}

.teacher-pool-summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.teacher-pool-summary-tag,
.teacher-pool-summary-empty {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 0 10px;
  font-size: 13px;
}

.teacher-pool-summary-tag small {
  color: var(--muted);
  font-size: 12px;
}

.teacher-pool-summary-empty {
  color: var(--muted);
  border-style: dashed;
}

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

.conflict-panel {
  margin-bottom: 16px;
}

.check-success {
  border-color: rgba(0, 32, 104, 0.18);
  background: #eef7f4;
}

.schedule-panel {
  display: grid;
  gap: 16px;
}

.schedule-toolbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.schedule-toolbar strong,
.schedule-toolbar span,
.schedule-toolbar p,
.week-select-label span {
  display: block;
}

.schedule-toolbar strong {
  font-size: 20px;
}

.schedule-toolbar p {
  margin: 4px 0 0;
}

.week-select-label {
  min-width: min(320px, 100%);
}

.week-select-label .lesson-select {
  margin: 6px 0 0;
}

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

.schedule-stat {
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
  display: grid;
  align-content: space-between;
}

.schedule-stat strong {
  color: var(--primary);
  font-size: 24px;
}

.schedule-stat span,
.schedule-stat small {
  font-size: 13px;
}

.schedule-list {
  display: grid;
  gap: 14px;
}

.schedule-day {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.schedule-day header {
  min-height: 62px;
  padding: 12px 14px;
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.schedule-day header strong,
.schedule-day header span {
  display: block;
}

.schedule-items {
  display: grid;
}

.schedule-item {
  min-height: 74px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.schedule-item:last-child {
  border-bottom: 0;
}

.schedule-time strong,
.schedule-time span {
  display: block;
}

.schedule-time strong {
  color: var(--primary);
  font-size: 20px;
}

.schedule-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.schedule-main strong,
.schedule-main span {
  overflow-wrap: anywhere;
}

.schedule-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(160px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.schedule-week-grid.teacher-week-grid {
  grid-template-columns: 1fr;
  overflow: visible;
  padding-bottom: 0;
}

.teacher-week-grid .schedule-day-strip {
  display: none;
}

.teacher-week-grid .schedule-agenda-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(160px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.schedule-day-pill {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  padding: 10px;
  display: grid;
  gap: 2px;
  text-align: center;
}

.schedule-day-pill.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.schedule-day-pill.active span,
.schedule-day-pill.active small {
  color: rgba(255, 255, 255, 0.82);
}

.schedule-day-pill span,
.schedule-day-pill small {
  color: var(--muted);
  font-size: 12px;
}

.schedule-day-pill strong {
  font-size: 17px;
  line-height: 1.1;
}

.schedule-day-pill.today {
  border-color: rgba(188, 0, 12, 0.34);
  background: var(--action-soft);
}

.schedule-day-pill.today.active {
  border-color: var(--action);
  background: var(--action);
}

.schedule-day-focus {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.schedule-day-focus.today {
  border-color: rgba(188, 0, 12, 0.34);
}

.schedule-day-focus > header {
  min-height: 58px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 2px;
}

.schedule-day-focus.today > header {
  background: var(--action-soft);
}

.schedule-day-focus > header span,
.schedule-day-focus > header small {
  color: var(--muted);
  font-size: 12px;
}

.schedule-day-timeline {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 8px;
  background: var(--surface);
}

.schedule-day-timeline::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 82px;
  width: 2px;
  background: rgba(0, 32, 104, 0.16);
}

.schedule-timeline-event {
  position: relative;
  min-height: 58px;
  border: 1px solid rgba(0, 32, 104, 0.16);
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 8px 10px 8px 12px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  overflow: hidden;
}

.schedule-timeline-event::before {
  content: "";
  position: absolute;
  left: 61px;
  top: 50%;
  width: 8px;
  height: 8px;
  border: 2px solid var(--primary);
  border-radius: 999px;
  background: #fff;
  transform: translate(-50%, -50%);
}

.schedule-timeline-event.completed {
  border-left-color: #1e7c58;
}

.schedule-timeline-event.completed::before {
  border-color: #1e7c58;
}

.schedule-timeline-event.exception {
  border-left-color: var(--action);
}

.schedule-timeline-event.exception::before {
  border-color: var(--action);
}

.schedule-timeline-event.checkedIn {
  border-left-color: var(--amber);
}

.schedule-timeline-event.checkedIn::before {
  border-color: var(--amber);
}

.schedule-timeline-time strong,
.schedule-timeline-time span,
.schedule-timeline-main strong,
.schedule-timeline-main span {
  display: block;
}

.schedule-timeline-time strong {
  color: var(--primary);
  font-size: 16px;
}

.schedule-timeline-time span,
.schedule-timeline-main span {
  color: var(--muted);
  font-size: 12px;
}

.schedule-timeline-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-left: 4px;
}

.schedule-timeline-main strong {
  font-size: 15px;
}

.schedule-timeline-main strong,
.schedule-timeline-main span {
  overflow-wrap: anywhere;
}

.schedule-timeline-action {
  display: flex;
  justify-content: flex-end;
}

.schedule-timeline-action .tag {
  min-height: 22px;
  padding: 0 7px;
  white-space: nowrap;
}

.timeline-empty {
  margin: 12px;
}

.schedule-column {
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.schedule-column.today {
  border-color: rgba(188, 0, 12, 0.34);
}

.schedule-column header {
  min-height: 72px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 3px;
}

.schedule-column.today header {
  background: var(--action-soft);
}

.schedule-column header span,
.schedule-column header strong,
.schedule-column header small {
  display: block;
}

.schedule-column header span,
.schedule-column header small {
  color: var(--muted);
  font-size: 12px;
}

.schedule-column .schedule-items {
  padding: 8px;
  gap: 8px;
}

.schedule-column .schedule-item {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}

.schedule-column .schedule-time {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.schedule-column .schedule-time strong {
  font-size: 16px;
}

.admin-schedule-slots {
  gap: 6px;
}

.schedule-slot-drop {
  min-height: 92px;
  border: 1px dashed #d4dce2;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.schedule-slot-drop:hover {
  border-color: rgba(0, 32, 104, 0.35);
  background: #f6f9ff;
}

.schedule-slot-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.schedule-slot-label strong,
.schedule-slot-label span {
  display: block;
}

.schedule-slot-content {
  display: grid;
  gap: 6px;
}

.schedule-empty.compact {
  min-height: 42px;
  font-size: 12px;
}

.schedule-item.draggable {
  cursor: grab;
}

.schedule-item.draggable:active {
  cursor: grabbing;
}

.schedule-column .schedule-action {
  display: flex;
  justify-content: flex-start;
}

.schedule-empty {
  min-height: 96px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

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

.panel-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.status-pill {
  min-height: 28px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.done {
  background: #e0e3e6;
  color: #25282a;
}

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

.status-pill.warning {
  background: var(--rose-soft);
  color: var(--rose);
}

.lesson-hero {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 20px;
}

.qr-visual {
  width: 168px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: #fff;
  border: 10px solid #eef1ec;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
}

.qr-visual span {
  background: var(--primary);
  border-radius: 4px;
}

.qr-visual span:nth-child(2),
.qr-visual span:nth-child(6),
.qr-visual span:nth-child(7),
.qr-visual span:nth-child(11),
.qr-visual span:nth-child(13) {
  background: var(--action);
}

.qr-visual span:nth-child(3),
.qr-visual span:nth-child(8),
.qr-visual span:nth-child(10),
.qr-visual span:nth-child(15) {
  opacity: 0.18;
}

.next-lesson-detail {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.next-lesson-detail strong {
  font-size: 24px;
  line-height: 1.25;
}

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

.detail-cell {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.detail-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.pay-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.pay-preview div,
.salary-total div,
.workload-item,
.warning-item,
.confirm-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.pay-preview div {
  min-height: 86px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.pay-preview strong,
.salary-total strong {
  font-size: 25px;
  line-height: 1.1;
}

.teacher-total-preview {
  grid-template-columns: 1fr;
}

.teacher-total-preview div {
  min-height: 112px;
  border-left: 5px solid var(--action);
  background:
    linear-gradient(135deg, rgba(233, 6, 20, 0.08), transparent 44%),
    var(--surface-soft);
}

.teacher-total-preview strong,
.teacher-pay-hero strong,
.teacher-pay-strip strong {
  color: var(--primary);
  font-size: 34px;
}

.teacher-total-preview small,
.teacher-pay-hero small,
.teacher-pay-strip small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.teacher-pay-strip {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--action);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.teacher-pay-strip span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.teacher-pay-hero div {
  min-height: 140px;
  border-left: 5px solid var(--action);
  background:
    linear-gradient(135deg, rgba(0, 32, 104, 0.08), transparent 48%),
    var(--surface-soft);
}

.salary-summary-actions {
  margin-top: 14px;
}

.salary-support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 14px;
}

.salary-support-grid article {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  display: grid;
  align-content: space-between;
  gap: 6px;
}

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

.salary-support-grid strong {
  color: var(--primary);
  font-size: 22px;
  line-height: 1.2;
}

.progress-block {
  display: grid;
  gap: 10px;
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.progress-label span {
  color: var(--muted);
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #dbe3e7;
  overflow: hidden;
}

.progress-track div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--primary);
  transition: width 180ms ease;
}

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

.table-panel .panel-heading {
  padding: 20px 20px 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
}

tbody tr:nth-child(even) {
  background: #f8fafc;
}

td {
  line-height: 1.45;
}

.row-title {
  font-weight: 700;
}

.cell-subline {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.muted {
  color: var(--muted);
}

.mini-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  white-space: nowrap;
}

.mini-button:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.mini-button.primary {
  background: var(--action);
  color: #fff;
  border-color: var(--action);
}

.mini-button.danger {
  border-color: rgba(188, 0, 12, 0.24);
  color: #9f1d26;
}

.mini-button.danger:hover {
  border-color: #9f1d26;
  background: var(--rose-soft);
}

.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.tag {
  min-height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.tag.pending {
  background: var(--action-soft);
  color: var(--action-strong);
}

.tag.completed {
  background: #e0e3e6;
  color: #25282a;
}

.tag.checkedIn {
  background: var(--blue-soft);
  color: var(--blue);
}

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

.tag.exception {
  background: var(--rose-soft);
  color: var(--rose);
}

.tag.locked {
  background: var(--blue-soft);
  color: var(--blue);
}

.segmented {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.segment {
  min-height: 32px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
}

.segment.active {
  color: var(--primary-strong);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.confirm-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.confirm-step {
  min-height: 112px;
  padding: 14px;
  display: grid;
  align-content: space-between;
}

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

.confirm-step strong {
  font-size: 16px;
  line-height: 1.35;
}

.confirm-step.active {
  border-color: rgba(0, 32, 104, 0.35);
  background: var(--primary-soft);
}

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

.workload-item {
  min-height: 62px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.workload-item strong {
  font-size: 18px;
  white-space: nowrap;
}

.salary-total {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 20px 18px;
}

.salary-total div {
  min-height: 96px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.salary-total div:first-child strong {
  color: var(--primary-strong);
}

.salary-total div:last-child strong {
  color: var(--blue);
}

.warning-list {
  display: grid;
  gap: 12px;
}

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

.finance-filter {
  min-width: 220px;
}

.finance-filter .field-label {
  margin-bottom: 6px;
}

.finance-filter .lesson-select {
  margin-bottom: 0;
}

.finance-list-toolbar,
.personnel-list-toolbar {
  display: grid;
  grid-template-columns: 150px 150px minmax(220px, 1fr) 120px auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.compact-teacher-picker {
  grid-template-columns: 150px 150px minmax(220px, 1fr) minmax(240px, 1.2fr) auto;
  margin-top: 0;
}

.personnel-list-toolbar {
  grid-template-columns: minmax(240px, 1fr) 140px 140px 140px 120px auto;
}

.finance-list-toolbar .field-label,
.personnel-list-toolbar .field-label {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
}

.compact-field {
  max-width: 150px;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.lesson-select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  margin-bottom: 16px;
}

.generated-qr {
  width: min(100%, 320px);
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  place-items: center;
  padding: 18px;
  margin-bottom: 14px;
}

.generated-qr svg {
  width: 100%;
  height: auto;
  display: block;
}

.qr-payload,
.scan-result,
.scanner-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.qr-payload {
  margin-bottom: 14px;
}

.qr-payload span,
.scan-result span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.qr-payload code {
  display: block;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.reader-box {
  min-height: 320px;
  border: 1px dashed #b8c2bd;
  border-radius: 8px;
  background: #fbfcf9;
  overflow: hidden;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.reader-box > div {
  width: 100%;
}

.scan-result {
  min-height: 72px;
  margin-bottom: 14px;
}

.scan-result strong {
  display: block;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

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

.manual-qr-input {
  width: 100%;
  resize: vertical;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  margin-bottom: 10px;
}

.assignment-teacher-input {
  width: 100%;
  resize: vertical;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
}

.scanner-note {
  margin-top: 16px;
  box-shadow: none;
}

.scanner-note p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.security-panel {
  margin-top: 16px;
}

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

.security-check {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.security-check strong,
.security-check span {
  display: block;
}

.security-check span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  line-height: 1.5;
}

.security-check.pass {
  border-color: rgba(15, 118, 110, 0.22);
}

.security-check.fail {
  border-color: rgba(190, 18, 60, 0.26);
  background: var(--rose-soft);
}

.settlement-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px 18px;
  flex-wrap: wrap;
}

.payroll-rule-box {
  margin: 0 20px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 16px;
}

.compact-heading {
  margin-bottom: 12px;
}

.compact-heading h3 {
  margin: 0;
  font-size: 18px;
}

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

.payroll-rule-grid .field-label {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
}

.payroll-rule-grid input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.warning-item {
  min-height: 86px;
  padding: 14px 16px;
  display: grid;
  gap: 6px;
}

.warning-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.warning-item strong {
  font-size: 16px;
}

.warning-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(18px);
  min-width: min(360px, calc(100vw - 36px));
  min-height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 11px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  text-align: center;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .teacher-card {
    display: none;
  }

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

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

  .mail-notice {
    grid-template-columns: 1fr;
  }

  .dashboard-layout,
  .confirm-layout,
  .scanner-layout,
  .admin-schedule-layout {
    grid-template-columns: 1fr;
  }

  .finance-list-toolbar,
  .personnel-list-toolbar {
    grid-template-columns: 1fr;
  }

  .course-builder,
  .constraint-builder {
    grid-template-columns: 1fr 1fr;
  }

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

  .compact-field {
    max-width: none;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .panel-heading {
    display: grid;
  }

  .top-actions,
  .action-row {
    width: 100%;
  }

  .top-actions > *,
  .action-row > * {
    flex: 1;
  }

  .table-pagination {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  h1 {
    font-size: 23px;
  }

  .summary-grid,
  .pay-preview,
  .salary-total,
  .payroll-rule-grid,
  .confirm-steps {
    grid-template-columns: 1fr;
  }

  .lesson-hero {
    grid-template-columns: 1fr;
  }

  .qr-visual {
    width: min(100%, 220px);
  }

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

  .segmented {
    overflow-x: auto;
    justify-content: flex-start;
  }

  .segment {
    min-width: 74px;
  }
}

@media (max-width: 900px) {
  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
    font-size: 16px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    height: 76px;
    padding: 12px 16px;
    border: 0;
    box-shadow: 0 4px 14px rgba(0, 32, 104, 0.22);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .sidebar .brand {
    min-width: 0;
  }

  .sidebar .brand strong {
    font-size: 18px;
    line-height: 1.2;
  }

  .sidebar .brand span {
    max-width: 210px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-logo {
    width: 44px;
    height: 44px;
  }

  .teacher-card {
    display: none;
  }

  .account-switch {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
  }

  .account-switch p,
  .account-button {
    display: none;
  }

  .logout-button {
    width: auto;
    min-height: 40px;
    margin: 0;
    padding: 0 12px;
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    white-space: nowrap;
  }

  .nav-list {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: minmax(70px, 1fr);
    gap: 4px;
    overflow-x: auto;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -6px 18px rgba(0, 32, 104, 0.1);
  }

  .nav-item {
    min-width: 70px;
    min-height: 60px;
    border-radius: 8px;
    color: var(--muted);
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 6px 4px;
    text-align: center;
    font-size: 12px;
    line-height: 1.2;
    white-space: normal;
  }

  .nav-item span {
    width: 24px;
    height: 24px;
    background: var(--surface-soft);
    color: var(--primary);
  }

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

  .nav-item.active span,
  .nav-item:hover span {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
  }

  .main {
    padding: 96px 16px 10px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] .main {
    padding-top: 84px;
  }

  .topbar {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] .topbar {
    margin-bottom: 8px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] .top-actions {
    display: none;
  }

  .eyebrow {
    color: var(--primary);
  }

  h1 {
    font-size: 24px;
    line-height: 1.25;
  }

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

  .top-actions > *,
  .action-row > * {
    min-width: 0;
  }

  .top-actions #resetDemo,
  .top-actions #topLogoutButton {
    grid-column: auto;
  }

  .primary-button,
  .ghost-button,
  .segment {
    min-height: 44px;
  }

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

  .notice-list {
    grid-template-columns: 1fr;
  }

  .schedule-summary {
    grid-template-columns: repeat(5, minmax(86px, 1fr));
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .schedule-stat {
    min-height: 64px;
    padding: 8px 9px;
  }

  .schedule-stat strong {
    font-size: 20px;
  }

  .schedule-stat span,
  .schedule-stat small {
    font-size: 12px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .panel {
    padding: 12px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .panel-heading {
    align-items: center;
    margin-bottom: 8px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .panel-heading p {
    display: none;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .schedule-panel {
    gap: 8px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .schedule-toolbar {
    display: grid;
    gap: 0;
    padding: 8px 10px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .schedule-toolbar > div {
    display: none;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .week-select-label .lesson-select {
    min-height: 38px;
    margin-top: 4px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .schedule-summary {
    grid-template-columns: repeat(5, minmax(68px, 1fr));
    gap: 4px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .schedule-stat {
    min-height: 46px;
    padding: 6px 7px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .schedule-stat strong {
    font-size: 17px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .schedule-stat small {
    display: none;
  }

  .notice-item {
    align-items: flex-start;
  }

  .admin-schedule-actions {
    display: grid;
  }

  .admin-schedule-selectors {
    grid-template-columns: 1fr;
  }

  .schedule-adjust-grid {
    grid-template-columns: 1fr;
  }

  .subject-config-item {
    grid-template-columns: 1fr;
  }

  .subject-config-head,
  .subject-config-actions {
    display: grid;
    justify-items: start;
  }

  .course-rule-list,
  .course-rule-item,
  .course-rule-top,
  .course-rule-constraint-grid,
  .course-builder,
  .constraint-builder,
  .teacher-rule-builder {
    grid-template-columns: 1fr;
  }

  .constraint-item,
  .change-request-item {
    display: grid;
    justify-items: start;
  }

  .subject-config-meta {
    justify-content: flex-start;
  }

  .subject-config-buttons {
    width: 100%;
    justify-content: stretch;
  }

  .subject-config-buttons .mini-button {
    flex: 1;
  }

  .teacher-pool-summary-head,
  .teacher-pool-summary-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .schedule-toolbar {
    display: grid;
  }

  .week-select-label {
    min-width: 0;
  }

  .schedule-week-grid {
    grid-template-columns: repeat(7, 180px);
  }

  .schedule-week-grid.teacher-week-grid {
    grid-template-columns: 1fr;
    overflow: visible;
    gap: 12px;
  }

  .teacher-week-grid .schedule-day-strip {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(72px, 1fr);
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    scroll-snap-type: x proximity;
  }

  .teacher-week-grid .schedule-day-pill {
    scroll-snap-align: start;
    min-width: 72px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .teacher-week-grid .schedule-day-strip {
    grid-auto-columns: minmax(60px, 1fr);
    gap: 6px;
    padding-bottom: 6px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .teacher-week-grid .schedule-day-pill {
    min-width: 60px;
    padding: 7px 6px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .teacher-week-grid .schedule-day-pill strong {
    font-size: 15px;
  }

  .teacher-week-grid .schedule-agenda-list {
    grid-template-columns: 1fr;
    overflow: visible;
    padding-bottom: 0;
    gap: 14px;
  }

  .teacher-week-grid .schedule-column {
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }

  .teacher-week-grid .schedule-column header {
    min-height: auto;
    border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    background: var(--surface);
  }

  .teacher-week-grid .schedule-column.today header {
    border-left-color: var(--action);
    background: var(--action-soft);
  }

  .teacher-week-grid .schedule-column .schedule-items {
    padding: 8px 0 0;
    gap: 10px;
  }

  .teacher-week-grid .schedule-column .schedule-item {
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .teacher-week-grid .schedule-column .schedule-time {
    display: grid;
    gap: 2px;
  }

  .teacher-week-grid .schedule-column .schedule-main {
    gap: 6px;
  }

  .teacher-week-grid .schedule-column .schedule-action {
    grid-column: 2;
  }

  .schedule-day-focus > header {
    min-height: auto;
    border-left: 4px solid var(--primary);
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .schedule-day-focus > header {
    min-height: 44px;
    padding: 7px 10px;
  }

  body[data-account-role="teacher"][data-active-view="schedule"] #scheduleView .schedule-day-focus > header span {
    display: none;
  }

  .schedule-day-focus.today > header {
    border-left-color: var(--action);
  }

  .schedule-day-timeline {
    gap: 6px;
    padding: 8px;
  }

  .schedule-day-timeline::before {
    left: 70px;
    top: 18px;
    bottom: 18px;
  }

  .schedule-timeline-event {
    min-height: 56px;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 7px;
    padding: 7px 8px 7px 9px;
  }

  .schedule-timeline-event::before {
    left: 53px;
  }

  .schedule-timeline-action {
    grid-column: auto;
    justify-content: flex-end;
  }

  .schedule-timeline-time strong {
    font-size: 15px;
  }

  .schedule-timeline-main strong {
    font-size: 14px;
  }

  .schedule-timeline-action .tag {
    min-height: 20px;
    padding: 0 6px;
    font-size: 11px;
  }

  .mail-notice {
    padding: 14px;
  }

  .notice-bar {
    padding: 14px;
  }

  .metric {
    min-height: 120px;
    padding: 16px;
  }

  .metric strong {
    font-size: 30px;
  }

  .lesson-focus {
    border-left: 4px solid var(--action);
  }

  .lesson-focus .qr-visual {
    display: none;
  }

  .lesson-hero {
    grid-template-columns: 1fr;
    gap: 0;
  }

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

  .next-lesson-detail strong {
    font-size: 22px;
  }

  .panel,
  .metric,
  .warning-item,
  .pay-preview div,
  .salary-total div,
  .workload-item,
  .confirm-step {
    border-radius: 8px;
  }

  .panel {
    padding: 16px;
  }

  .panel-heading {
    gap: 10px;
    margin-bottom: 14px;
  }

  .table-panel {
    padding: 0;
  }

  .table-panel .panel-heading {
    padding: 16px 16px 4px;
  }

  .table-wrap {
    overflow: visible;
    padding: 0 0 4px;
  }

  table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tbody tr {
    margin: 0 12px 10px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  tbody tr:nth-child(even) {
    background: var(--surface);
  }

  td {
    border-top: 0;
    padding: 10px 12px;
    line-height: 1.45;
  }

  td[data-label] {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
  }

  td[data-label].row-title {
    font-size: 17px;
  }

  td[data-label] .mini-button {
    margin: 0 6px 6px 0;
  }

  .salary-total {
    grid-template-columns: 1fr;
    padding: 0 16px 16px;
  }

  .teacher-pay-strip {
    display: grid;
    align-items: start;
  }

  .teacher-pay-strip .status-pill {
    justify-self: start;
  }

  .teacher-total-preview strong,
  .teacher-pay-hero strong,
  .teacher-pay-strip strong {
    font-size: 31px;
  }

  .generated-qr {
    width: 100%;
    min-height: auto;
    aspect-ratio: 1;
  }

  .security-check {
    display: grid;
  }

  .schedule-day header {
    align-items: flex-start;
  }

  .schedule-item {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
  }

  .schedule-time {
    display: flex;
    gap: 8px;
    align-items: baseline;
  }

  .schedule-action {
    display: flex;
    justify-content: flex-start;
  }

  .toast {
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
}
