:root {
  --ink: #123028;
  --muted: #6a7b72;
  --line: #dce8e1;
  --paper: #eef5f1;
  --panel: #ffffff;
  --green: #0f6b4c;
  --green-deep: #0a4f38;
  --green-soft: #e8f5ef;
  --coral: #c2473a;
  --coral-soft: #fff0ed;
  --gold: #8a7340;
  --shadow: 0 10px 28px rgba(15, 50, 36, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(15, 107, 76, 0.12), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(194, 71, 58, 0.06), transparent 50%),
    linear-gradient(180deg, #f5faf7 0%, var(--paper) 48%, #e9f1ec 100%);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 28px;
}

/* —— Topbar —— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 14px 18px;
  border: 1px solid rgba(15, 107, 76, 0.12);
  border-radius: calc(var(--radius) + 2px);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: rise 0.45s var(--ease) both;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--green) 0%, var(--green-deep) 100%);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 22px rgba(15, 107, 76, 0.28);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-kicker {
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

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

h1 {
  font-size: clamp(24px, 2.8vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

.brand-copy > p,
.panel-sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-wrap {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.badge.ok {
  border-color: rgba(15, 107, 76, 0.28);
  background: var(--green-soft);
  color: var(--green);
}

.badge.warn {
  border-color: rgba(194, 71, 58, 0.28);
  background: var(--coral-soft);
  color: var(--coral);
}

.status {
  border: 1px solid rgba(15, 107, 76, 0.18);
  background: var(--green-soft);
  color: var(--green);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 800;
}

/* —— Workspace —— */
.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: calc(100vh - 130px);
  animation: rise 0.55s var(--ease) 0.06s both;
}

.panel {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(15, 107, 76, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.input-panel,
.output-panel {
  max-height: calc(100vh - 130px);
}

.sticky-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  z-index: 2;
}

.sticky-head h2 {
  font-size: 16px;
  font-weight: 800;
}

.panel-sub {
  margin-top: 2px;
}

.form-scroll,
.output-scroll {
  flex: 1;
  overflow: auto;
  padding: 14px 16px 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 107, 76, 0.28) transparent;
}

.form-section {
  margin-bottom: 18px;
  padding-bottom: 4px;
}

.section-label {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.flow-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--green-soft), rgba(255, 255, 255, 0.6));
}

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

.flow-step.active {
  color: var(--green);
}

.flow-line {
  flex: 1;
  height: 1px;
  background: rgba(15, 107, 76, 0.18);
}

/* —— Form controls —— */
label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

label span {
  color: #2d4339;
  font-size: 12px;
  font-weight: 700;
}

.product-field {
  gap: 8px;
}

.product-count {
  margin-left: 6px;
  color: var(--green);
  font-weight: 600;
}

.product-combobox {
  position: relative;
}

.product-combobox-input-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  border: 1px solid rgba(15, 107, 76, 0.28);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fff 0%, var(--green-soft) 160%);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.product-combobox.open .product-combobox-input-wrap,
.product-combobox-input-wrap:focus-within {
  border-color: rgba(15, 107, 76, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 107, 76, 0.12);
}

.product-combobox-input-wrap input {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent;
  border-radius: 0;
  font-weight: 700;
  padding: 11px 12px;
}

.product-combobox-toggle {
  border: 0;
  border-left: 1px solid rgba(15, 107, 76, 0.12);
  background: transparent;
  color: var(--green-deep);
  min-width: 42px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.product-combobox-toggle:hover {
  background: rgba(15, 107, 76, 0.06);
}

.product-dropdown {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 6px;
}

.product-dropdown.hidden {
  display: none;
}

.product-dropdown-group {
  padding: 6px 8px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.product-dropdown-item {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
}

.product-dropdown-item:hover,
.product-dropdown-item.active {
  background: var(--green-soft);
}

.product-dropdown-item strong {
  font-size: 13px;
  font-weight: 700;
}

.product-dropdown-item small {
  color: var(--muted);
  font-size: 11px;
}

.product-dropdown-empty {
  padding: 14px 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.product-select {
  border-color: rgba(15, 107, 76, 0.28);
  background: linear-gradient(180deg, #fff 0%, var(--green-soft) 160%);
  padding: 11px 12px;
  font-weight: 700;
  cursor: pointer;
}

.product-select:focus {
  border-color: rgba(15, 107, 76, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 107, 76, 0.12);
}

.product-select option {
  font-weight: 500;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15, 107, 76, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 107, 76, 0.12);
}

em,
.hint {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 0 0 12px;
  padding: 12px;
  background: #fbfefc;
}

legend {
  padding: 0 6px;
  color: #2d4339;
  font-size: 12px;
  font-weight: 800;
}

.hidden {
  display: none !important;
}

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

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

.choice-grid label,
.deliverable-list label,
.suggestion-card,
.template-btn,
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  border: 1px solid rgba(15, 107, 76, 0.14);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 10px;
  color: #243830;
  font-size: 13px;
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.choice-grid label:hover,
.deliverable-list label:hover,
.suggestion-card:hover,
.template-btn:hover,
.history-item:hover {
  border-color: rgba(15, 107, 76, 0.4);
  background: var(--green-soft);
}

.choice-grid input,
.suggestion-card input,
.deliverable-list input[type="checkbox"] {
  width: 15px;
  height: 15px;
  padding: 0;
  accent-color: var(--green);
}

.smart-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  padding: 12px;
  background: #fbfefc;
}

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

.smart-head h3 {
  font-size: 14px;
  font-weight: 800;
}

.smart-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.suggestions {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.suggestion-card {
  display: grid;
  grid-template-columns: 18px 84px 1fr;
  align-items: start;
}

.suggestion-card strong {
  color: var(--green);
  font-size: 12px;
}

.suggestion-card span {
  color: #2e3a33;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.suggestion-card em {
  grid-column: 2 / -1;
  color: var(--coral);
  font-size: 11px;
}

.deliverable-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.deliverable-list label {
  justify-content: space-between;
}

.deliverable-list input[type="number"] {
  width: 58px;
  height: 30px;
  padding: 4px 6px;
  text-align: center;
}

.brief-box {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.brief-box strong {
  color: var(--green);
}

.brief-box p {
  margin: 6px 0;
}

.brief-box ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.identity-box {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(15, 107, 76, 0.16);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--green);
  background: linear-gradient(90deg, var(--green-soft), #fff 42%);
}

.identity-box:empty {
  display: none;
}

.identity-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.identity-chips span {
  border: 1px solid rgba(15, 107, 76, 0.18);
  background: #fff;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  color: var(--green);
  font-weight: 700;
}

.advanced-panel {
  margin: 8px 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfefc;
  padding: 0 12px 12px;
}

.advanced-panel > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 4px;
  color: var(--green-deep);
  font-size: 13px;
  font-weight: 700;
}

.advanced-panel > summary::-webkit-details-marker {
  display: none;
}

.advanced-panel[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.generate-hint {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.generate-bar .primary[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.flow-step.done {
  color: var(--green);
  opacity: 0.85;
}

.result-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.result-tabs.hidden {
  display: none;
}

.result-tab {
  border: 1px solid rgba(15, 107, 76, 0.18);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.result-tab:hover {
  border-color: rgba(15, 107, 76, 0.4);
  background: var(--green-soft);
}

.result-tab.active {
  background: var(--green);
  border-color: var(--green-deep);
  color: #fff;
}

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

.template-btn {
  justify-content: center;
  min-height: 48px;
  color: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.template-btn.active {
  background: var(--green) !important;
  color: #fff !important;
  border-color: var(--green-deep) !important;
  box-shadow: 0 8px 18px rgba(15, 107, 76, 0.22);
}

.template-feedback {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 600;
}

.template-feedback.hidden {
  display: none;
}

.flash-target {
  animation: flashTarget 1.1s var(--ease);
}

@keyframes flashTarget {
  0% { box-shadow: 0 0 0 0 rgba(15, 107, 76, 0.35); }
  35% { box-shadow: 0 0 0 4px rgba(15, 107, 76, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(15, 107, 76, 0); }
}

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

/* —— Buttons —— */
.primary,
.ghost,
.final-action {
  min-height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    transform 0.18s var(--ease),
    box-shadow 0.18s var(--ease),
    background 0.18s var(--ease),
    opacity 0.18s var(--ease);
}

.generate-bar {
  flex-shrink: 0;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.primary {
  width: 100%;
  background: linear-gradient(145deg, var(--green) 0%, var(--green-deep) 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(15, 107, 76, 0.24);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 107, 76, 0.3);
}

.primary:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.final-action {
  border: 1px solid rgba(194, 71, 58, 0.25);
  background: var(--coral);
  color: #fff;
  padding: 0 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(194, 71, 58, 0.18);
}

.final-action:hover {
  transform: translateY(-1px);
}

.final-action:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.ghost {
  border: 1px solid rgba(15, 107, 76, 0.2);
  background: var(--green-soft);
  color: var(--green);
  padding: 0 12px;
  font-weight: 700;
}

.ghost:hover {
  transform: translateY(-1px);
  background: #dff0e7;
}

.actions,
.inline-actions {
  display: flex;
  gap: 8px;
}

.inline-actions {
  justify-content: flex-end;
  margin: -4px 0 12px;
}

/* —— Output —— */
.risk-panel {
  margin: 0 0 12px;
  padding: 11px 12px;
  border: 1px solid rgba(194, 71, 58, 0.22);
  border-radius: var(--radius-sm);
  background: var(--coral-soft);
  color: #7a342c;
  font-size: 12px;
  line-height: 1.55;
}

.risk-panel strong {
  display: block;
  margin-bottom: 4px;
}

.next-steps {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  border: 1px solid rgba(15, 107, 76, 0.14);
  border-radius: var(--radius-sm);
  background: #f7fcf9;
  padding: 12px;
}

.next-copy {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.next-copy strong {
  color: var(--green);
  font-size: 14px;
}

.step-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.step-rail div {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid rgba(15, 107, 76, 0.12);
  border-radius: 8px;
  background: #fff;
  padding: 6px 8px;
  color: #2e3a33;
  font-size: 12px;
}

.step-rail b {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
}

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

.next-actions .ghost,
.next-actions .final-action {
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.next-actions.is-empty .ghost,
.next-actions.is-empty .final-action {
  opacity: 0.4;
  pointer-events: none;
}

#generateAiCover.hidden {
  display: none;
}

#generateAiCover[disabled] {
  opacity: 0.7;
  cursor: wait;
}

.prompt-dock {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  border: 1px solid rgba(15, 107, 76, 0.22);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f4fbf7 0%, #fff 48%);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(15, 50, 36, 0.06);
}

.prompt-dock.hidden {
  display: none;
}

.prompt-dock-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.prompt-dock-head strong {
  display: block;
  color: var(--green-deep);
  font-size: 15px;
}

.prompt-dock-head span {
  color: var(--muted);
  font-size: 12px;
}

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

.prompt-dock-body {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #243830;
  font-size: 12.5px;
  line-height: 1.55;
}

.visual-dock {
  display: none !important;
}

.ai-cover-panel,
.image-card-panel {
  display: none !important;
}

.ai-cover-copy,
.image-card-head div:first-child {
  display: grid;
  gap: 4px;
}

.ai-cover-copy strong,
.image-card-head strong {
  color: var(--green);
  font-size: 14px;
}

.ai-cover-copy span,
.image-card-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.image-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-card-tools {
  display: flex;
  gap: 8px;
}

.image-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-height: 380px;
  overflow: auto;
}

.image-card-item {
  display: grid;
  gap: 8px;
}

.image-card-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 50, 36, 0.08);
}

.image-card-item button {
  min-height: 32px;
  border: 1px solid rgba(15, 107, 76, 0.2);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.ai-cover-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ai-cover-preview img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

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

.ai-cover-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  text-decoration: none;
}

.ai-cover-body pre {
  max-height: 160px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #344039;
  font-size: 12px;
  line-height: 1.6;
}

/* —— Result —— */
.result-shell {
  position: relative;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.result-view {
  margin: 0;
  padding: 18px 20px 24px;
  max-height: min(68vh, 820px);
  overflow: auto;
  line-height: 1.75;
}

.result-view h1,
.result-view h2,
.result-view h3,
.result-view h4 {
  margin: 1.05em 0 0.4em;
  line-height: 1.35;
}

.result-view h1 {
  font-size: 22px;
}

.result-view h2 {
  font-size: 17px;
  color: var(--green);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.result-view h3 {
  font-size: 15px;
}

.result-view p,
.result-view li {
  margin: 0.35em 0;
  white-space: pre-wrap;
}

.result-view ul {
  padding-left: 1.2em;
}

.result {
  margin: 0;
  min-height: 420px;
  max-height: min(68vh, 820px);
  overflow: auto;
  padding: 18px 20px;
  background: #fff;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}

.result.raw-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.empty-state {
  display: none;
  place-items: center;
  gap: 8px;
  min-height: 420px;
  padding: 40px 28px;
  text-align: center;
  color: var(--muted);
}

.result-shell.is-empty .empty-state {
  display: grid;
}

.result-shell.is-empty .result,
.result-shell.is-empty .result-view {
  display: none;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 6px;
  border-radius: 16px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 22px;
  font-weight: 800;
}

.empty-state strong {
  color: var(--ink);
  font-size: 16px;
}

.empty-state p {
  max-width: 360px;
  font-size: 13px;
  line-height: 1.6;
}

/* —— History —— */
.history-panel {
  display: none;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfefc;
  padding: 0 12px 12px;
}

.history-panel.open {
  display: block;
  animation: rise 0.3s var(--ease);
}

.panel-head.small {
  padding: 12px 0 0;
  border: 0;
  background: transparent;
}

.history-search {
  width: 100%;
  margin: 10px 0 8px;
}

.history-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.history-item {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.history-item strong {
  font-size: 13px;
  word-break: break-word;
}

.history-item span,
.history-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.history-item em {
  color: var(--gold);
  font-size: 11px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  }

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

@media (max-width: 900px) {
  .shell {
    width: min(100vw - 20px, 1480px);
    padding-top: 12px;
  }

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

  .status-wrap {
    width: 100%;
    justify-items: start;
  }

  .status-badges {
    justify-content: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .input-panel,
  .output-panel {
    max-height: none;
  }

  .form-scroll {
    max-height: none;
  }

  .output-scroll {
    max-height: none;
  }

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

  .suggestion-card {
    grid-template-columns: 18px 1fr;
  }

  .suggestion-card strong {
    grid-column: 2;
  }

  .suggestion-card span,
  .suggestion-card em {
    grid-column: 2 / -1;
  }
}

@media (max-width: 640px) {
  .brand-mark {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .choice-grid,
  .choice-grid.compact,
  .template-row {
    grid-template-columns: 1fr 1fr;
  }

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

  .result,
  .result-view,
  .empty-state,
  .result-shell {
    min-height: 320px;
  }
}
