:root {
  --bg: #f7f6f2;
  --panel: #ffffff;
  --panel-soft: #fbfaf7;
  --ink: #24211c;
  --muted: #706b63;
  --line: #e4dfd5;
  --line-strong: #d1c8ba;
  --accent: #2f6f63;
  --accent-soft: #e8f2ef;
  --warn: #9c6428;
  --warn-soft: #fff5e7;
  --danger: #9f3a36;
  --danger-soft: #fbecea;
  --shadow: 0 18px 50px rgba(42, 36, 26, 0.08);
  --radius: 8px;
  --max: 1180px;
}

body[data-theme="home"] {
  --bg: #eef3f7;
  --panel: #fbfcfd;
  --panel-soft: #f3f7fa;
  --ink: #111926;
  --muted: #5f6b78;
  --line: #d9e2ea;
  --line-strong: #b7c6d5;
  --accent: #1d4f7a;
  --accent-soft: #e2eef7;
  --warn: #7a5a22;
  --warn-soft: #fff7df;
  --shadow: 0 22px 60px rgba(11, 24, 39, 0.1);
}

body[data-theme="wechat"] {
  --bg: #edf8f6;
  --panel: #ffffff;
  --panel-soft: #f3fbfa;
  --ink: #102522;
  --muted: #5d736f;
  --line: #d3e8e4;
  --line-strong: #a8d2ca;
  --accent: #147a69;
  --accent-soft: #ddf3ef;
  --shadow: 0 22px 60px rgba(10, 94, 80, 0.1);
}

body[data-theme="xiaohongshu"] {
  --bg: #fff3ee;
  --panel: #fffdfb;
  --panel-soft: #fff7f3;
  --ink: #311813;
  --muted: #7b6259;
  --line: #efd7ce;
  --line-strong: #e8b7a3;
  --accent: #d94b31;
  --accent-soft: #ffe1d8;
  --shadow: 0 22px 60px rgba(186, 63, 37, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 32%),
    radial-gradient(circle at 88% 12%, color-mix(in srgb, var(--accent-soft) 78%, transparent), transparent 28%),
    var(--bg);
  font-family: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(var(--max), calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  font-weight: 750;
  color: var(--accent);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(22px, 2.5vw, 32px);
  line-height: 1.18;
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.3;
}

h3 {
  margin-bottom: 0;
  font-size: 17px;
}

.status-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

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

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.tab-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.tab-button.active {
  color: var(--ink);
  background: var(--accent-soft);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: stretch;
}

.intro-panel,
.task-panel,
.workspace-section,
.history-layout > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.intro-panel,
.task-panel {
  width: 100%;
}

.intro-panel,
.task-panel,
.workspace-section {
  padding: 26px;
}

.intro-panel {
  position: relative;
  min-height: 420px;
  overflow: hidden;
}

.intro-panel::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px dashed color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: var(--radius);
  pointer-events: none;
}

.intro-content {
  position: relative;
  z-index: 1;
  max-width: 980px;
}

.ambient-marks {
  position: absolute;
  inset: 0;
  z-index: 0;
  color: color-mix(in srgb, var(--accent) 34%, transparent);
  pointer-events: none;
}

.ambient-marks span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  font-size: 22px;
}

.ambient-marks span:nth-child(1) {
  top: 28px;
  right: 34px;
}

.ambient-marks span:nth-child(2) {
  top: 132px;
  right: 160px;
}

.ambient-marks span:nth-child(3) {
  right: 72px;
  bottom: 94px;
}

.ambient-marks span:nth-child(4) {
  left: 48%;
  bottom: 32px;
}

.ambient-marks span:nth-child(5) {
  right: 230px;
  bottom: 172px;
}

.lead {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.75;
}

.author-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(720px, 100%);
  padding: 14px;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 82%, var(--accent-soft));
}

.author-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.author-name {
  margin-bottom: 4px;
  font-weight: 800;
}

.author-desc {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.value-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 28px;
}

.value-list > div {
  min-height: 154px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.value-list strong {
  display: block;
  margin: 8px 0;
}

.value-list p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.value-kicker {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
}

.panel-heading,
.section-heading,
.list-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading p,
.small-note {
  color: var(--muted);
  line-height: 1.55;
}

.small-note {
  max-width: 230px;
  font-size: 13px;
}

.task-form {
  display: grid;
  gap: 16px;
}

.task-form label,
fieldset {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 650;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  margin-bottom: 8px;
  font-weight: 650;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--ink);
  outline: none;
}

input[type="text"] {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 138px;
  padding: 12px;
  line-height: 1.65;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 99, 0.12);
}

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

.platform-choice label {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  font-weight: 600;
}

.disabled-choice {
  color: var(--muted);
  opacity: 0.7;
}

.primary-button,
.ghost-button,
.task-action {
  min-height: 42px;
  border-radius: 6px;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:disabled {
  cursor: not-allowed;
  border-color: var(--line-strong);
  background: #b9b3aa;
}

.ghost-button,
.task-action {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.task-action.publish {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.task-action.delete {
  border-color: #e1b6b3;
  color: var(--danger);
  background: var(--danger-soft);
}

.active-task-warning {
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid #e0b979;
  border-radius: 6px;
  background: var(--warn-soft);
  color: var(--warn);
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.step {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.step-index {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.step strong {
  display: block;
  margin-bottom: 6px;
  line-height: 1.35;
}

.step span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.step.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.step.active .step-index,
.step.done .step-index {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.step.done {
  border-color: #b6d8cf;
}

.current-task {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.task-card {
  padding: 18px;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.task-meta span,
.file-link {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

.task-card h3 {
  margin-bottom: 10px;
}

.task-card p {
  color: var(--muted);
  line-height: 1.65;
}

.cache-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.file-link {
  text-decoration: none;
  color: var(--accent);
}

.prompt-delivery {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.prompt-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.prompt-heading strong {
  display: block;
  margin-top: 8px;
  line-height: 1.35;
}

.prompt-note {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.injected-input > div {
  display: grid;
  gap: 6px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.injected-input .wide {
  grid-column: 1 / -1;
}

.injected-input span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.injected-input strong {
  display: block;
  max-height: 94px;
  overflow: auto;
  line-height: 1.55;
  word-break: break-word;
}

.prompt-textarea {
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.62;
  background: var(--panel-soft);
}

.copy-prompt-button {
  flex: 0 0 auto;
  min-width: 112px;
}

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

.history-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.64fr);
  gap: 18px;
  margin-top: 18px;
}

.history-layout > div {
  min-height: 280px;
  padding: 20px;
}

.history-list,
.report-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.history-item,
.report-item,
.empty-state {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.history-item strong,
.report-item strong,
.empty-state strong {
  display: block;
  margin-bottom: 6px;
}

.history-item p,
.report-item p,
.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.badge.deleted {
  color: var(--danger);
  background: var(--danger-soft);
}

@media (max-width: 980px) {
  .home-grid,
  .history-layout {
    grid-template-columns: 1fr;
  }

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

  .value-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100vw - 24px, var(--max));
    padding-top: 16px;
  }

  .topbar,
  .panel-heading,
  .section-heading,
  .list-heading,
  .prompt-heading {
    align-items: stretch;
    flex-direction: column;
  }

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

  .platform-choice,
  .workflow,
  .injected-input {
    grid-template-columns: 1fr;
  }

  .intro-panel,
  .task-panel,
  .workspace-section,
  .history-layout > div {
    padding: 18px;
  }

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

  .intro-panel::before {
    inset: 10px;
  }

  .ambient-marks span {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .ambient-marks span:nth-child(2),
  .ambient-marks span:nth-child(4),
  .ambient-marks span:nth-child(5) {
    display: none;
  }

  .ambient-marks span:nth-child(1) {
    top: 16px;
    right: 16px;
  }

  .ambient-marks span:nth-child(3) {
    right: 24px;
    bottom: 24px;
  }

  .author-card {
    align-items: flex-start;
  }

  .small-note {
    max-width: none;
  }

  .copy-prompt-button {
    width: 100%;
  }

  .prompt-textarea {
    min-height: 280px;
  }
}
