:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --ink: #17201b;
  --muted: #5f6b64;
  --line: #d9ded8;
  --panel: #ffffff;
  --accent: #0f7a6d;
  --accent-strong: #075e55;
  --warm: #b25c2b;
  --soft: #edf4f1;
  --shadow: 0 18px 50px rgba(25, 40, 32, 0.12);
}

* {
  box-sizing: border-box;
}

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

button {
  font: inherit;
}

.admin-workspace {
  min-height: 100vh;
  padding: 24px;
}

.admin-hero {
  max-width: 1180px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.admin-hero h1 {
  font-size: 28px;
}

.preview-link {
  color: var(--accent-strong);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 10px 14px;
  background: #fff;
}

.admin-flow {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.admin-step {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  padding: 22px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.step-kicker {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.step-body h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.step-body > p {
  color: var(--muted);
  line-height: 1.7;
}

.outline-panel.flat {
  margin: 14px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.module-editor {
  display: grid;
  gap: 12px;
}

.flow-copy-editor {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.module-edit-card,
.link-card {
  padding: 14px;
  border: 1px solid var(--line);
  background: #fbfcfa;
}

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

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

.link-card {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 150px auto;
  gap: 14px;
  align-items: center;
}

.module-edit-head {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.module-edit-card label,
.copy-edit-card label,
.profile-grid label {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.module-edit-card label span,
.copy-edit-card label span,
.profile-grid label span {
  color: var(--muted);
  font-size: 13px;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr);
  gap: 12px;
  margin: 14px 0;
}

.generated-link {
  margin: 10px 0 0;
  color: var(--muted);
  word-break: break-all;
}

.generated-link a {
  color: var(--accent-strong);
}

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

.link-card strong,
.link-card span,
.link-card small {
  display: block;
}

.link-person span,
.link-state small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.link-main {
  min-width: 0;
}

.link-url {
  display: block;
  margin-top: 8px;
  color: var(--accent-strong);
  font-size: 13px;
  word-break: break-all;
}

.link-state {
  display: grid;
  gap: 4px;
}

.state-pill {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.state-pill.active {
  background: #fff8ef;
  color: var(--warm);
}

.state-pill.done {
  background: var(--soft);
  color: var(--accent-strong);
}

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

.interview-panel,
.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.interview-panel {
  min-height: calc(100vh - 40px);
  display: grid;
  grid-template-rows: auto auto minmax(280px, 1fr) auto;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--warm);
  font-size: 14px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.status-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 14px;
}

.status-pill.model {
  background: #fff8ef;
  color: var(--warm);
}

.nav-toggle,
.panel-close {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.nav-toggle {
  width: 42px;
  height: 42px;
  font-size: 22px;
}

.progress-wrap {
  padding: 16px 28px 12px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.progress-track {
  height: 8px;
  background: #e8ece8;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.chat {
  padding: 20px 28px 28px;
  overflow-y: auto;
}

.message {
  max-width: 760px;
  margin-bottom: 16px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  line-height: 1.7;
  white-space: pre-wrap;
}

.message.ai {
  background: var(--soft);
}

.message.user {
  margin-left: auto;
  background: #fff8ef;
  border-color: #ead7bf;
}

.speaker {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

.voice-box {
  padding: 18px 28px 24px;
  border-top: 1px solid var(--line);
  background: #fbfcfa;
}

.recording-meter {
  display: none;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  color: var(--warm);
  min-height: 24px;
}

.recording-meter.active {
  display: flex;
}

.recording-meter span {
  width: 5px;
  height: 10px;
  background: var(--warm);
  transform-origin: bottom;
  animation: idlePulse 0.8s ease-in-out infinite alternate;
}

.recording-meter span:nth-child(2) {
  animation-delay: 0.1s;
}

.recording-meter span:nth-child(3) {
  animation-delay: 0.2s;
}

.recording-meter span:nth-child(4) {
  animation-delay: 0.3s;
}

.recording-meter span:nth-child(5) {
  animation-delay: 0.4s;
}

.recording-meter strong {
  margin-left: 8px;
  font-size: 14px;
}

@keyframes idlePulse {
  from {
    transform: scaleY(0.55);
  }
  to {
    transform: scaleY(1.35);
  }
}

.transcript-box {
  display: block;
  width: 100%;
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  line-height: 1.6;
  resize: vertical;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.icon-btn,
.text-btn,
.wide-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.icon-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.icon-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.icon-btn.recording {
  background: var(--warm);
  border-color: var(--warm);
}

.text-btn,
.wide-btn {
  min-height: 42px;
  padding: 0 16px;
}

.text-btn:not(.ghost),
.wide-btn {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.text-btn.ghost {
  color: var(--muted);
}

.text-btn.confirm-ready {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.text-btn.confirmed {
  background: var(--soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.text-btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.wide-btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  background: #e6e9e5;
  border-color: var(--line);
  color: var(--muted);
}

.side-panel {
  min-height: calc(100vh - 40px);
  padding: 24px;
  overflow-y: auto;
}

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

.side-panel h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.admin-panel[hidden] {
  display: none;
}

.respondent-mode #skipBtn {
  display: none;
}

.respondent-mode #skipBtn.confirm-ready {
  display: inline-block;
}

.respondent-mode #modelStatus {
  display: none;
}

.field-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.field-input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  line-height: 1.5;
}

.field-area {
  resize: vertical;
}

.metric {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

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

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

.module-nav {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  border-top: 1px solid var(--line);
}

.module-nav li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.module-jump {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.module-jump span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  font-size: 12px;
}

.module-jump strong {
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
}

.module-jump small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

.module-nav li.active {
  color: var(--ink);
}

.module-nav li.active span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.module-nav li.done span {
  background: var(--soft);
  color: var(--accent-strong);
}

.module-nav li.selected {
  color: var(--accent-strong);
}

.module-review {
  margin: 0 0 20px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fbfcfa;
}

.module-review h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.review-question,
.empty-review,
.review-answers p {
  color: var(--muted);
  line-height: 1.65;
}

.review-question {
  max-height: 120px;
  overflow: auto;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.review-answers article {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.review-answers article span {
  display: block;
  margin-bottom: 4px;
  color: var(--warm);
  font-size: 12px;
}

.review-answers p {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.module-review .wide-btn {
  margin-top: 12px;
}

.drawer-backdrop {
  display: none;
}

.rules {
  margin: 20px 0;
  padding: 16px;
  background: var(--soft);
  border: 1px solid var(--line);
}

.rules h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

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

.wide-btn {
  width: 100%;
}

.wide-btn.secondary {
  margin: 12px 0 8px;
  background: var(--accent);
  border-color: var(--accent);
}

.outline-panel {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fbfcfa;
}

.outline-panel h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.outline-panel .wide-btn {
  margin-top: 10px;
}

.outline-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}


@media (max-width: 900px) {
  .admin-workspace {
    padding: 12px;
  }

  .admin-hero,
  .admin-step,
  .profile-grid,
  .link-card {
    grid-template-columns: 1fr;
  }

  .admin-hero,
  .link-card {
    align-items: stretch;
  }

  .link-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .interview-panel {
    min-height: auto;
  }

  .nav-toggle,
  .panel-close {
    display: grid;
    place-items: center;
  }

  .panel-close {
    width: 36px;
    height: 36px;
    font-size: 22px;
  }

  .side-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 30;
    width: min(88vw, 360px);
    height: 100vh;
    min-height: 0;
    padding: 20px;
    transform: translateX(104%);
    transition: transform 0.22s ease;
  }

  .side-panel.open {
    transform: translateX(0);
  }

  .drawer-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 20;
    background: rgba(15, 24, 20, 0.28);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .progress-wrap,
  .chat,
  .voice-box {
    padding-left: 20px;
    padding-right: 20px;
  }

  h1 {
    font-size: 26px;
  }
}

.icon-btn[hidden] {
  display: none;
}
