:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --line: #d8ded6;
  --text: #20241f;
  --muted: #667063;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warn: #9a5b05;
  --danger: #b3261e;
  --shadow: 0 12px 32px rgb(41 50 38 / 10%);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcf8;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.status {
  min-width: 112px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
}

.status[data-state="ok"] {
  color: var(--accent-strong);
  border-color: #98d5c9;
}

.status[data-state="pending"] {
  color: var(--warn);
  border-color: #e5c07b;
}

.status[data-state="error"] {
  color: var(--danger);
  border-color: #e0a29d;
}

.tabs {
  display: flex;
  gap: 8px;
  max-width: 1280px;
  margin: 18px auto 0;
  padding: 0 32px;
}

.tab-button {
  border-color: var(--line);
  color: var(--muted);
  background: #ffffff;
}

.tab-button[aria-pressed="true"] {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(320px, 0.9fr);
  gap: 18px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 32px 32px;
}

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

.summary-panel {
  grid-column: 1 / -1;
}

.teacher-panel {
  grid-column: 1 / -1;
}

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

.section-title.compact {
  margin-top: 24px;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.section-title span {
  color: var(--muted);
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 14%);
}

textarea {
  min-height: 220px;
  resize: vertical;
  font-family: "Cascadia Code", Consolas, monospace;
  line-height: 1.55;
}

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

button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--accent-strong);
  background: #ffffff;
  cursor: pointer;
}

button[type="submit"] {
  color: #ffffff;
  background: var(--accent);
}

button:hover {
  filter: brightness(0.97);
}

.run-status {
  min-height: 24px;
  color: var(--muted);
  line-height: 1.5;
}

.task-detail {
  min-height: 184px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.task-detail h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.task-detail p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.task-detail dl {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  margin: 16px 0 0;
}

.task-detail dt {
  color: var(--muted);
}

.task-detail dd {
  margin: 0;
  font-family: "Cascadia Code", Consolas, monospace;
}

.result-box {
  min-height: 220px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #20241f;
  color: #eff7ef;
  line-height: 1.55;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcf8;
}

.metrics strong {
  display: block;
  font-size: 26px;
  color: var(--accent-strong);
}

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

.task-summary {
  display: grid;
  gap: 8px;
}

.teacher-actions {
  margin: 14px 0 18px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.teacher-panel h3 {
  margin: 18px 0 10px;
  font-size: 16px;
}

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

.data-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fbfcf8;
}

.data-row span {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #fbfcf8;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.summary-row span {
  color: var(--muted);
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .tabs {
    padding: 0 16px;
  }

  .field-grid,
  .metrics,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}
