:root {
  --blue: #409eff;
  --blue-soft: #ecf5ff;
  --red: #f56c6c;
  --green: #14a66f;
  --text: #2f3846;
  --muted: #7a8491;
  --line: #e5e9ef;
  --head: #f6f7f9;
  --bg: #f1f4f7;
  --side: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: linear-gradient(135deg, #eaf6ff 0%, #f6fbff 46%, #edf8f4 100%);
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 34px;
  border: 1px solid #d9e7f5;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 46px rgba(24, 68, 110, 0.14);
}

.login-panel .eyebrow {
  margin: 0;
  color: #1d6db4;
  font-weight: 700;
}

.login-panel h1 {
  margin: 0 0 8px;
  color: #102b4d;
  font-size: 30px;
}

.login-panel label {
  display: grid;
  gap: 7px;
  color: #334966;
  font-weight: 700;
}

.login-panel .primary-btn {
  width: 100%;
  height: 48px;
  margin-top: 4px;
}

.form-error {
  margin: 0;
  color: var(--red);
}

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

button {
  border: 0;
  cursor: pointer;
  background: #fff;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.workspace {
  min-width: 0;
}

.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.crumb {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #243142;
  font-size: 22px;
  font-weight: 700;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
}

.userbar b {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
}

.userbar button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #566273;
}

.module-tabs {
  display: inline-flex;
  gap: 8px;
  margin: 18px 20px 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.module-tabs button {
  height: 38px;
  padding: 0 18px;
  border-radius: 5px;
  color: #566273;
}

.module-tabs button.active {
  background: var(--blue);
  color: #fff;
}

.page-card {
  margin: 20px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
}

.filter-bar {
  display: grid;
  grid-template-columns: 1.2fr 0.85fr 0.75fr 1fr 0.75fr 0.7fr 0.8fr auto;
  gap: 14px;
  padding: 18px 0;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #dfe5ec;
  border-radius: 5px;
  padding: 0 13px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input,
select {
  height: 48px;
}

textarea {
  padding-top: 10px;
  padding-bottom: 10px;
  line-height: 1.6;
  resize: vertical;
}

.primary-btn {
  height: 42px;
  padding: 0 20px;
  border-radius: 5px;
  background: var(--blue);
  color: #fff;
}

.filter-bar .primary-btn {
  height: 48px;
  min-width: 88px;
}

.script-filter-bar {
  grid-template-columns: 1.4fr 1fr 0.8fr auto;
}

.rotation-filter-bar {
  grid-template-columns: minmax(280px, 1fr) auto;
}

.bank-filter-bar {
  grid-template-columns: 1fr 0.75fr 0.75fr minmax(280px, 1.2fr) auto;
}

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

.bank-topic-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin: 18px 0 4px;
}

.bank-topic-cards article {
  padding: 18px;
  border: 1px solid #d9e7f5;
  border-radius: 8px;
  background: linear-gradient(135deg, #f6fbff, #ffffff);
}

.bank-topic-cards span {
  display: block;
  color: #1d6db4;
  font-weight: 700;
}

.bank-topic-cards strong {
  display: block;
  margin-top: 6px;
  color: #102b4d;
  font-size: 22px;
}

.bank-topic-cards p {
  min-height: 44px;
  margin: 10px 0 12px;
  color: var(--muted);
  line-height: 1.55;
}

.bank-topic-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bank-topic-metrics em {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #1769aa;
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
}

.rotation-stat-cards article {
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.rotation-stat-cards span,
.rotation-stat-cards small {
  display: block;
  color: var(--muted);
}

.rotation-stat-cards strong {
  display: block;
  margin: 8px 0 4px;
  color: #12355b;
  font-size: 32px;
  line-height: 1;
}

.rotation-table-wrap {
  min-width: 0;
}

.bank-table-wrap,
.certificate-table-wrap {
  min-width: 0;
}

.detail-subtitle,
.detail-empty,
.detail-meta {
  color: var(--muted);
}

.detail-subtitle {
  margin: 6px 0 16px;
  line-height: 1.5;
}

.rotation-detail-card {
  margin-bottom: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.rotation-detail-card h3 {
  margin: 0 0 10px;
  color: #12355b;
  font-size: 16px;
}

.detail-meta {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.detail-meta strong {
  padding: 2px 10px;
  border-radius: 999px;
  color: var(--blue);
  background: #eef6ff;
}

.score-group strong {
  color: var(--blue);
}

.score-group {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  background: #f6faff;
}

.score-group strong {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.score-group strong em {
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
}

.detail-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 8px;
  margin: 0;
}

.detail-rows div {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #f8fbff;
  font-size: 13px;
  line-height: 1.45;
}

.detail-rows dt {
  flex: 0 0 190px;
  color: var(--muted);
  white-space: nowrap;
}

.detail-rows dd {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: #12355b;
  font-weight: 600;
  overflow-wrap: break-word;
}

.score-group .detail-rows {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.score-group .detail-rows dt {
  flex-basis: 240px;
}

.rotation-detail-drawer {
  width: min(980px, calc(100vw - 96px));
  min-width: 720px;
}

.rotation-detail-drawer .drawer-body {
  padding: 18px 28px 36px;
}

.certificate-preview-drawer {
  width: min(1120px, calc(100vw - 64px));
}

.certificate-preview-drawer .drawer-body {
  background: #f7f8fb;
}

.certificate-preview-image {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

#rotationView th:nth-child(1),
#rotationView td:nth-child(1) {
  width: 150px;
}

#rotationView th:nth-child(2),
#rotationView td:nth-child(2) {
  width: 220px;
}

#rotationView th:nth-child(3),
#rotationView td:nth-child(3) {
  width: 130px;
}

#rotationView th:nth-child(4),
#rotationView td:nth-child(4) {
  width: 190px;
}

#rotationView th:nth-child(5),
#rotationView td:nth-child(5) {
  width: 110px;
}

#rotationView th:nth-child(6),
#rotationView td:nth-child(6) {
  width: 120px;
}

#rotationView th:nth-child(7),
#rotationView td:nth-child(7) {
  width: 130px;
}

#rotationView th:nth-child(8),
#rotationView td:nth-child(8) {
  width: 150px;
}

#rotationView th:nth-child(9),
#rotationView td:nth-child(9) {
  width: 90px;
}

#rotationView table small {
  color: var(--muted);
}

#rotationView .pill.success {
  color: var(--green);
  background: #e6f8f0;
}

#rotationView .pill.warning {
  color: #b7791f;
  background: #fff6df;
}

#rotationView .pill.muted-pill {
  color: var(--muted);
  background: #f2f4f7;
}

.table-wrap {
  position: relative;
  min-height: 426px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th {
  height: 60px;
  padding: 0 14px;
  background: #f7f7f8;
  color: #242a31;
  text-align: left;
  font-weight: 700;
}

td {
  height: 60px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: #606a76;
  vertical-align: middle;
}

th:nth-child(1),
td:nth-child(1) {
  width: 190px;
  white-space: nowrap;
  word-break: keep-all;
}

th:nth-child(2),
td:nth-child(2) {
  width: 190px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 360px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 96px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 72px;
}

th:nth-child(6),
td:nth-child(6) {
  width: 112px;
}

th:nth-child(7),
td:nth-child(7) {
  width: 168px;
}

th:nth-child(8),
td:nth-child(8) {
  width: 172px;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
}

.pill.UNREVIEWED {
  color: #b7791f;
  background: #fff6df;
}

.pill.APPROVED {
  color: var(--green);
  background: #e6f8f0;
}

.pill.REJECTED {
  color: var(--red);
  background: #fff0f0;
}

.row-actions {
  display: flex;
  gap: 12px;
}

.link-btn {
  padding: 0;
  color: var(--blue);
  background: transparent;
}

.link-btn.danger {
  color: var(--red);
}

.empty-state {
  padding: 80px 0;
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.pager {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
}

.pager div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pager button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #586574;
}

.pager button:disabled {
  color: #b8c0ca;
  cursor: not-allowed;
}

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  background: rgba(18, 28, 39, 0.36);
}

.drawer {
  width: min(1520px, calc(100vw - 120px));
  min-width: 760px;
  height: 100vh;
  overflow: hidden;
  background: #f5f7fa;
  box-shadow: -12px 0 36px rgba(20, 31, 43, 0.20);
}

.drawer-head {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.drawer-head p {
  margin: 0 0 4px;
  color: var(--muted);
}

.drawer-head h2 {
  margin: 0;
  font-size: 22px;
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  color: #8792a0;
  font-size: 28px;
  background: transparent;
}

.drawer-body {
  height: calc(100vh - 78px);
  overflow-y: auto;
  padding: 20px 54px 44px;
}

.form-section {
  margin-bottom: 18px;
  background: #fff;
}

.form-section h3 {
  margin: 0 0 12px;
  padding-left: 14px;
  border-left: 4px solid var(--blue);
  font-size: 20px;
}

.form-grid,
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.form-grid label,
.choice-grid label,
.review-field {
  display: grid;
  grid-template-columns: 172px 1fr;
  min-height: 44px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.form-grid label:has(textarea),
.review-field:has(textarea) {
  min-height: 44px;
}

.form-grid label:has(textarea.two-line),
.review-field:has(textarea.two-line) {
  min-height: 72px;
}

.form-grid label.wide,
.choice-grid label.wide,
.review-field {
  grid-column: 1 / -1;
}

.form-grid label > span,
.choice-grid label > span,
.review-field > span {
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: #f0f2f5;
  color: #263241;
}

.form-grid b {
  margin-left: 4px;
  color: var(--red);
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.choice-grid input,
.review-field textarea,
.review-field input {
  border: 0;
  border-radius: 0;
  min-height: 42px;
  height: 42px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.form-grid textarea,
.review-field textarea {
  line-height: 1.55;
  resize: vertical;
}

.form-grid textarea.two-line,
.review-field textarea.two-line,
#referenceAnswerInput {
  min-height: 70px;
  height: 70px;
}

.review-field {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.script-text-field {
  grid-template-columns: 172px 1fr;
}

.script-text-field textarea {
  min-height: 132px;
  height: auto;
}

#scriptDraftTextInput {
  min-height: 260px;
}

#scriptApprovedTextInput {
  min-height: 200px;
}

.script-plan-section {
  padding: 16px 18px 18px;
}

.script-plan-help {
  margin: 0 0 14px 18px;
  color: var(--muted);
}

.script-page-plan {
  display: grid;
  gap: 12px;
}

.script-page-card {
  border: 1px solid #dfe8f4;
  border-radius: 6px;
  background: #fbfdff;
  overflow: hidden;
}

.script-page-card header {
  display: grid;
  grid-template-columns: 92px 160px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: #edf6ff;
  color: #1e4f83;
}

.script-page-card header b,
.script-page-card header em {
  font-style: normal;
}

.script-page-index {
  display: inline-flex;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #409eff;
  color: #fff;
  font-weight: 700;
}

.script-page-card p {
  margin: 0;
  padding: 14px;
  color: #354254;
  line-height: 1.75;
  white-space: pre-wrap;
}

.script-page-card footer {
  padding: 0 14px 12px;
  color: var(--muted);
}

.script-page-empty {
  padding: 22px;
  border: 1px dashed #c8d7e8;
  border-radius: 6px;
  color: var(--muted);
  background: #fbfdff;
}

.review-actions {
  display: flex;
  gap: 12px;
  padding: 4px 0 0;
  justify-content: flex-end;
}

.review-actions button {
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #596675;
}

.approve-btn {
  border-color: var(--green) !important;
  background: var(--green) !important;
  color: #fff !important;
}

.danger-btn {
  border-color: var(--red) !important;
  background: var(--red) !important;
  color: #fff !important;
}

.readonly input,
.readonly select,
.readonly textarea {
  color: #6e7782;
  background: #fff;
  pointer-events: none;
}

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

.people-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(420px, 1fr);
  gap: 20px;
}

.people-layout.teacher-layout {
  grid-template-columns: minmax(240px, 300px) minmax(380px, 0.9fr) minmax(360px, 1fr);
}

.people-list {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 680px;
  overflow: auto;
}

.people-table-wrap {
  min-height: 360px;
  margin-top: 18px;
}

.people-table-wrap th:nth-child(1),
.people-table-wrap td:nth-child(1) {
  width: 150px;
}

.people-table-wrap th:nth-child(2),
.people-table-wrap td:nth-child(2) {
  width: 150px;
}

.people-table-wrap th:nth-child(3),
.people-table-wrap td:nth-child(3) {
  width: 150px;
}

.people-table-wrap th:nth-child(4),
.people-table-wrap td:nth-child(4),
.people-table-wrap th:nth-child(5),
.people-table-wrap td:nth-child(5),
.people-table-wrap th:nth-child(7),
.people-table-wrap td:nth-child(7),
.people-table-wrap th:nth-child(8),
.people-table-wrap td:nth-child(8) {
  width: 120px;
}

.person-card {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
}

.person-card.active {
  border-color: #409eff;
  background: #edf6ff;
}

.person-card strong {
  color: #102b4d;
}

.person-card span,
.person-card small {
  color: var(--muted);
}

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

.detail-panel,
.teacher-detail-panel {
  margin-top: 18px;
}

.teacher-detail-panel {
  display: block;
}

.detail-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.detail-head h2 {
  margin: 0;
  color: #102b4d;
  font-size: 20px;
}

.detail-head button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #566273;
}

.people-form label {
  display: grid;
  gap: 6px;
  color: #334966;
  font-size: 13px;
  font-weight: 700;
}

.people-form input,
.people-form select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: #102b4d;
}

.people-form .form-submit {
  grid-column: 1 / -1;
  height: 44px;
}

.course-multi-field {
  grid-column: 1 / -1;
}

.course-multi-select {
  position: relative;
}

.course-multi-select input {
  width: 100%;
  text-overflow: ellipsis;
}

.course-check-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow: auto;
}

.course-select-dropdown {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 43, 77, 0.12);
  padding: 8px;
}

.course-check-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 4px 10px;
  align-items: center;
  padding: 8px 6px;
  border-radius: 4px;
  font-weight: 400;
}

.course-check-row:hover {
  background: #f4f8fd;
}

.course-check-row small {
  grid-column: 2;
  color: var(--muted);
}

.course-check-empty {
  padding: 10px 6px;
  color: var(--muted);
  font-weight: 400;
}

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

  .page-card {
    margin-top: 18px;
  }

  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .drawer {
    width: 100vw;
    min-width: 0;
  }

  .people-layout,
  .people-layout.teacher-layout,
  .people-form,
  .teacher-detail-panel {
    grid-template-columns: 1fr;
  }
}
