:root {
  --bg: #eef0f3;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #626a73;
  --line: #d7dbe0;
  --dark: #3d3d3a;
  --red: #c40000;
  --red-soft: #fff0f0;
  --yellow: #fff000;
  --blue: #0b78d1;
  --green: #157a48;
  --shadow: 0 12px 30px rgba(20, 28, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

a {
  color: var(--ink);
  text-decoration: none;
}

button,
.nav-actions a {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

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

button.primary {
  width: 100%;
  min-height: 50px;
  border-color: var(--red);
  background: var(--red);
  color: #fff;
  font-weight: 800;
}

.page {
  max-width: 1680px;
  margin: 0 auto;
  padding: 18px 22px 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: #2f6b4f;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1.15;
}

.status,
.toolbar p,
.placeholder p,
.review-note {
  color: var(--muted);
}

.nav-actions,
.toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.text-tools {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
}

.text-tools span {
  color: var(--muted);
  font-size: 12px;
  max-width: 108px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-tools strong {
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.text-tools button {
  min-height: 30px;
  padding: 0 9px;
  font-weight: 800;
}

.workspace {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.input-pane,
.output-pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-pane {
  padding: 14px;
  display: grid;
  gap: 12px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.stage-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.stage {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f8fa;
  padding: 8px 6px;
  display: grid;
  justify-items: center;
  gap: 3px;
  color: var(--muted);
}

.stage b {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e3e7ec;
  color: #26313d;
}

.stage.active {
  background: #edf7f2;
  border-color: #9dc8b2;
  color: #24563f;
  font-weight: 800;
}

.stage.active b {
  background: #24563f;
  color: #fff;
}

.upload-area {
  border: 1.5px dashed #a9b0b7;
  border-radius: 8px;
  min-height: 164px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  background: #fbfcfd;
}

.upload-area.dragging {
  border-color: var(--red);
  background: var(--red-soft);
}

.upload-area input {
  display: none;
}

.upload-mark {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  margin: 0 auto 8px;
  background: #f2e86d;
  font-size: 30px;
  font-weight: 800;
}

.upload-area h2 {
  margin-bottom: 2px;
  font-size: 20px;
}

.upload-area p {
  color: var(--muted);
}

.file-list {
  display: grid;
  gap: 7px;
}

.empty,
.file-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafaf7;
  padding: 10px;
}

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.file-name {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.file-meta {
  color: var(--muted);
  font-size: 12px;
}

.fields {
  display: grid;
  gap: 9px;
}

label {
  display: grid;
  gap: 5px;
}

label span {
  color: var(--muted);
  font-size: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  resize: vertical;
}

.output-pane {
  padding: 16px;
  min-height: calc(100vh - 64px);
}

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

.toolbar h2 {
  margin-bottom: 2px;
  font-size: 22px;
}

.toolbar-actions button {
  min-height: 40px;
  font-weight: 700;
}

.review-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px 12px;
  margin-bottom: 12px;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.audit-grid > div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px 12px;
  display: grid;
  gap: 3px;
}

.audit-grid span {
  color: var(--muted);
  font-size: 12px;
}

.audit-grid strong {
  font-size: 16px;
}

.progress-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 10px 12px;
  margin-bottom: 10px;
}

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

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

.progress-head strong {
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 9px;
  border-radius: 999px;
  background: #e6e9ee;
  overflow: hidden;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #24563f;
  transition: width 0.28s ease;
}

.progress-panel.error .progress-bar {
  background: var(--red);
}

.cards {
  display: grid;
  gap: 18px;
  border: 1px solid #e1e5ea;
  border-radius: 6px;
  background: #eef1f4;
  padding: 16px;
  overflow: auto;
}

.placeholder {
  min-height: 520px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 40px;
  background: #fff;
}

.handcard {
  border: 2px solid #565656;
  background: #fff;
  position: relative;
  box-sizing: border-box;
  display: grid;
  width: 100%;
  grid-template-columns: 27.2% 35% 37.8%;
  grid-template-rows: 15.4% 19.7% 64.9%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  overflow: hidden;
}

.handcard *,
.handcard *::before,
.handcard *::after {
  box-sizing: border-box;
  min-width: 0;
}

.handcard textarea[data-fit],
.handcard input {
  outline: 0;
}

.handcard .text-selected {
  box-shadow: inset 0 0 0 2px #0b78d1, 0 0 0 2px rgba(11, 120, 209, 0.18);
  background: #f7fbff;
}

.product-no {
  position: absolute;
  top: 2%;
  left: 1.8%;
  z-index: 2;
  min-width: 130px;
  border: 0;
  background: transparent;
  color: #111;
  font-size: 18px;
  font-weight: 800;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
}

.visual-column {
  grid-column: 1 / 2;
  grid-row: 1 / 4;
  display: grid;
  grid-template-rows: 42% 50%;
  gap: 1.8%;
  padding: 4.6% 4.4% 2.5% 4%;
}

.product-shot {
  display: grid;
  place-items: center;
  border: 2px solid #111;
  background: #fff;
  overflow: hidden;
}

.product-shot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  min-height: 0;
}

.shot-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 20px;
  background: #fff;
  font-size: 28px;
  font-weight: 900;
  text-align: center;
  resize: none;
  overflow: hidden;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.title-block {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  display: grid;
  grid-template-columns: 20.2% minmax(0, 1fr);
  border: 2px solid #111;
  border-left: 0;
  margin: 2.5% 0 1.8%;
}

.label-cell,
.price-label {
  background: #70ad47;
  color: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  padding: 4px;
  line-height: 1.05;
  border-right: 2px solid #111;
}

.title-content {
  display: grid;
  grid-template-rows: minmax(0, 1fr) minmax(0, 0.55fr);
  place-items: center;
  text-align: center;
  padding: 8px 12px;
  min-width: 0;
  overflow: hidden;
}

.title-content textarea {
  border: 0;
  text-align: center;
  color: #111;
  padding: 4px;
  min-width: 0;
  height: 100%;
  resize: none;
  overflow: hidden;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.title-main {
  font-size: 28px;
  font-weight: 900;
}

.title-sub {
  font-size: 17px;
  font-weight: 800;
}

.after-sale {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
  display: grid;
  grid-template-columns: 20.2% minmax(0, 1fr);
  border: 2px solid #111;
  border-left: 0;
  margin-bottom: 2%;
}

.after-sale textarea {
  border: 0;
  color: #111;
  text-align: center;
  font-size: 24px;
  font-weight: 900;
  height: 100%;
  resize: none;
  align-self: center;
  overflow: hidden;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.price-grid {
  grid-column: 3 / 4;
  grid-row: 1 / 3;
  display: grid;
  grid-template-columns: 20.8% minmax(0, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 0;
  padding: 2.5% 2.3% 2% 1.2%;
  overflow: hidden;
}

.price-label {
  border: 2px solid #111;
  min-height: auto;
}

.price-value {
  border: 2px solid #111;
  border-left: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 6px 8px;
  min-width: 0;
  overflow: hidden;
}

.price-value textarea {
  border: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  height: 100%;
  min-height: 0;
  resize: none;
  overflow: hidden;
  line-height: 1.12;
  overflow-wrap: anywhere;
  display: grid;
  align-content: center;
}

.price-value.strong textarea {
  color: #111;
}

.script-block {
  grid-column: 2 / 4;
  grid-row: 3 / 4;
  border: 2px solid #111;
  margin: 0 1.5% 1.6% 0;
  padding: 12px 16px;
  overflow: hidden;
}

.script-head {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
  max-height: 66px;
  overflow: hidden;
}

.tag {
  background: #70ad47;
  color: #fff;
  border: 2px solid #111;
  font-size: 20px;
  font-weight: 900;
  padding: 2px 28px;
}

.review-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}

.review-tags span {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #ffd0d0;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  line-height: 1.1;
}

.talk-list {
  display: grid;
  grid-template-rows: repeat(var(--point-count, 5), minmax(0, 1fr));
  gap: 6px;
  height: calc(100% - var(--free-text-height, 112px) - 84px);
  min-height: 166px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  overflow: hidden;
}

.talk-list li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  min-height: 0;
  overflow: hidden;
}

.talk-list b {
  color: var(--red);
  font-size: 16px;
  line-height: 1;
}

.talk-list textarea,
.free-text textarea {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  height: 100%;
  min-height: 0;
  padding: 4px;
  font-size: 18px;
  font-weight: 800;
  resize: none;
  overflow: hidden;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.free-text {
  display: grid;
  gap: 5px;
  grid-template-rows: var(--free-text-rows, repeat(3, minmax(0, 1fr)));
  height: var(--free-text-height, 112px);
  margin-top: 6px;
  overflow: hidden;
}

.free-text label {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
  min-height: 0;
}

.free-text label span {
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--ink);
  font-weight: 900;
  line-height: 1.08;
}

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

  .input-pane {
    position: static;
  }

  .handcard {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .topbar,
  .toolbar {
    display: grid;
  }

  .output-pane {
    overflow-x: auto;
  }

  .handcard {
    min-width: 960px;
  }
}
