:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f4f5;
  --line: #d9e0e3;
  --line-strong: #b9c4c9;
  --text: #1b2429;
  --muted: #64737b;
  --soft: #87939a;
  --primary: #146c63;
  --primary-dark: #0f514b;
  --primary-soft: #d9eeeb;
  --blue: #2867a8;
  --blue-soft: #ddeafa;
  --amber: #8a5a12;
  --amber-soft: #f7ead2;
  --red: #aa342f;
  --red-soft: #f6dddd;
  --green: #23724d;
  --green-soft: #dcefe5;
  --violet: #6d4aa2;
  --violet-soft: #ece4f6;
  --shadow: 0 16px 38px rgba(19, 33, 39, 0.08);
  --radius: 8px;
  font-family:
    "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
}

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

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

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid var(--line);
}

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

.brand-title {
  font-weight: 700;
  line-height: 1.2;
}

.save-state {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.step-nav {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

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

.step-group-title {
  min-height: 24px;
  display: flex;
  align-items: center;
  padding: 7px 10px 2px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

.step-button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.step-button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.step-button.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
}

.step-button svg {
  width: 18px;
  height: 18px;
}

.step-count {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #e8edef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.step-button.active .step-count {
  background: var(--surface);
  color: var(--primary-dark);
}

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

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(12px);
}

.title-block {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.page-meta {
  min-height: 18px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

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

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: var(--radius);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
  background: var(--surface);
}

.button {
  padding: 8px 12px;
  white-space: nowrap;
}

.icon-button {
  width: 36px;
  padding: 0;
}

.button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
}

.button.secondary:hover,
.button.ghost:hover,
.icon-button:hover {
  background: var(--surface-2);
}

.button.ghost {
  color: var(--muted);
  background: transparent;
}

.button.danger {
  color: var(--red);
  border-color: var(--red-soft);
}

.button:disabled,
.icon-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.page {
  width: 100%;
  max-width: 1280px;
  padding: 24px 28px 44px;
}

.section {
  margin-bottom: 24px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head h2,
.section h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

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

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 14px;
}

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

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

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

.field {
  display: grid;
  gap: 6px;
}

.field label,
.field-label {
  color: var(--muted);
  font-weight: 650;
  font-size: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
  outline: none;
}

textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 108, 99, 0.13);
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
  text-align: left;
}

th {
  background: #f3f6f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

tr:last-child td {
  border-bottom: 0;
}

td input,
td textarea,
td select {
  min-width: 150px;
}

td textarea {
  min-height: 72px;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-confirmed,
.tag-s {
  background: var(--green-soft);
  color: var(--green);
}

.pill-weak,
.tag-a {
  background: var(--amber-soft);
  color: var(--amber);
}

.pill-pending,
.tag-b {
  background: var(--blue-soft);
  color: var(--blue);
}

.pill-forbidden,
.tag-forbidden {
  background: var(--red-soft);
  color: var(--red);
}

.tag-pending {
  background: var(--violet-soft);
  color: var(--violet);
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  min-height: 128px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
  padding: 22px;
}

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

.metric {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-value {
  margin-top: 8px;
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.metric small {
  color: var(--soft);
  display: block;
  margin-top: 6px;
}

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

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 6px 16px rgba(19, 33, 39, 0.04);
}

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

.card-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.card-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.generation-card textarea {
  min-height: 86px;
}

.generation-card .wide textarea {
  min-height: 118px;
}

.task-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.task-line span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #f8fafb;
}

.compact-button {
  min-height: 32px;
  padding: 6px 10px;
}

.review-list {
  display: grid;
  gap: 14px;
}

.review-card {
  display: grid;
  gap: 12px;
}

.version-grid {
  display: grid;
  gap: 12px;
}

.version-card {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f9fbfb;
  padding: 10px;
}

.version-card.selected {
  border-color: rgba(35, 114, 77, 0.45);
  background: var(--green-soft);
}

.version-preview {
  min-height: 180px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.version-preview img {
  width: 100%;
  height: 100%;
  min-height: 180px;
  display: block;
  object-fit: cover;
}

.version-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
}

.version-empty i {
  width: 28px;
  height: 28px;
}

.version-fields textarea {
  min-height: 78px;
}

.version-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

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

.director-card textarea {
  min-height: 82px;
}

.director-card .wide textarea {
  min-height: 112px;
}

.director-map table {
  min-width: 1220px;
}

.thumb-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 8px;
  min-width: 210px;
}

.thumb-card {
  position: relative;
  display: grid;
  grid-template-rows: 82px auto auto;
  gap: 4px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.thumb-card img,
.thumb-empty {
  width: 100%;
  height: 82px;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: cover;
  background: #f3f4f6;
}

.thumb-card span {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 10px;
  line-height: 1.4;
}

.thumb-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb-card em {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.director-card > .thumb-pair {
  margin: 10px 0 14px;
}

.window-guide {
  border-left: 4px solid #0f766e;
}

.guide-hero {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 16px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.guide-hero strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.guide-hero span,
.guide-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.guide-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.compact-table table {
  min-width: 720px;
}

.status-select {
  width: auto;
  min-width: 118px;
}

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

.tiny {
  color: var(--soft);
  font-size: 12px;
}

.list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.65;
}

.generation-prep {
  background: #f9fbfb;
}

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

.prep-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 11px;
}

.prep-item.ready {
  border-color: rgba(35, 114, 77, 0.35);
  background: var(--green-soft);
}

.prep-item strong,
.prep-item span {
  display: block;
}

.prep-item strong {
  margin-bottom: 4px;
}

.prep-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.prep-item em {
  font-style: normal;
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.prep-item.ready em {
  color: var(--green);
}

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

.image-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.image-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #e9eef0;
  object-fit: cover;
  display: block;
}

.image-info {
  padding: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.image-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.image-meta {
  display: grid;
  gap: 8px;
  padding: 0 9px 10px;
}

.image-meta textarea {
  min-height: 72px;
}

.upload-zone {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 16px;
}

.upload-zone input {
  max-width: 360px;
}

.analysis-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5ecee;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.4s ease;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.checklist {
  display: grid;
  gap: 8px;
}

.check-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 11px;
}

.check-item input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 1px 0 0;
}

.warning-list {
  display: grid;
  gap: 8px;
}

.warning {
  border-left: 4px solid var(--amber);
  background: var(--amber-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: #5e3f12;
}

.warning.danger {
  border-left-color: var(--red);
  background: var(--red-soft);
  color: #76211d;
}

.export-preview {
  min-height: 440px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  white-space: pre;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 44px));
  border-radius: var(--radius);
  background: #1c272c;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 20;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .step-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .page {
    padding: 20px 16px 36px;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .cards-grid,
  .split-layout,
  .version-card,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .guide-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .step-nav {
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
  }

  .button {
    flex: 1 1 auto;
  }
}
