:root {
  --ink: #20242a;
  --muted: #65717f;
  --line: #dce2ea;
  --surface: #f4f6f8;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-strong: #0a5c55;
  --blue: #2f5f8f;
  --warn: #8a4b0f;
  --warn-soft: #fff4df;
  --soft: #e8f3f1;
  --danger: #9b1c1c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

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

button {
  min-height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #aab5c2;
  background: #f9fbfd;
}

button:disabled {
  cursor: not-allowed;
  color: #9da7b2;
  background: #eef2f5;
}

button.primary {
  min-height: 46px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 650;
}

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

button.small {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

button.danger {
  border-color: #e7b6ad;
  background: #fff7f5;
  color: var(--danger);
}

button.danger:hover:not(:disabled) {
  border-color: #d08d80;
  background: #ffece8;
}

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

textarea {
  resize: vertical;
  line-height: 1.55;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 13px;
}

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

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

h2 {
  font-size: 15px;
}

h3 {
  font-size: 14px;
}

.hidden {
  display: none !important;
}

body.is-busy {
  overflow: hidden;
}

.muted,
.status-line {
  color: var(--muted);
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  align-items: center;
  padding: 32px;
}

.auth-copy {
  display: grid;
  gap: 16px;
  max-width: 760px;
}

.auth-copy h1 {
  font-size: 42px;
}

.auth-copy p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.65;
}

.cost-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cost-strip span,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #bddfd9;
  background: var(--soft);
  color: var(--accent-strong);
  padding: 3px 9px;
  font-size: 12px;
}

.pill.warn {
  border-color: #e7c286;
  background: var(--warn-soft);
  color: var(--warn);
}

.auth-panel,
.panel,
.profile-panel,
.record-form,
.result-panel,
.summary-panel,
.history-panel {
  border: 1px solid var(--line);
  background: var(--panel);
}

.auth-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
}

.segmented button {
  border: 0;
  min-height: 40px;
}

.segmented button.active {
  background: var(--ink);
  color: #fff;
}

.auth-form,
.stack {
  display: grid;
  gap: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 16px;
  height: 16px;
  padding: 0;
}

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

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

.sidebar {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 12px;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #eef2f5;
  overflow-y: auto;
}

.brand {
  display: grid;
  gap: 6px;
}

.brand p,
.topbar p {
  color: var(--muted);
  line-height: 1.45;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.section-head,
.topbar,
.result-head,
.voice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.student-list {
  display: grid;
  gap: 8px;
  max-height: 390px;
  overflow-y: auto;
}

.student-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}

.student-item input {
  width: auto;
  margin-top: 3px;
}

.student-item strong {
  display: block;
  font-size: 14px;
}

.student-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.student-item.active {
  border-color: #9dc8c3;
  background: #f7fbfa;
}

.student-focus {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.student-toolbar {
  display: flex;
  justify-content: flex-end;
}

.student-create-panel {
  align-self: start;
}

.workspace {
  display: grid;
  gap: 16px;
  padding: 18px;
  overflow: auto;
}

.topbar {
  align-items: start;
}

.record-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 0.82fr);
  gap: 16px;
  align-items: start;
}

.record-form,
.result-panel,
.profile-panel,
.summary-panel,
.history-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.profile-panel {
  align-self: start;
}

.profile-body {
  display: grid;
  gap: 12px;
  max-height: 300px;
  overflow: auto;
  line-height: 1.55;
}

.profile-section {
  display: grid;
  gap: 6px;
}

.profile-section strong {
  font-size: 13px;
  color: var(--ink);
}

.profile-section p {
  color: var(--muted);
}

.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #d7dde6;
  background: #eef2f6;
  color: #36404c;
  padding: 3px 8px;
  font-size: 12px;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.voice-row {
  justify-content: start;
  flex-wrap: wrap;
}

.summary-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.summary-actions {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

pre {
  min-height: 160px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  background: #f9fbfd;
  padding: 12px;
  line-height: 1.6;
  font-family: inherit;
}

.individual-list,
.history-list {
  display: grid;
  gap: 10px;
}

.feedback-card,
.history-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px;
}

.history-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.history-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.history-feedback-block {
  display: grid;
  gap: 6px;
}

.history-feedback-block h3 {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
}

.history-feedback-block pre {
  min-height: 120px;
  max-height: 260px;
  overflow: auto;
}

.history-detail {
  display: grid;
  gap: 10px;
}

.history-detail summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 650;
}

.history-detail section {
  display: grid;
  gap: 6px;
}

.history-detail pre {
  min-height: 0;
  max-height: 260px;
  overflow: auto;
}

.feedback-card pre {
  min-height: 120px;
}

.history-meta {
  color: var(--muted);
  font-size: 12px;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 27, 33, 0.56);
  backdrop-filter: blur(2px);
}

.busy-panel {
  width: min(420px, 100%);
  display: grid;
  justify-items: center;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: #fff;
  padding: 30px 24px;
  text-align: center;
  box-shadow: 0 18px 54px rgba(12, 18, 24, 0.28);
}

.busy-mark {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border: 3px solid #d9eee9;
}

.busy-mark span {
  width: 46px;
  height: 46px;
  border: 5px solid #c9ddd9;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: busy-spin 0.85s linear infinite;
}

.busy-panel h2 {
  font-size: 28px;
  line-height: 1.2;
}

.busy-panel p {
  max-width: 320px;
  color: var(--muted);
  line-height: 1.6;
}

@keyframes busy-spin {
  to {
    transform: rotate(360deg);
  }
}

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

  .auth-shell {
    align-items: start;
    padding: 18px;
  }

  .auth-copy h1 {
    font-size: 30px;
  }

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

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

  .summary-form {
    grid-template-columns: 1fr;
  }

  .history-feedback-grid {
    grid-template-columns: 1fr;
  }

  .busy-panel {
    padding: 24px 18px;
  }

  .busy-panel h2 {
    font-size: 24px;
  }
}
