:root {
  --bg: #f7f4ee;
  --panel: #fffdf8;
  --ink: #201b16;
  --muted: #6c6258;
  --soft: #9a9084;
  --line: #ded4c6;
  --line-strong: #c9b9a6;
  --accent: #9d3d2b;
  --accent-soft: #f0ddd6;
  --green: #426c35;
  --green-soft: #e5eddc;
  --yellow: #f3e6bd;
  --danger: #b6402b;
  --shadow: 0 18px 44px rgba(39, 31, 24, 0.1);
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: Georgia, "Songti SC", "STSong", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px;
  border-right: 1px solid var(--line);
  background: #f2ede4;
  overflow: auto;
}

.brand-kicker {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.brand-title {
  margin: 8px 0 8px;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.05;
}

.brand-copy {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12.5px;
}

.project-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
}

.project-card.active {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.project-name {
  font-weight: 700;
  margin-bottom: 2px;
}

.project-meta {
  color: var(--soft);
  font-size: 11.5px;
}

.sidebar-actions {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.main {
  padding: 28px 34px 64px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.page-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 760px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.tab {
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 6px 6px 0 0;
  font-size: 12.5px;
}

.tab.active {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.65fr);
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel.highlight {
  background: #fbf1de;
}

.panel-title {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 400;
}

.section-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffaf1;
  color: var(--ink);
  border-radius: 4px;
  padding: 9px 10px;
  outline: none;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.textarea.mono,
.prompt-output,
.codebox {
  font-family: var(--mono);
}

.field-card {
  border: 1px solid var(--line);
  background: #fffaf1;
  border-radius: 7px;
  padding: 14px;
  margin-bottom: 12px;
}

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.field-name {
  font-weight: 700;
}

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

.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11.5px;
}

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

.pool-item,
.asset-item,
.qa-item {
  border: 1px solid var(--line);
  background: #fffaf1;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
}

.pool-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 4px;
  padding: 9px 12px;
  font-size: 12.5px;
}

.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 6px 8px;
  font-size: 11.5px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

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

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

.tiny {
  font-size: 11.5px;
}

.prompt-list {
  display: grid;
  gap: 12px;
}

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

.image-thumb {
  border: 1px solid var(--line);
  background: #fffaf1;
  border-radius: 6px;
  padding: 8px;
}

.image-thumb img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  margin-bottom: 8px;
}

.prompt-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  overflow: hidden;
}

.prompt-card.bad {
  border-color: var(--danger);
}

.prompt-card.good {
  border-color: var(--green);
}

.prompt-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.prompt-output {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fffaf1;
  font-size: 12px;
  max-height: 360px;
  overflow: auto;
}

.qa-pass {
  color: var(--green);
}

.qa-fail {
  color: var(--danger);
}

.split-line {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

.empty {
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  border-radius: 8px;
  padding: 22px;
  text-align: center;
}

.flow-nav {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 12px;
  box-shadow: var(--shadow);
  z-index: 50;
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .main {
    padding: 24px 18px 48px;
  }

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