:root {
  color-scheme: light;
  --page: #f5f3ee;
  --paper: #fffefa;
  --ink: #242821;
  --muted: #77796f;
  --line: #e9e7df;
  --accent: #d26046;
  --green: #314c41;
  --sans: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  --display: "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(ellipse at 87% 6%, rgb(228 224 207 / 28%), transparent 29rem),
    var(--page);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.topbar {
  height: 74px;
  padding: 0 max(5.5vw, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgb(48 51 42 / 7%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--green);
  color: #f4f0e7;
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand-name {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.07em;
}

.brand-name span {
  font-weight: 500;
}

.topbar-note {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #62675e;
  font-size: 12px;
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b9474;
  box-shadow: 0 0 0 3px rgb(107 148 116 / 13%);
}

.app-shell {
  width: min(1320px, calc(100% - 64px));
  margin: 0 auto;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 47px 0 30px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #84867d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

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

h1 {
  margin-bottom: 5px;
  font-family: var(--display);
  font-size: clamp(32px, 4vw, 42px);
  font-weight: 600;
  letter-spacing: -0.065em;
  line-height: 1.1;
}

.heading-period {
  color: var(--accent);
}

.page-description {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.format-chip,
.dimension-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #e8e5dc;
  border-radius: 999px;
  background: rgb(255 254 250 / 65%);
  color: #77796f;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.format-chip {
  margin-bottom: 6px;
  padding: 9px 13px;
}

.format-chip span {
  color: var(--accent);
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.78fr) minmax(0, 1.22fr);
  align-items: stretch;
  gap: 22px;
}

.editor-panel,
.preview-panel {
  min-width: 0;
  border: 1px solid #e9e7df;
  border-radius: 17px;
  background: var(--paper);
  box-shadow: 0 12px 35px rgb(46 44 31 / 3%);
}

.editor-panel {
  align-self: start;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 20px 24px 18px;
  border-bottom: 1px solid #efede6;
}

.section-number {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: #f2f1e9;
  color: #72746b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.panel-heading h2,
.preview-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.panel-heading p,
.preview-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.editor-content {
  display: grid;
  gap: 17px;
  padding: 20px 24px 21px;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.field-group > label,
.field-heading > label,
.field-label {
  color: #45483f;
  font-size: 11px;
  font-weight: 600;
}

.field-hint {
  color: #98998f;
  font-size: 9px;
}

.upload-zone {
  display: flex;
  min-height: 73px;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px dashed #d9d8ce;
  border-radius: 10px;
  background: #fbfaf6;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.upload-zone:hover,
.upload-zone:focus-within {
  border-color: #9eaa98;
  background: #f7f7f0;
}

.upload-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #ebe9e0;
  border-radius: 9px;
  background: var(--paper);
  color: #586d5e;
}

.upload-icon svg {
  width: 19px;
  height: 19px;
}

.upload-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
  color: #8b8d83;
  font-size: 9px;
}

.upload-copy strong {
  overflow: hidden;
  color: #44473e;
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browse-button {
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid #e7e5dc;
  border-radius: 7px;
  background: #fffefa;
  color: #4a4c44;
  font-size: 9px;
  font-weight: 600;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.image-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.image-file-row[hidden] {
  display: none;
}

.file-indicator {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: #edf2eb;
  color: #55705b;
  font-size: 7px;
  font-weight: 700;
}

.image-file-name {
  overflow: hidden;
  color: #696c62;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-button {
  margin-left: auto;
  padding: 5px;
  border: 0;
  background: transparent;
  color: #a45b4b;
  cursor: pointer;
  font-size: 9px;
  font-weight: 600;
}

.copy-fields input,
.copy-fields textarea {
  width: 100%;
  border: 1px solid #e7e5dc;
  border-radius: 8px;
  outline: 0;
  background: #fffefa;
  color: #303229;
  font-size: 11px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.copy-fields input {
  height: 39px;
  padding: 0 11px;
}

.copy-fields textarea {
  min-height: 70px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.5;
}

.copy-fields input:focus,
.copy-fields textarea:focus {
  border-color: #91a18e;
  box-shadow: 0 0 0 3px rgb(94 120 98 / 10%);
}

.color-group {
  gap: 11px;
  padding: 14px 13px;
  border: 1px solid #efede6;
  border-radius: 10px;
  background: #fcfbf7;
}

.color-heading {
  align-items: center;
}

.color-heading > div {
  display: grid;
  gap: 3px;
}

.color-pair-icon {
  color: #7c8779;
  font-size: 18px;
}

.color-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 13px;
}

.color-control {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.color-swatch {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #e9e7df;
  border-radius: 8px;
  background: #fff;
}

.color-swatch input {
  width: 21px;
  height: 21px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.color-swatch input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-swatch input::-webkit-color-swatch {
  border: 0;
  border-radius: 4px;
}

.color-control > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.color-control strong {
  font-size: 9px;
  font-weight: 600;
}

.color-control small {
  color: #929389;
  font-size: 8px;
}

.color-divider {
  width: 1px;
  height: 26px;
  background: #e8e6de;
}

.editor-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding-top: 1px;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button:focus-visible,
.text-button:focus-visible {
  outline: 2px solid #586d5e;
  outline-offset: 3px;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button-secondary {
  border-color: #e6e4da;
  background: #fffefa;
  color: #45483f;
}

.button-secondary:hover,
.button-quiet:hover {
  border-color: #cfcec3;
  background: #f8f7f1;
}

.button-quiet {
  padding: 0 14px;
  border-color: #e6e4da;
  background: transparent;
  color: #62655c;
}

.editor-note {
  margin: -10px 0 0;
  color: #9a9b91;
  font-size: 9px;
  line-height: 1.5;
}

.preview-panel {
  display: flex;
  min-height: 680px;
  flex-direction: column;
  padding: 22px 25px 20px;
}

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

.preview-title-line {
  display: flex;
  align-items: center;
  gap: 11px;
}

.preview-title-line .section-number {
  width: 28px;
  height: 28px;
}

.preview-heading p {
  margin: 4px 0 0 39px;
}

.dimension-chip {
  padding: 7px 10px;
  font-size: 9px;
  letter-spacing: 0;
}

.dimension-chip span {
  color: #aaa99e;
}

.preview-stage {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
  border: 1px solid #eeece4;
  border-radius: 12px;
  background-color: #f4f3ee;
  background-image: radial-gradient(#deddd4 0.7px, transparent 0.7px);
  background-size: 13px 13px;
}

.canvas-frame {
  width: min(100%, 418px);
  overflow: hidden;
  border-radius: 4px;
  background: #f5f0e7;
  box-shadow: 0 8px 26px rgb(34 35 28 / 14%);
}

#ad-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.preview-caption {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #85867c;
  font-size: 9px;
}

.caption-sparkle {
  color: var(--accent);
  font-size: 12px;
}

.download-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 17px;
}

.download-row p {
  margin: 0;
  color: #50534a;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.7;
}

.download-row p span {
  color: #929389;
  font-size: 9px;
  font-weight: 400;
}

.button-primary {
  min-height: 42px;
  padding: 0 15px;
  background: var(--green);
  color: #fffefa;
  white-space: nowrap;
}

.button-primary:hover {
  background: #263d33;
}

.status-message {
  min-height: 18px;
  margin: 10px 0 0;
  color: #55705b;
  font-size: 11px;
}

.status-message[data-kind="error"] {
  color: #a34639;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0 25px;
  border-top: 1px solid rgb(48 51 42 / 8%);
  color: #a0a096;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.11em;
}

.import-concepts { display: grid; gap: 9px; padding-top: 15px; border-top: 1px solid var(--line); }
.import-concepts > label, .ad-fields label { display: grid; gap: 6px; color: #45483f; font-size: 11px; font-weight: 600; }
.import-concepts textarea, .ad-fields input, .ad-fields textarea {
  width: 100%; border: 1px solid #e4e2d9; border-radius: 8px; background: #fffefa; color: var(--ink);
  padding: 9px 10px; font-size: 12px; line-height: 1.45; resize: vertical;
}
.import-concepts textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.editor-actions { flex-wrap: wrap; }
.preview-panel { padding: 22px; }
.ads-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 22px; }
.ad-card { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #fffefa; }
.ad-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.ad-card-heading h3 { margin: 0; font-size: 13px; }
.concept-label { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ad-card .canvas-frame { overflow: hidden; border: 1px solid #eeece5; border-radius: 8px; background: #f5f0e7; }
.ad-canvas { display: block; width: 100%; height: auto; }
.ad-fields { display: grid; gap: 10px; margin-top: 12px; }
.ad-fields .button { justify-content: center; width: 100%; margin-top: 2px; }
.editor-note { line-height: 1.55; }
@media (max-width: 760px) {
  .ads-grid { grid-template-columns: 1fr; }
  .preview-panel { padding: 16px; }
  .ad-card { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: start; gap: 10px 14px; }
  .ad-card-heading { grid-column: 1 / -1; margin: 0; }
  .ad-card .canvas-frame { grid-column: 1; grid-row: 2; }
  .ad-fields { grid-column: 2; grid-row: 2; margin-top: 0; }
}
@media (max-width: 520px) {
  .ad-card { display: block; }
  .ad-fields { margin-top: 12px; }
}

@media (min-width: 1500px) {
  .app-shell {
    width: min(1320px, calc(100% - 100px));
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(680px, calc(100% - 40px));
  }

  .page-heading {
    padding-top: 36px;
  }

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

  .preview-panel {
    min-height: 0;
  }

  .preview-stage {
    padding: 20px;
  }

  .canvas-frame {
    width: min(100%, 480px);
  }
}

@media (max-width: 520px) {
  .topbar {
    height: 62px;
    padding: 0 18px;
  }

  .topbar-note {
    gap: 7px;
    font-size: 10px;
  }

  .app-shell {
    width: calc(100% - 28px);
  }

  .page-heading {
    align-items: flex-start;
    padding: 30px 0 21px;
  }

  .eyebrow {
    font-size: 8px;
  }

  .page-description {
    max-width: 230px;
    font-size: 11px;
  }

  .format-chip {
    gap: 4px;
    margin-top: 24px;
    padding: 7px 8px;
    font-size: 7px;
    white-space: nowrap;
  }

  .panel-heading {
    padding: 17px 17px 15px;
  }

  .editor-content {
    gap: 15px;
    padding: 17px;
  }

  .preview-panel {
    padding: 17px 14px 15px;
  }

  .preview-heading {
    padding-bottom: 13px;
  }

  .preview-title-line {
    gap: 8px;
  }

  .preview-title-line .section-number {
    width: 26px;
    height: 26px;
  }

  .preview-heading h2 {
    font-size: 14px;
  }

  .preview-heading p {
    margin-left: 34px;
  }

  .dimension-chip {
    padding: 6px 8px;
    font-size: 8px;
  }

  .preview-stage {
    gap: 10px;
    padding: 12px;
  }

  .download-row {
    align-items: flex-start;
  }

  .download-row p {
    font-size: 9px;
  }

  .download-row p span {
    font-size: 8px;
  }

  .button-primary {
    min-height: 39px;
    gap: 5px;
    padding: 0 10px;
    font-size: 9px;
  }

  .button-primary svg {
    width: 15px;
    height: 15px;
  }

  .page-footer {
    flex-direction: column;
    font-size: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Multi-image asset library and concept-specific editing controls. */
.asset-library { display: grid; gap: 9px; margin-top: 10px; }
.asset-row { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: #fffefa; }
.asset-thumb { width: 58px; height: 66px; object-fit: contain; background: #f1efe9; border-radius: 6px; }
.asset-meta { display: grid; gap: 6px; min-width: 0; }
.asset-meta strong { color: #55574f; font-size: 10px; }
.asset-meta input, .asset-meta select, .style-explorer select { min-width: 0; border: 1px solid #e4e2d9; border-radius: 6px; padding: 6px; background: #fffefa; color: var(--ink); font-size: 10px; }
.asset-actions { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.asset-actions button:disabled { opacity: .4; cursor: default; }
.style-explorer { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.style-explorer h3 { margin: 0; font-size: 12px; }
.style-explorer > label, .campaign-colors label { display: grid; gap: 5px; color: #45483f; font-size: 10px; font-weight: 600; }
.style-explorer select { width: 100%; }
.campaign-colors { display: flex; gap: 12px; }
.campaign-colors input, .ad-color-controls input { width: 38px; height: 30px; border: 0; padding: 0; background: transparent; }
.ads-grid { grid-template-columns: 1fr; }
.ad-card { display: grid; grid-template-columns: minmax(0, .9fr) minmax(220px, 1.1fr); align-items: start; gap: 10px 14px; }
.ad-card-heading { grid-column: 1 / -1; }
.ad-card > .canvas-frame { grid-column: 1; grid-row: 2; }
.ad-fields { grid-column: 2; grid-row: 2; max-height: 72vh; overflow: auto; padding-right: 4px; }
.ad-fields > label { display: grid; gap: 5px; color: #45483f; font-size: 10px; font-weight: 600; }
.ad-fields input:not([type="checkbox"]):not([type="range"]):not([type="color"]), .ad-fields textarea, .ad-fields select { width: 100%; border: 1px solid #e4e2d9; border-radius: 7px; padding: 7px; background: #fffefa; color: var(--ink); font-size: 10px; line-height: 1.4; }
.ad-fields textarea { resize: vertical; }
.asset-picker { display: grid; gap: 6px; min-width: 0; max-height: 190px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.asset-picker legend { padding: 0 4px; color: #45483f; font-size: 10px; font-weight: 600; }
.asset-choice { display: flex !important; align-items: center; gap: 6px !important; font-size: 9px !important; font-weight: 500 !important; }
.asset-choice input { flex: 0 0 auto; }
.asset-choice img { width: 28px; height: 30px; object-fit: contain; background: #f1efe9; border-radius: 3px; }
.asset-choice span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-color-controls { display: flex; gap: 12px; }
.ad-color-controls label { display: flex; align-items: center; gap: 6px; color: #45483f; font-size: 9px; }
.experiment-panel { display: grid; gap: 9px; padding: 15px 0 2px; border-top: 1px solid var(--line); }
.experiment-panel h3 { margin: 0; color: var(--ink); font-size: 13px; }
.experiment-panel > label { color: #45483f; font-size: 11px; font-weight: 600; }
.experiment-panel select { width: 100%; min-width: 0; border: 1px solid #e4e2d9; border-radius: 7px; padding: 9px; background: #fffefa; color: var(--ink); font-size: 11px; }
.experiment-panel button:disabled { opacity: .48; cursor: not-allowed; }
.experiment-status { margin: 0; color: #53564e; font-size: 11px; line-height: 1.5; }
.experiment-result { display: grid; grid-template-columns: minmax(0, .8fr) minmax(260px, 1fr); gap: 20px; align-items: start; margin: 22px 0 30px; padding: 18px; border: 1px solid #d7d0e9; border-radius: 14px; background: #f8f6fc; }
.experiment-result[hidden] { display: none; }
.experiment-result-copy { display: grid; gap: 8px; }
.experiment-result-copy .eyebrow { margin: 0; color: #65549a; }
.experiment-result-copy h3 { margin: 0; color: var(--ink); font-size: 18px; }
.experiment-result-copy > p { margin: 0; color: #62645d; font-size: 11px; line-height: 1.55; }
#experiment-copy { display: grid; gap: 1px; }
#experiment-copy p { margin: 5px 0; color: #45483f; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.experiment-result > canvas { display: block; width: 100%; height: auto; border: 1px solid #e4e2d9; border-radius: 7px; background: #fff; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .ad-fields { max-height: none; }
}
@media (max-width: 620px) {
  .ad-card { display: block; }
  .ad-fields { margin-top: 12px; }
  .experiment-result { grid-template-columns: 1fr; }
}

.generation-test { display: grid; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.generation-test[hidden] { display: none; }
.generation-test h4, .generation-ad-wrap h5 { margin: 0; color: var(--ink); font-size: 15px; }
.generation-test > label:not(.generation-approval) { font-size: 12px; font-weight: 650; }
.generation-test > select, .generation-test > input, .generation-test > textarea { width: 100%; }
.generation-approval { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; line-height: 1.5; }
.generation-approval input { flex: none; margin-top: 2px; }
.generation-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.generation-comparison figure { min-width: 0; margin: 0; }
.generation-comparison figcaption { min-height: 36px; margin-bottom: 6px; font-size: 11px; font-weight: 650; line-height: 1.4; }
.generation-comparison img { display: block; width: 100%; height: 230px; object-fit: contain; background: #e8e6df; border: 1px solid var(--line); border-radius: 10px; }
.generation-comparison > button { grid-column: 1 / -1; }
.generation-ad-wrap { display: grid; gap: 10px; }
.generation-ad-wrap canvas { display: block; width: min(100%, 420px); height: auto; margin: 0 auto; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
@media (max-width: 540px) {
  .generation-comparison { grid-template-columns: 1fr; }
  .generation-comparison img { height: 300px; }
  .generation-comparison > button { grid-column: auto; }
}
