/* 站点样式：前台 390px 优先，后台宽表；无构建、无第三方 CSS。 */

:root {
  --bg: #f5f2ec;
  --surface: #fffdf9;
  --ink: #1c1f1e;
  --muted: #5f645f;
  --line: #ded8cd;
  --line-strong: #c9c2b5;
  --accent: #0f6b5c;
  --accent-soft: #e8f2ee;
  --warn: #a33d1e;
  --warn-bg: #fbeee8;
  --ok: #0f6b5c;
  --radius: 20px;
  --shadow: 0 1px 0 rgba(28, 31, 30, 0.04), 0 16px 40px rgba(28, 31, 30, 0.06);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  color: var(--ink);
  background: var(--bg);
  font-family: ui-sans-serif, "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
    "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.front-page {
  background:
    radial-gradient(900px 460px at 50% -120px, #e4f1ea 0%, rgba(228, 241, 234, 0) 72%),
    var(--bg);
}

a {
  color: var(--accent);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

:focus-visible {
  outline: 3px solid rgba(15, 107, 92, 0.3);
  outline-offset: 2px;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ui-icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: currentColor;
}

.shell {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 16px 40px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.22;
}

.brand-text strong {
  font-size: 15px;
}

.tag {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

/* ---------- 按钮 ---------- */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 10px 16px;
}

.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 10px 16px;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  text-decoration: none;
}

.wide {
  width: 100%;
}

/* ---------- 卡片与首屏 ---------- */
.card {
  margin-bottom: 16px;
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -54px;
  top: -54px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--accent-soft);
  pointer-events: none;
}

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

h1 {
  position: relative;
  margin: 8px 0 12px;
  font-size: clamp(26px, 7vw, 34px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 15px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border: 1px solid #dfe9e3;
  border-radius: 12px;
  background: #f3f8f5;
  min-width: 0;
}

.step-index {
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  flex: none;
}

.steps b {
  display: block;
  font-size: 13px;
  line-height: 1.3;
}

.steps small {
  color: var(--accent);
  font-size: 11px;
}

.fineprint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12.5px;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- 上传 ---------- */
.step-no {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

h2 {
  margin: 4px 0 6px;
  font-size: 19px;
  line-height: 1.35;
}

.hint {
  margin: 8px 0;
  color: var(--muted);
  font-size: 15px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  margin-top: 6px;
  padding: 18px;
  border: 1.5px dashed #b9c9c1;
  border-radius: 14px;
  background: #fafbf9;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dropzone.is-drag {
  border-color: var(--accent);
  background: #edf6f1;
}

.dropzone-title {
  font-weight: 600;
}

.dropzone-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.file-preview[hidden] {
  display: none;
}

#file-thumb {
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: cover;
  flex: none;
}

.file-meta {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

/* ---------- 原始依据条（S1/S2/S3） ---------- */
.input-source-host {
  margin: 0 0 12px;
}

.input-source-host[hidden] {
  display: none;
}

.input-context {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.input-context-thumb {
  flex: none;
  display: block;
  width: 96px;
  height: 120px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f1ede5;
}

.input-context-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f1ede5;
}

.input-context-panels {
  display: grid;
  gap: 6px;
  padding: 8px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.input-context-panel-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.input-context-panel-thumb {
  flex: none;
  display: block;
  width: 62px;
  height: 82px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1ede5;
}

.input-context-panel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.input-context-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.input-context-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.input-context-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.input-context-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.input-context-open {
  flex: none;
}

/* ---------- 生成依据（S5） ---------- */
.gen-source-card {
  display: grid;
  gap: 12px;
}

.gen-source-card[hidden] {
  display: none;
}

.gen-source-title {
  margin: 4px 0 0;
  font-size: 17px;
  line-height: 1.35;
}

.gen-source-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.gen-source-thumb {
  flex: none;
  display: block;
  width: 118px;
  height: 118px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f1ede5;
}

.gen-source-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f1ede5;
}

.gen-source-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 5px;
}

.gen-source-fact {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.gen-source-fact-label {
  display: inline-block;
  min-width: 64px;
  color: var(--muted);
}

.gen-source-materials {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.gen-source-materials-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.gen-source-material-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.gen-source-material {
  flex: 0 0 92px;
  display: grid;
  gap: 3px;
  color: var(--ink);
  text-decoration: none;
}

.gen-source-material img {
  width: 92px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 10px;
  object-fit: cover;
  background: #f1ede5;
}

.gen-source-material-name {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.file-meta strong {
  overflow-wrap: anywhere;
}

.file-meta span {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.error-text {
  margin: 10px 0;
  padding: 8px 10px;
  border: 1px solid #f0d4c8;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13px;
}

.error-text[hidden] {
  display: none;
}

/* ---------- job 进度 ---------- */
.job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.status-badge {
  padding: 5px 10px;
  border: 1px solid #d7e1da;
  border-radius: 999px;
  background: #eef2ef;
  color: #2d4a3f;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.is-running {
  border-color: #c9e2da;
  background: var(--accent-soft);
  color: var(--accent);
}

.status-badge.is-completed {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.status-badge.is-failed {
  border-color: #eccabb;
  background: var(--warn-bg);
  color: var(--warn);
}

.status-badge.is-waiting {
  border-color: #ead9a9;
  background: #faf1db;
  color: #74560f;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f7f4ee;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.status-tag.is-completed {
  border-color: #cfe0d7;
  background: #f3f8f5;
  color: #2d4a3f;
}

.job-id {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.progress-line {
  margin: 12px 0 8px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stage-list {
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

.stage-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #efebe3;
}

.stage-list li:last-child {
  border-bottom: 0;
}

.stage-dot {
  width: 12px;
  height: 12px;
  margin: auto;
  border: 2px solid #c9c2b6;
  border-radius: 50%;
  background: #fff;
}

.stage-list li.is-done .stage-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.stage-list li.is-active .stage-dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 107, 92, 0.16);
}

.stage-list li.is-failed .stage-dot {
  border-color: var(--warn);
  background: var(--warn);
}

.stage-name {
  min-width: 0;
}

.stage-name b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.stage-state {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.stage-list li.is-active .stage-state {
  color: var(--accent);
  font-weight: 700;
}

.job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* ---------- 结果卡 ---------- */
.result-card h2 {
  margin-top: 0;
}

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

.result-card .result-strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- 报告卡 ---------- */
.report-head {
  margin-bottom: 2px;
}

.report-head .eyebrow {
  margin: 0;
}

.report-title {
  margin: 4px 0 6px;
  font-size: 22px;
  line-height: 1.3;
}

.report-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.report-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.report-section-head {
  margin-bottom: 8px;
}

.report-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.report-section-title .ui-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.report-summary {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: clamp(20px, 5.8vw, 26px);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.report-summary.is-empty,
.report-empty,
.design-text.is-empty {
  color: var(--muted);
  font-weight: 400;
}

.report-empty {
  margin: 8px 0 0;
  font-size: 14px;
}

.fact-list {
  border-top: 1px solid #efebe3;
}

.fact-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #efebe3;
}

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

.fact-label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.fact-value {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.fact-flag {
  justify-self: start;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f1ea;
  color: var(--muted);
  font-size: 12.5px;
}

.fact-flag.is-unreadable {
  border-color: #eccabb;
  background: var(--warn-bg);
  color: var(--warn);
}

.problem-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.problem-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.severity-chip {
  min-width: 30px;
  padding: 2px 8px;
  border: 1px solid #ead9a9;
  border-radius: 999px;
  background: #faf1db;
  color: #74560f;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.severity-chip.is-high {
  border-color: #eccabb;
  background: var(--warn-bg);
  color: var(--warn);
}

.severity-chip.is-low {
  border-color: var(--line);
  background: #f4f1ea;
  color: var(--muted);
}

.problem-group-count {
  color: var(--muted);
  font-size: 12.5px;
}

.problem-item {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #e8e2d7;
  border-radius: 12px;
  background: #fcfaf5;
}

.problem-item:last-child {
  margin-bottom: 0;
}

.problem-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  margin-bottom: 4px;
}

.problem-type {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.problem-where {
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.problem-text {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.problem-detail {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.problem-detail-label {
  color: var(--ink);
  font-weight: 600;
}

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

.action-col {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e8e2d7;
  border-radius: 12px;
  background: #fcfaf5;
}

.action-title {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 14px;
}

.action-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.action-list {
  margin: 0;
  padding-left: 18px;
}

.action-list li {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.action-list li:last-child {
  margin-bottom: 0;
}

.design-block {
  margin-top: 10px;
}

.design-title {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 14px;
}

.design-text {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.plan-list {
  margin: 0;
  padding-left: 18px;
}

.plan-item {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.plan-text {
  font-weight: 600;
}

.plan-meta {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.report-disclaimer {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------- 门店信息表单 ---------- */
.store-form {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #fafbf9;
}

.store-summary {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 13px 14px 13px 30px;
  cursor: pointer;
}

.store-summary::before {
  content: "▸";
  position: absolute;
  left: 13px;
  top: 15px;
  color: var(--accent);
  font-size: 13px;
}

.store-form[open] .store-summary::before {
  content: "▾";
}

.store-form[open] .store-summary {
  border-bottom: 1px solid #e8e2d7;
}

.store-form-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.store-form-title .ui-icon {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.store-form-sub {
  color: var(--muted);
  font-size: 12.5px;
}

.store-form-body {
  padding: 14px;
}

.store-form-body .hint {
  margin: 0 0 10px;
  font-size: 13.5px;
}

.store-optional {
  margin: 4px 0 14px;
  padding-top: 10px;
  border-top: 1px dashed #e4ddd0;
}

.store-optional-summary {
  padding: 3px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 13.5px;
}

.store-optional[open] .store-optional-summary {
  margin-bottom: 10px;
}

.store-optional-body .form-field:last-child {
  margin-bottom: 0;
}

.form-field {
  margin: 0 0 12px;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
}

.form-label-text {
  color: var(--ink);
}

.required-mark {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.recommended-mark {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f4efe4;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.form-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

textarea.form-input {
  min-height: 72px;
  resize: vertical;
}

.form-field.has-error .form-input {
  border-color: var(--warn);
  background: #fff8f4;
}

.field-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.field-error {
  margin: 4px 0 0;
  color: var(--warn);
  font-size: 13px;
  line-height: 1.45;
}

.field-error[hidden],
.form-status[hidden] {
  display: none;
}

.form-status {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13.5px;
}

.form-status.is-error {
  border: 1px solid #eccabb;
  background: var(--warn-bg);
  color: var(--warn);
}

.form-status.is-ok {
  border: 1px solid #c9e2da;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- 付费分界 ---------- */
.paywall-band {
  margin: 0 0 16px;
  padding: 18px;
  border: 2px dashed #d9b45f;
  border-radius: 16px;
  background: #fdf6e6;
  box-shadow: var(--shadow);
}

.paywall-kicker {
  margin: 0;
  color: #8a5a12;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.paywall-title {
  margin: 6px 0 8px;
  font-size: 22px;
  line-height: 1.35;
}

.paywall-text {
  margin: 0 0 8px;
  color: #5c4a28;
  font-size: 15px;
  line-height: 1.6;
}

.paywall-band .secondary-btn {
  margin-top: 4px;
  border-color: #d9b45f;
  background: #fffdf6;
  color: #6b4a10;
}

/* ---------- 第 2 步：素材模式 ---------- */
.generate-card .section-head {
  margin-bottom: 10px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 12px 0;
}

.mode-card {
  position: relative;
  display: block;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}

.mode-card.is-checked {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.mode-card:focus-within {
  outline: 3px solid rgba(15, 107, 92, 0.3);
  outline-offset: 2px;
}

.mode-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.mode-name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.mode-name .ui-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.mode-card.is-checked .mode-name .ui-icon,
.output-card.is-checked .mode-name .ui-icon {
  color: var(--accent);
}

.mode-flag {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
}

.mode-desc {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.material-title {
  margin: 16px 0 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.material-dropzone {
  min-height: 120px;
}

.material-dropzone[hidden] {
  display: none;
}

.material-count {
  margin: 10px 0 4px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.material-count[hidden] {
  display: none;
}

.material-count.is-warn {
  color: var(--warn);
  font-weight: 600;
}

.material-grid-head {
  margin: 8px 0 6px;
}

.material-grid-head[hidden] {
  display: none;
}

.material-grid-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

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

.material-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 6px;
  padding: 8px;
  border: 1px solid #e8e2d7;
  border-radius: 12px;
  background: #fcfaf5;
}

.material-item.is-sortable {
  cursor: grab;
}

.material-item.is-dragging {
  opacity: 0.55;
}

.material-item.is-drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.material-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: #eceae4;
  object-fit: cover;
}

.material-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.material-order {
  font-size: 13px;
  line-height: 1.4;
}

.material-name,
.material-dims {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.material-dims {
  font-variant-numeric: tabular-nums;
}

.material-caption {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
}

.material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.material-actions .ghost-btn {
  min-height: 44px;
  border-color: var(--line);
  background: #fff;
  padding: 0 10px;
  font-size: 13px;
}

.material-actions .ghost-btn:disabled {
  opacity: 0.4;
}

.material-errors {
  margin: 10px 0 0;
  padding: 10px 12px 10px 28px;
  border: 1px solid #f0d4c8;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13px;
  line-height: 1.55;
}

.material-errors[hidden] {
  display: none;
}

.material-errors li {
  margin: 2px 0;
  overflow-wrap: anywhere;
}

/* ---------- 生成进度 ---------- */
.gen-progress-card .gen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.gen-head-main {
  min-width: 0;
}

.gen-head-main h2 {
  margin: 4px 0 0;
}

.gen-head-main h3 {
  margin: 0;
}

.gen-progress-line {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.gen-meta {
  margin: 10px 0 0;
}

.gen-time,
.gen-eta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.gen-request-bar {
  display: flex;
  gap: 4px;
  min-height: 10px;
  margin-top: 14px;
}

.gen-request-bar.is-percent {
  display: block;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #efebe3;
}

.gen-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.35s ease;
}

.gen-progress-fill.is-running {
  background: #7fb3a8;
  box-shadow: inset 0 0 0 1px rgba(15, 107, 92, 0.16);
}

.gen-progress-fill.is-failed {
  background: var(--warn);
}

.gen-request-bar.is-empty {
  height: 10px;
  border-radius: 999px;
  background: #efebe3;
}

.gen-request-seg {
  flex: 1 1 0;
  min-width: 4px;
  height: 10px;
  border-radius: 999px;
  background: #e8e2d7;
}

.gen-request-seg.is-done {
  background: var(--accent);
}

.gen-request-seg.is-running {
  background: #7fb3a8;
  box-shadow: 0 0 0 2px rgba(15, 107, 92, 0.14);
}

.gen-request-seg.is-failed {
  background: var(--warn);
}

.gen-request-caption {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.gen-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

#gen-cancel[hidden] {
  display: none;
}

.gen-alert {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid #ead9a9;
  border-radius: 10px;
  background: #faf1db;
  color: #74560f;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.gen-alert[hidden] {
  display: none;
}

.gen-stage-list {
  margin-top: 14px;
}

.gen-stage-list li {
  display: block;
  padding: 0;
  border-bottom: 1px solid #efebe3;
}

.gen-stage-list li:last-child {
  border-bottom: 0;
}

.gen-stage-row {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 10px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.gen-stage-row:hover {
  background: #faf7f0;
}

.gen-stage-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
}

.gen-stage-state .ui-icon {
  width: 13px;
  height: 13px;
}

.gen-stage-state.is-running,
.gen-stage-state.is-retrying {
  color: var(--accent);
}

.gen-stage-state.is-failed {
  color: var(--warn);
}

.gen-stage-state.is-done,
.gen-stage-state.is-skip {
  color: #2d4a3f;
}

/* 取消后的终止态：主表意仍是文字「已终止」；只做轻微降透明度，
   不引入新的警告色语义，也不与「等待」完全相同。 */
.gen-stage-state.is-stopped {
  color: var(--muted);
  opacity: 0.7;
}

.gen-stage-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.gen-stage-main b {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.gen-stage-explain {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.gen-stage-right {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.gen-stage-detail {
  padding: 2px 0 14px 58px;
}

.gen-detail-block {
  margin-top: 10px;
}

.gen-detail-title {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
}

.gen-detail-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.gen-detail-note.is-warn {
  color: var(--warn);
}

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

.gen-unit {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f4ed;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.gen-unit.is-done {
  border-color: #c9e2da;
  background: var(--accent-soft);
  color: var(--accent);
}

.gen-unit.is-running {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.gen-unit.is-failed {
  border-color: #eccabb;
  background: var(--warn-bg);
  color: var(--warn);
}

/* P3-2：取消后的小格用虚线表示“不再继续”，不改警告色语义。 */
.gen-unit.is-stopped {
  border-style: dashed;
  background: transparent;
  color: var(--muted);
}

.gen-attempt-list {
  margin: 0;
  padding-left: 18px;
}

.gen-attempt {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.gen-attempt:last-child {
  margin-bottom: 0;
}

.gen-thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gen-thumb-link {
  display: block;
  min-width: 0;
  border-radius: 9px;
}

.gen-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #eceae4;
  object-fit: cover;
}

/* ---------- 成稿卡 / 失败卡 ---------- */
.gen-final-card .gen-head,
.gen-fail-card .gen-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.gen-final-label {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.gen-whole-scroll {
  overflow-x: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f4ed;
  -webkit-overflow-scrolling: touch;
}

.gen-whole-scroll img {
  display: block;
  height: 168px;
  width: auto;
  max-width: none;
  border-radius: 6px;
}

.gen-whole-scroll.is-empty {
  padding: 14px;
}

.gen-whole-scroll .gen-detail-note {
  margin: 0;
}

.gen-final-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gen-final-tile {
  display: block;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eceae4;
  overflow: hidden;
}

.gen-final-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1279 / 960;
  object-fit: cover;
}

.gen-final-tile:focus-visible {
  outline: 3px solid rgba(15, 107, 92, 0.3);
  outline-offset: 2px;
}

.gen-final-summary {
  margin: 14px 0 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.gen-final-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.gen-final-actions a.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.gen-final-actions .primary-btn[hidden] {
  display: none;
}

.gen-fail-where {
  margin: 12px 0 6px;
  color: var(--warn);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.gen-fail-reason,
.gen-fail-kept {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.gen-fail-kept {
  color: var(--muted);
}

.gen-fail-id-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
}

.gen-fail-id-line .job-id {
  overflow-wrap: anywhere;
}

.gen-fail-id-line .ghost-btn {
  min-height: 44px;
  border-color: var(--line);
  background: #fff;
}

.gen-fail-card .job-actions .secondary-btn {
  flex: 1 1 150px;
}

/* ---------- 成稿放大弹层 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 24, 22, 0.92);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 760px;
}

.lightbox-card img {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 12px;
  background: #141816;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(20, 24, 22, 0.9);
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
}

/* ---------- 弹层 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 24, 22, 0.5);
}

.modal[hidden] {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(20, 24, 22, 0.24);
}

.modal-card h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.confirm-actions .primary-btn,
.confirm-actions .secondary-btn {
  width: 100%;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
  font-size: 13px;
}

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

.field input {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

/* ---------- 后台 ---------- */
.admin-shell {
  max-width: 1080px;
}

#admin-main.is-locked {
  opacity: 0.45;
  pointer-events: none;
}

.health-bar {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
}

.seg-btn {
  min-height: 44px;
  padding: 9px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.seg-note {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.seg-btn.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.switch {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.admin-card {
  padding: 18px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table thead th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f3f1ea;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
}

.admin-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid #efebe3;
  vertical-align: top;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table td:first-child {
  color: var(--muted);
  white-space: nowrap;
}

.admin-table .ov-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.admin-table.is-empty {
  opacity: 0.4;
}

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

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

.admin-detail-head h2 {
  margin: 2px 0 0;
}

.admin-detail-meta,
.admin-progress-line {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.admin-subcard {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.admin-detail-grid .admin-subcard {
  margin-top: 0;
}

.admin-subcard h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.admin-subcard .admin-table {
  min-width: 420px;
  font-size: 13px;
}

.admin-subcard .admin-table thead th,
.admin-subcard .admin-table tbody td {
  padding: 7px 8px;
}

.admin-job-row {
  cursor: pointer;
}

.admin-job-row:hover,
.admin-job-row.is-selected {
  background: var(--accent-soft);
}

.admin-job-row .job-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.admin-artifact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.admin-artifact {
  display: block;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.admin-artifact img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 7px;
  background: #f1ede4;
}

.admin-artifact span {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-artifact .admin-artifact-file {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-top: 0;
  border-radius: 7px;
  background: #f1ede4;
  color: var(--muted);
  font-size: 14px;
}

.admin-artifact:hover {
  border-color: var(--accent);
}

.admin-artifact-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-raw {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.admin-raw summary {
  cursor: pointer;
}

.admin-raw pre {
  max-height: 420px;
  margin: 10px 0 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf7;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .admin-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
}

.q {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  cursor: help;
  vertical-align: middle;
}

.error-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #eccabb;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13px;
}

.error-banner[hidden] {
  display: none;
}

.empty-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
}

.empty-note[hidden] {
  display: none;
}

.empty-note button {
  margin-left: 6px;
  padding: 2px 6px;
  border: 0;
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 24px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

@media (min-width: 560px) {
  .action-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

@media (min-width: 700px) {
  .hero-actions {
    flex-direction: row;
  }

  .hero-actions .primary-btn,
  .hero-actions .secondary-btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* M6-A：双流水线单选与流水线标签 */
.pipeline-picker {
  margin: 18px 0 14px;
  padding: 14px 16px;
  border: 1px solid #d9e2ea;
  border-radius: 12px;
  background: #f8fbfd;
}
.pipeline-picker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.pipeline-picker-title {
  font-weight: 700;
  color: #1f3b50;
}
.pipeline-picker-current {
  font-size: 12px;
  color: #5b7487;
}
.pipeline-options {
  display: grid;
  gap: 8px;
}
.pipeline-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d9e2ea;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.pipeline-option.is-archived {
  border-style: dashed;
  background: #fbfbfb;
}
.pipeline-option:has(input:checked) {
  border-color: #2f6f95;
  box-shadow: 0 0 0 1px #2f6f95 inset;
}
.pipeline-option input {
  margin-top: 3px;
  accent-color: #2f6f95;
}
.pipeline-option-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}
.pipeline-option-badge {
  padding: 1px 7px;
  border-radius: 999px;
  background: #f2e7d7;
  color: #7a5325;
  font-size: 11px;
}
.pipeline-option-badge.is-recommended {
  background: #e5f1e8;
  color: #2d6240;
}
.gen-pipeline-line {
  margin: 6px 0 10px;
  padding: 6px 10px;
  border-left: 3px solid #8fb5cc;
  border-radius: 6px;
  background: #f4f9fc;
  color: #34566c;
  font-size: 13px;
}

/* ============================================================
   多屏工作台（docs/27）
   桌面：左侧任务栏 + 右侧横向六屏；手机：抽屉侧栏 + 单列。
   ============================================================ */
.workspace-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
}

.workspace-shell > .topbar {
  grid-column: 1 / -1;
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 242, 236, 0.92);
  backdrop-filter: blur(12px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-sidebar {
  align-self: start;
  position: sticky;
  top: 65px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: calc(100vh - 65px);
  padding: 18px 12px 24px 18px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 10px;
}

.sidebar-head strong {
  font-size: 13px;
  letter-spacing: 0.06em;
}

.sidebar-head .secondary-btn.compact {
  min-height: 34px;
  padding: 4px 10px;
  font-size: 12px;
}

.job-tree {
  display: grid;
  gap: 10px;
}

.job-group {
  display: grid;
  gap: 4px;
}

.job-parent-btn,
.job-child-btn {
  display: grid;
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.job-parent-btn {
  gap: 2px;
  padding: 9px 10px;
}

.job-parent-btn:hover,
.job-child-btn:hover {
  background: #eeeae1;
}

.job-parent-btn.is-active {
  border-color: #bcd6cc;
  background: var(--accent-soft);
}

.job-parent-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-parent-meta {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.job-children {
  display: grid;
  gap: 2px;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.job-child-btn {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.job-child-btn span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-child-btn.is-active {
  background: #fffdf9;
  color: var(--ink);
  font-weight: 600;
}

.job-child-status {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.sidebar-empty,
.sidebar-foot {
  margin: 14px 4px 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.sidebar-empty[hidden] {
  display: none;
}

.workspace-main {
  width: 100%;
  max-width: 1120px;
  min-width: 0;
  margin: 0 auto;
  padding: 22px 28px 36px;
}

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

.workspace-head h1 {
  margin: 2px 0 0;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.workspace-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.mobile-sidebar-toggle {
  display: none;
}

.screen-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.screen-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  min-height: 40px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf9;
  color: var(--muted);
  font-size: 13px;
}

.screen-tab .ui-icon {
  width: 15px;
  height: 15px;
  opacity: 0.8;
}

.screen-tab.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.screen-tab.is-active .ui-icon {
  opacity: 1;
}

.workspace-screens {
  min-width: 0;
}

.ws-screen {
  display: none;
  min-width: 0;
}

.ws-screen.is-active {
  display: block;
}

.screen-head {
  margin-bottom: 10px;
}

.screen-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 0;
  font-size: 19px;
  line-height: 1.3;
}

.screen-head h2 .ui-icon {
  width: 19px;
  height: 19px;
  color: var(--accent);
}

.step-no {
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.08em;
}

.screen-empty {
  margin: 0 0 16px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--muted);
  font-size: 14px;
}

.screen-empty[hidden] {
  display: none;
}

.screen-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--line);
}

.screen-nav .secondary-btn {
  min-width: 92px;
}

.screen-position {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.workspace-footer {
  padding: 8px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

/* 输出类型 */
.output-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.output-card {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.output-card.is-checked {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
  background: var(--accent-soft);
}

.output-card.is-disabled,
.output-card:disabled {
  width: 100%;
  color: var(--muted);
  background: #f1f1ed;
  border-color: var(--line);
  box-shadow: none;
  cursor: not-allowed;
  text-align: left;
  font: inherit;
}

.output-card.is-disabled .mode-desc {
  color: #8c8c86;
}

.mode-flag.is-muted {
  background: #e7e7e1;
  color: #77776f;
}

.output-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* 头图设置 */
.headshot-settings {
  margin: 4px 0 16px;
  padding: 14px 14px 12px;
  border: 1px solid #d9e2d7;
  border-radius: 12px;
  background: #f8fbf7;
}

.headshot-settings[hidden] {
  display: none;
}

.mode-grid[hidden],
.store-form-host[hidden],
.output-type-grid[hidden],
.pipeline-picker[hidden],
.paywall-band[hidden],
.generate-card[hidden] {
  display: none;
}

.dish-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 10px;
}

.dish-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.dish-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.dish-option input {
  accent-color: var(--accent);
}

.dish-add-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.dish-add-row input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
}

.dish-add-row .secondary-btn.compact {
  min-height: 42px;
  padding: 6px 12px;
}

.dish-count {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* 头图成稿 */
.headshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin: 10px 0 14px;
}

.headshot-item {
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8f2;
}

.headshot-image-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #eee9df;
  overflow: hidden;
  position: relative;
}

.headshot-image-btn img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.headshot-item figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* 同一屏里的卡片统一占满内容列，避免证据条与正文卡宽度不一致 */
.generate-card,
.gen-progress-card,
.gen-final-card,
.gen-fail-card,
.report-fixes-card,
.result-card {
  max-width: none;
}

.store-form-host .store-form {
  margin-top: 8px;
}

.pricing-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* 宽屏：报告两栏 */
@media (min-width: 1180px) {
  .result-card .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 平板/手机：侧栏改抽屉，六屏单列 */
@media (max-width: 900px) {
  .workspace-shell {
    grid-template-columns: 1fr;
  }

  .workspace-shell > .topbar {
    padding: 10px 14px;
  }

  .workspace-sidebar {
    position: fixed;
    top: 60px;
    bottom: 0;
    left: 0;
    z-index: 35;
    width: min(300px, 86vw);
    max-height: none;
    padding: 16px 12px 24px;
    border-right: 1px solid var(--line);
    background: var(--bg);
    box-shadow: 16px 0 40px rgba(28, 31, 30, 0.12);
    transform: translateX(-104%);
    transition: transform 0.2s ease-out;
  }

  .workspace-sidebar.is-open {
    transform: translateX(0);
  }

  .workspace-main {
    padding: 16px 14px 28px;
  }

  .workspace-head {
    gap: 10px;
  }

  .mobile-sidebar-toggle {
    display: inline-flex;
  }

  .screen-tabs {
    flex-wrap: wrap;
    overflow: visible;
    margin-right: 0;
    padding-right: 0;
  }

  .screen-nav .secondary-btn {
    min-width: 78px;
  }

  .output-type-grid {
    grid-template-columns: 1fr;
  }

  .headshot-grid {
    grid-template-columns: 1fr;
  }

  .generate-card,
  .gen-progress-card,
  .gen-final-card,
  .gen-fail-card,
  .report-fixes-card,
  .result-card {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .topbar-actions .ghost-btn {
    padding: 4px 6px;
    font-size: 12px;
  }

  .brand-text strong {
    font-size: 14px;
  }

  .workspace-head h1 {
    font-size: 21px;
  }

  .screen-tab {
    padding: 6px 10px;
    font-size: 12px;
  }

  .input-context {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }

  .input-context-thumb {
    width: 72px;
    height: 92px;
  }

  .input-context-body {
    grid-column: 2;
  }

  .input-context-open {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .gen-source-main {
    gap: 10px;
  }

  .gen-source-thumb {
    width: 96px;
    height: 96px;
  }

  .gen-source-fact-label {
    min-width: 58px;
  }

  .screen-head h2 {
    font-size: 17px;
  }
}
