/* 傲世数字人口播工作台 — 壳蓝 + 工作台 teal */
:root {
  /* shell (login / account) */
  --shell-primary: #4a76fd;
  --shell-primary-dark: #3a62e0;
  --shell-stone: #f0f2f7;
  --shell-paper: #ffffff;
  --shell-ink: #2d3436;
  --shell-mute: #8b93a7;
  /* studio (home / setup / create) */
  --bg: #f4f8f7;
  --surface: #ffffff;
  --surface-muted: #eef6fb;
  --ink: #0f172a;
  --text: #64748b;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --primary: #2f9ede;
  --teal: #2f9ede;
  --teal-dark: #1f80c4;
  --teal-soft: #e6f3fd;
  --navy: #245f8f;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.04);
  --max: 1440px;
  --font: "DM Sans", "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ── Shell ── */
.studio {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.studio-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.studio-bar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--teal), var(--navy));
  display: grid;
  place-items: center;
  color: #fff;
}
.brand-mark svg { width: 18px; height: 18px; fill: currentColor; }
.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}
.account-phone {
  font-size: 12px;
  color: var(--text);
}
.steps {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}
.step-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
  transition: background .15s, color .15s;
}
.step-link:hover { background: var(--teal-soft); color: var(--teal-dark); }
.step-link.active {
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.step-num {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.step-link.active .step-num {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.studio-main {
  flex: 1;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 20px 28px 48px;
}
.studio-main-wide {
  max-width: var(--max);
}

/* create · human-AI co-drive */
.create-split {
  --split-pct: 66%;
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: min(70vh, 720px);
}
.create-main {
  flex: 0 0 var(--split-pct);
  max-width: var(--split-pct);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.create-main #body {
  min-height: 280px;
  flex: 1;
}
.create-divider {
  flex: 0 0 8px;
  margin: 0 4px;
  cursor: col-resize;
  border-radius: 4px;
  background: transparent;
  position: relative;
}
.create-divider::after {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 3px;
  width: 2px;
  border-radius: 2px;
  background: var(--border);
}
.create-split.dragging .create-divider::after,
.create-divider:hover::after {
  background: var(--teal);
}
.create-assist {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
}
.assist-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.assist-head strong {
  font-size: 14px;
  font-weight: 700;
}
.assist-feed {
  flex: 1;
  min-height: 200px;
  max-height: min(48vh, 420px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 8px;
}
.assist-empty {
  margin: auto;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 24px 12px;
  line-height: 1.55;
}
.assist-msg {
  display: flex;
  flex-direction: column;
  max-width: 95%;
}
.assist-msg.user {
  align-self: flex-end;
  align-items: flex-end;
}
.assist-msg.assistant,
.assist-msg.error {
  align-self: flex-start;
  align-items: flex-start;
}
.assist-msg .bubble {
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.assist-msg.user .bubble {
  background: var(--teal-soft);
  color: var(--navy);
  border: 1px solid #c5e4f7;
}
.assist-msg.assistant .bubble {
  background: var(--surface-muted);
  color: var(--ink);
  border: 1px solid var(--border);
}
.assist-msg.error .bubble {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}
.sug-card {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--bg);
  width: 100%;
}
.sug-card.adopted { border-color: #a7f3d0; background: var(--success-bg); }
.sug-card.rejected { opacity: 0.55; }
.sug-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}
.sug-preview {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 8px;
}
.sug-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sug-done {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}
.assist-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.assist-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.assist-chip:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.assist-compose {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.assist-compose textarea {
  flex: 1;
  min-height: 52px;
  resize: vertical;
  margin: 0;
}
@media (max-width: 900px) {
  .create-split {
    flex-direction: column;
  }
  .create-main {
    flex: none;
    max-width: none;
  }
  .create-divider { display: none; }
  .create-assist {
    min-height: 360px;
  }
}

/* page title with teal rail */
.page-head {
  border-left: 3px solid var(--teal);
  padding-left: 14px;
  margin-bottom: 18px;
}
.page-head h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.page-head p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text);
}
.page-head:not(:has(p)) {
  margin-bottom: 16px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost {
  background: var(--surface);
  color: var(--navy);
  border-color: var(--border);
}
.btn-ghost:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: var(--teal-soft);
}
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
}

/* ── Surfaces ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 14px; }

/* wide run layout: progress/log | preview */
.run-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 20px;
  align-items: start;
}
@media (max-width: 960px) {
  .run-layout { grid-template-columns: 1fr; }
}
.run-main { min-width: 0; }
.run-side {
  position: sticky;
  top: 72px;
}
.run-side:empty,
.run-side[hidden] { display: none; }
.panel h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}
.panel .hint {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
  .steps { margin-left: 0; width: 100%; }
}

/* status chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
}
.chip.ready { background: var(--success-bg); color: var(--success); border-color: #a7f3d0; }
.chip.missing { background: var(--warn-bg); color: var(--warn); border-color: #fde68a; }
.chip.run { background: var(--warn-bg); color: var(--warn); border-color: #fde68a; }
.chip.ok { background: var(--success-bg); color: var(--success); border-color: #a7f3d0; }
.chip.fail { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }

/* ready row */
.ready-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 700px) {
  .ready-grid { grid-template-columns: 1fr; }
}
.ready-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--bg);
}
.ready-item .label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.ready-item .value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}

/* forms */
label.field {
  display: block;
  margin-bottom: 14px;
}
label.field > span {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
label.field .sub {
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}
input[type="text"],
input[type="file"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
}
textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.6;
}
input[type="file"] {
  padding: 8px;
  background: var(--bg);
}
.preview-box {
  margin-top: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  min-height: 160px;
  max-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  color: var(--muted);
  font-size: 13px;
  padding: 8px;
}
.preview-box img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
}
.preview-box audio { width: 100%; }

details.adv {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--bg);
}
details.adv summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
details.adv .body { margin-top: 10px; font-size: 13px; color: var(--text); }
.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}
.check input { margin-top: 3px; }

/* meta line */
.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text);
  margin-top: 8px;
}

/* job table */
.job-list { margin-top: 4px; }
.job-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.job-row:last-child { border-bottom: 0; }
.job-row .id {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.job-row .sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.empty {
  padding: 28px 8px;
  text-align: center;
  color: var(--text);
  font-size: 14px;
}
.empty a { color: var(--teal-dark); font-weight: 600; text-decoration: underline; }

/* progress */
.progress-wrap { margin: 16px 0; }
.progress-track {
  height: 8px;
  background: var(--surface-muted);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--teal);
  transition: width .35s ease;
}
.progress-bar.fail { background: var(--danger); }
.progress-bar.ok { background: var(--success); }
.phase-label {
  margin-top: 10px;
  font-size: 14px;
  font-weight: 600;
}
.phase-sub {
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
}
.job-log {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #0f172a;
  color: #e2e8f0;
  height: min(42vh, 360px);
  overflow-y: auto;
  padding: 10px 12px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}
.job-log .log-line {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  padding: 2px 0;
  border-bottom: 1px solid rgb(148 163 184 / 0.12);
}
.job-log .log-line:last-child { border-bottom: 0; }
.job-log .log-t {
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.job-log .log-msg { color: #e2e8f0; word-break: break-word; }
.job-log .log-empty { color: #64748b; padding: 24px 8px; text-align: center; }
.err-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  white-space: pre-wrap;
}
.phone-frame {
  margin: 0 auto;
  width: min(100%, 280px);
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.phone-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.preview-heading {
  margin-top: 18px;
  font-size: 15px;
  font-weight: 700;
}

/* site-wide job completion banner */
.notify-host {
  position: sticky;
  top: 52px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 28px;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  pointer-events: none;
}
.notify-host:empty { display: none; padding: 0; }
.notify-banner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid #a7f3d0;
  background: var(--success-bg);
  color: var(--success);
  box-shadow: var(--shadow);
  animation: toast-in .2s ease;
}
.notify-banner.fail {
  border-color: #fecaca;
  background: var(--danger-bg);
  color: var(--danger);
}
.notify-body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  font-size: 13px;
  min-width: 0;
}
.notify-body strong { font-size: 14px; }
.notify-id {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  word-break: break-all;
}
.notify-link {
  font-weight: 700;
  text-decoration: underline;
  color: inherit;
}
.notify-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
  opacity: 0.7;
}
.notify-close:hover { opacity: 1; }

.bg-launch {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid #a7f3d0;
  background: var(--success-bg);
}
.bg-launch-msg {
  font-size: 13px;
  color: var(--success);
  line-height: 1.5;
  margin: 0;
}

/* toast */
.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgb(15 23 42 / 0.18);
  animation: toast-in .2s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--success); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.cta-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
.note-bar {
  font-size: 13px;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

/* ── Login shell (#4A76FD) ── */
.shell-page {
  min-height: 100vh;
  background: var(--shell-primary);
  display: grid;
  place-items: center;
  padding: 32px 16px;
  position: relative;
  overflow: hidden;
  color: var(--shell-ink);
}
.shell-glow {
  position: absolute;
  inset: -20% auto auto -10%;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 65%);
  pointer-events: none;
}
.shell-glow::after {
  content: "";
  position: absolute;
  right: -40vmax;
  bottom: -20vmax;
  width: 50vmax;
  height: 50vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%);
}
.shell-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--shell-paper);
  border-radius: 16px;
  padding: 28px 24px 22px;
  box-shadow: 0 16px 48px rgb(15 23 42 / 0.18);
}
.shell-brand {
  text-align: center;
  margin-bottom: 22px;
}
.shell-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--shell-primary), #6b8fff);
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  color: #fff;
}
.shell-mark svg { width: 22px; height: 22px; fill: currentColor; }
.shell-brand h1 {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--shell-ink);
}
.shell-brand p {
  margin-top: 8px;
  font-size: 13px;
  color: var(--shell-mute);
  line-height: 1.5;
}
.shell-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--shell-ink);
}
.shell-phone {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--shell-stone);
  overflow: hidden;
}
.shell-cc {
  padding: 0 12px;
  font-size: 13px;
  color: var(--shell-mute);
  border-right: 1px solid var(--border);
}
.shell-phone input,
.shell-code-row input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  outline: none;
  font-size: 15px;
}
.shell-code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.shell-code-row input {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--shell-stone);
  min-width: 0;
}
.btn-shell {
  width: 100%;
  margin-top: 8px;
  background: var(--shell-primary);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 15px;
}
.btn-shell:hover { background: var(--shell-primary-dark); }
.btn-shell:disabled { opacity: .55; cursor: not-allowed; }
.btn-shell-ghost {
  flex-shrink: 0;
  background: #fff;
  color: var(--shell-primary);
  border: 1px solid #c9d6ff;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 650;
  font-size: 13px;
  white-space: nowrap;
}
.btn-shell-ghost:hover { background: #eef2ff; }
.btn-shell-ghost:disabled { opacity: .55; cursor: not-allowed; }
.shell-error {
  min-height: 0;
  font-size: 12px;
  color: var(--danger);
  margin-bottom: 4px;
  display: none;
}
.shell-error.is-on { display: block; }
.shell-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 11px;
  color: var(--shell-mute);
  line-height: 1.55;
}
.shell-captcha { display: none; }
