:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #176f63;
  --accent-strong: #105449;
  --danger: #a63a3a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 24px auto;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(460px, 0.9fr) minmax(460px, 1.1fr);
  gap: 16px;
  align-items: start;
}

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

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

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 20px;
  margin-bottom: 14px;
}

p {
  color: var(--muted);
  margin-top: 6px;
}

.badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.configStatus {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 13px;
  line-height: 1.5;
}

.configStatus strong {
  color: var(--text);
}

.stateFields {
  display: none;
}

.stepBlock {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.stepBlock:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.stepHeader {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.stepHeader > span {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.stepHeader h2 {
  margin: 0;
  font-size: 18px;
}

.stepHeader p,
.taskDescription {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.platformHeader {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 24px;
}

.platformHeader strong {
  font-size: 15px;
}

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

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

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

.taskCardGrid.singleCard {
  grid-template-columns: 1fr;
}

.otherTaskGrid {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.taskCard {
  min-height: 62px;
  height: auto;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.taskCard strong {
  font-size: 14px;
  line-height: 1.25;
}

.taskCard span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.taskCard:hover,
.taskCard.isActive {
  border-color: rgba(23, 111, 99, 0.55);
  background: #f5fbf9;
}

.taskCard.isActive {
  box-shadow: inset 0 0 0 1px rgba(23, 111, 99, 0.25);
}

.featuredTask {
  border-color: rgba(42, 111, 160, 0.3);
  background: #f8fbff;
}

.compactTask {
  min-height: 52px;
}

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

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

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

label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: #344054;
  font-size: 14px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 12px;
  padding: 10px;
}

.taskConfigPanel {
  margin-bottom: 0;
  background: #fbfcfd;
}

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

.settingTitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.advancedSettings {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.advancedSettings summary {
  width: fit-content;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

legend {
  color: #344054;
  font-size: 14px;
  padding: 0 6px;
}

.stylePanel {
  display: grid;
  gap: 12px;
}

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

.styleGroup > span {
  min-width: 42px;
  color: var(--muted);
  font-size: 13px;
}

.styleGroup label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}

.styleGroup input {
  width: auto;
  margin: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

textarea {
  resize: vertical;
}

.fileBox {
  min-height: 86px;
  border: 1px dashed #aab4c3;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
  cursor: pointer;
}

.fileBox input {
  border: 0;
  padding: 0;
}

.fileBox span {
  color: var(--muted);
  font-size: 13px;
}

.fileBox strong {
  color: var(--accent);
  font-size: 13px;
}

.referenceNotice {
  padding: 11px 12px;
  border: 1px solid rgba(135, 93, 32, 0.2);
  border-radius: 8px;
  background: #fffaf2;
}

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

.referenceNotice p {
  margin: 0;
  color: #604b2f;
  font-size: 13px;
  line-height: 1.5;
}

.imagePreviewGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

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

.previewItem img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.previewItem span {
  display: block;
  padding: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.previewStatus,
.previewError {
  min-height: 86px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}

.previewError span {
  white-space: normal;
}

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

button {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

button:hover:not(:disabled) {
  background: var(--accent-strong);
}

.secondaryButton {
  width: auto;
  min-width: 112px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.compactButton,
.miniButton {
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.miniButton {
  width: auto;
  justify-self: start;
  margin: 0 10px 10px;
}

.secondaryButton:hover:not(:disabled) {
  background: #f4f6f8;
}

[hidden] {
  display: none !important;
}

.empty {
  min-height: 220px;
  display: grid;
  place-items: center start;
  padding: 18px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.emptyHint ul {
  margin: 0;
  padding-left: 18px;
}

.emptyHint li {
  line-height: 1.6;
}

.resultBody {
  display: grid;
  gap: 14px;
}

.resultHeader,
.resultToolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.resultHeader {
  margin-bottom: 14px;
}

.resultHeader h2,
.resultToolbar h3 {
  margin: 0;
}

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

.resultCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.taskTestTip {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(58, 113, 166, 0.18);
  border-radius: 8px;
  background: #f7fbff;
}

.taskTestTip strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.xhsNoteTestPanel {
  background: #fbfcfd;
}

.xhsNoteTestPanel small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.taskTestTip ul,
.validationRunCard ul,
.validationChecklist ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.validationRunCard {
  background: #fbfcff;
}

.validationMetaGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.validationMetaItem {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.validationMetaItem strong {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
}

.validationMetaItem span {
  color: var(--text);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.failureCard {
  border-color: rgba(166, 58, 58, 0.35);
  background: #fffafa;
}

.failureCard h3,
.failureCard li {
  color: var(--danger);
}

.wideAngleWorkbenchPanel {
  border-color: rgba(42, 111, 160, 0.22);
  background: #fbfdff;
}

.wideAngleChoiceGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.choiceGroup {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.choiceGroup strong {
  flex-basis: 100%;
  font-size: 13px;
}

.choiceGroup label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #344054;
  font-size: 13px;
  line-height: 1.25;
  margin: 0;
  cursor: pointer;
}

.compactTagGroup label {
  min-height: 26px;
  padding: 4px 9px;
  font-size: 12px;
}

.choiceGroup input {
  width: auto;
  margin: 0;
}

.widePresetRow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.widePresetButton {
  width: auto;
  height: 30px;
  border: 1px solid rgba(42, 111, 160, 0.25);
  border-radius: 999px;
  padding: 0 10px;
  background: #f2f8ff;
  color: #23536f;
  font-size: 12px;
  font-weight: 800;
}

.widePresetButton:hover:not(:disabled) {
  background: #e7f2ff;
  color: #163e56;
}

.resultCard h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.resultCard h4 {
  margin: 12px 0 6px;
  font-size: 14px;
}

.resultCard p,
.resultCard li {
  color: #344054;
  line-height: 1.55;
}

.resultCard pre {
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.55;
  font-family: inherit;
}

.generatedImageGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.generatedImage {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.generatedImage img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #f1f4f8;
}

.generatedImage figcaption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 10px;
  font-size: 13px;
}

.generatedImage figcaption span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.generatedImage figcaption strong {
  color: var(--text);
  line-height: 1.35;
}

.generatedImage figcaption small {
  color: var(--muted);
  line-height: 1.35;
}

.generatedImage a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.imageActions {
  display: inline-flex !important;
  grid-auto-flow: column;
  gap: 6px !important;
  align-items: center;
  justify-items: end;
  flex: 0 0 auto;
}

.imageActions .miniButton {
  margin: 0;
  height: 30px;
  font-size: 12px;
  white-space: nowrap;
}

.compactSummary {
  padding: 12px;
}

.compactSummary .resultToolbar {
  align-items: center;
}

.compactSummary p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.validationChecklist summary {
  cursor: pointer;
}

.error {
  color: var(--danger);
}

.debugDetails summary {
  display: grid;
  gap: 4px;
  cursor: pointer;
}

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

@media (max-width: 980px) {
  .workspace,
  .two,
  .three,
  .taskCardGrid,
  .taskCardGrid.twoCards,
  .otherTaskGrid {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100vw - 20px, 720px);
    margin: 10px auto;
  }

  .panel {
    padding: 16px;
  }

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

  .resultHeader,
  .resultToolbar {
    display: grid;
  }
}
