:root {
  color-scheme: light;
  --bg: oklch(0.973 0.006 210);
  --surface: oklch(0.995 0.004 210);
  --surface-2: oklch(0.955 0.008 210);
  --line: oklch(0.875 0.014 215);
  --text: oklch(0.205 0.015 220);
  --muted: oklch(0.48 0.018 220);
  --accent: oklch(0.55 0.13 210);
  --accent-2: oklch(0.68 0.14 150);
  --warn: oklch(0.66 0.14 65);
  --danger: oklch(0.57 0.16 24);
  --success-bg: oklch(0.94 0.04 150);
  --warn-bg: oklch(0.95 0.045 70);
  --danger-bg: oklch(0.95 0.04 25);
  --radius: 8px;
  --shadow: 0 18px 38px color-mix(in oklch, var(--text) 10%, transparent);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: oklch(0.235 0.025 220);
  color: oklch(0.965 0.006 220);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand-block {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
}

.mark {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0;
  color: oklch(0.98 0.004 210);
  background: oklch(0.54 0.13 210);
}

.brand-block h1,
.brand-block p,
.panel h3,
.topbar h2 {
  margin: 0;
}

.brand-block h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand-block p {
  margin-top: 4px;
  color: oklch(0.78 0.018 220);
  font-size: 12px;
}

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

.nav-item {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: oklch(0.87 0.013 220);
  text-align: left;
  padding: 0 12px;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: oklch(0.31 0.03 220);
  outline: none;
}

.nav-item.active {
  background: oklch(0.98 0.004 210);
  color: oklch(0.24 0.026 220);
}

.operator-panel {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid oklch(0.36 0.026 220);
  border-radius: 8px;
  background: oklch(0.27 0.025 220);
}

.operator-panel label {
  color: oklch(0.82 0.015 220);
  font-size: 12px;
}

.operator-panel p {
  margin: 0;
  color: oklch(0.77 0.016 220);
  font-size: 12px;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid color-mix(in oklch, var(--accent) 35%, transparent);
  border-color: var(--accent);
}

.workspace {
  min-width: 0;
  padding: 22px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.eyebrow:empty {
  display: none;
}

.topbar h2 {
  font-size: 24px;
  line-height: 1.2;
}

.top-actions,
.toolbar-row,
.review-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 13px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: oklch(0.985 0.004 210);
}

.primary-button:hover {
  background: oklch(0.49 0.13 210);
}

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

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

.ghost-button:hover,
.icon-button:hover {
  background: var(--surface-2);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.status-strip > div,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.status-strip > div {
  padding: 15px 16px;
}

.status-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.status-strip strong {
  font-size: 18px;
}

.panel {
  padding: 16px;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 16px;
  margin-bottom: 16px;
}

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

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

.panel-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 70px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}

.panel-summary::-webkit-details-marker {
  display: none;
}

.panel-summary strong {
  display: block;
  font-size: 16px;
}

.panel-summary em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.panel-summary::after {
  content: "展开查看";
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  background: var(--surface);
}

.collapsible-panel[open] .panel-summary {
  border-bottom: 1px solid var(--line);
}

.collapsible-panel[open] .panel-summary::after {
  content: "隐藏";
}

.collapsible-panel > .bank-list {
  padding: 16px;
}

.panel-header h3 {
  font-size: 16px;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 62ch;
}

.timeline {
  display: grid;
  gap: 10px;
}

.stage-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: oklch(0.985 0.004 210);
}

.stage-index {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--muted);
}

.stage-row.done .stage-index {
  background: var(--success-bg);
  color: oklch(0.39 0.09 150);
}

.stage-row.locked {
  opacity: 0.62;
}

.stage-title {
  font-weight: 800;
}

.stage-copy {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--muted);
}

.pill.pass {
  background: var(--success-bg);
  color: oklch(0.38 0.09 150);
}

.pill.fail {
  background: var(--danger-bg);
  color: var(--danger);
}

.pill.warn {
  background: var(--warn-bg);
  color: oklch(0.46 0.1 65);
}

.attempt-list,
.module-grid,
.bank-list {
  display: grid;
  gap: 10px;
}

.attempt-item,
.module-card,
.bank-item,
.exam-choice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: oklch(0.987 0.004 210);
}

.attempt-item strong,
.module-card strong,
.bank-item strong {
  display: block;
  margin-bottom: 4px;
}

.attempt-item span,
.module-card span,
.bank-item span {
  color: var(--muted);
  font-size: 13px;
}

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

.exam-layout,
.admin-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

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

.exam-list h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.exam-choice {
  width: 100%;
  text-align: left;
  margin-bottom: 9px;
}

.exam-choice.active {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 8%, var(--surface));
}

.exam-choice:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.empty-state {
  min-height: 300px;
  display: grid;
  place-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 18px;
}

.exam-form {
  display: grid;
  gap: 14px;
}

.question-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: oklch(0.987 0.004 210);
}

.question-title {
  font-weight: 800;
  line-height: 1.45;
  margin-bottom: 10px;
}

.question-points {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.question-image,
.image-preview {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  margin-bottom: 10px;
}

.answers {
  display: grid;
  gap: 8px;
}

.answer-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px;
  border-radius: 8px;
}

.answer-row:hover {
  background: var(--surface-2);
}

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

.review-summary {
  display: grid;
  gap: 10px;
}

.review-line {
  padding: 11px;
  border-radius: 8px;
  background: var(--surface-2);
}

.muted-copy {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.review-check-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.review-check-item input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.review-check-item span {
  color: var(--muted);
  line-height: 1.5;
}

.review-check-item strong {
  color: var(--ink);
}

.review-question-detail,
.review-question-text,
.review-explanation,
.review-option-list {
  display: grid;
  gap: 6px;
}

.review-question-text {
  color: var(--ink);
  white-space: pre-wrap;
}

.review-question-image {
  width: min(560px, 100%);
  max-height: 360px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.review-option-list {
  gap: 5px;
  margin: 2px 0;
}

.review-option {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
}

.review-option.correct {
  border-color: color-mix(in srgb, var(--ok), transparent 35%);
  background: color-mix(in srgb, var(--ok), transparent 88%);
}

.review-option.wrong {
  border-color: color-mix(in srgb, var(--danger), transparent 35%);
  background: color-mix(in srgb, var(--danger), transparent 88%);
}

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

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

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

.analysis-section {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: oklch(0.982 0.005 210);
}

.analysis-section + .analysis-section {
  margin-top: 12px;
}

.analysis-section-head,
.analysis-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.analysis-section summary {
  cursor: pointer;
  list-style: none;
}

.analysis-section summary::-webkit-details-marker {
  display: none;
}

.analysis-section summary::after {
  content: "展开";
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: var(--surface);
}

.analysis-section[open] summary::after {
  content: "收起";
}

.analysis-section-head strong,
.analysis-section summary strong {
  display: block;
  font-size: 17px;
}

.analysis-section-head p,
.analysis-section summary em {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.analysis-section .analytics-grid {
  margin-top: 12px;
}

.bar-chart {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1.1fr) minmax(120px, 2fr) 44px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.bar-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: oklch(0.58 0.13 210);
}

.tone-1 {
  background: oklch(0.62 0.16 150);
}

.tone-2 {
  background: oklch(0.66 0.16 70);
}

.tone-3 {
  background: oklch(0.6 0.14 20);
}

.tone-4 {
  background: oklch(0.58 0.13 280);
}

.tone-5 {
  background: oklch(0.56 0.11 190);
}

.bar-empty {
  color: var(--muted);
  font-size: 12px;
}

.bar-row.is-zero {
  color: var(--muted);
}

.clickable-bar,
.clickable-row {
  cursor: pointer;
}

.clickable-bar {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
}

.clickable-bar:hover span,
.clickable-row:hover span {
  color: var(--accent);
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.rank-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.compact-button {
  padding: 6px 10px;
  min-height: 0;
  font-size: 12px;
}

.danger-button {
  color: var(--danger);
  border-color: color-mix(in oklch, var(--danger) 28%, var(--line));
}

.trainee-manager {
  margin-top: 10px;
}

.trainee-manager input {
  flex: 1;
  min-width: 180px;
}

.mini-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.mini-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mini-person b {
  overflow-wrap: anywhere;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in oklch, var(--ink) 34%, transparent);
}

.detail-card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(760px, 88vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  cursor: pointer;
}

.detail-body {
  display: grid;
  gap: 12px;
}

.detail-item {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.detail-item span,
.detail-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.score-chip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.admin-login,
.editor-form {
  display: grid;
  gap: 12px;
}

.editor-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.bank-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.bank-item.draft-item {
  border-style: dashed;
  opacity: 0.82;
}

.bank-item img {
  width: 84px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  margin-top: 7px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1060px) {
  .app-shell,
  .exam-layout,
  .admin-grid,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .module-grid,
  .status-strip,
  .analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 14px;
  }

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

  .module-grid,
  .status-strip,
  .option-grid,
  .analytics-grid,
  .bar-row {
    grid-template-columns: 1fr;
  }
}
