:root {
  --bg: #f4f6f7;
  --panel: #ffffff;
  --panel-soft: #eef3f4;
  --ink: #172027;
  --muted: #697780;
  --line: #dbe3e6;
  --brand: #187c72;
  --brand-2: #ffb000;
  --danger: #bd3d32;
  --blue: #315f91;
  --shadow: 0 20px 60px rgba(28, 41, 48, 0.13);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

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

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 58px 1fr;
}

.topbar {
  display: grid;
  grid-template-columns: 250px minmax(220px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(14px);
}

.brand,
.top-actions,
.result-actions,
.toolbar-right,
.badge-row,
.asset-title,
.job-top {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  min-width: 0;
}

.mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 176, 0, 0.95), rgba(255, 176, 0, 0) 54%),
    linear-gradient(135deg, #187c72, #315f91);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.1;
}

.brand span,
.project-field span,
.panel-head span,
small {
  color: var(--muted);
  font-size: 12px;
}

.project-field {
  display: grid;
  grid-template-columns: auto minmax(0, 480px);
  align-items: center;
  gap: 8px;
}

.project-field input {
  min-width: 0;
}

.top-actions,
.result-actions,
.toolbar-right {
  justify-content: flex-end;
  gap: 8px;
}

.top-spacer {
  min-width: 0;
}

.icon-btn,
.secondary-btn,
.primary-btn,
.text-btn {
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  font-weight: 800;
  font-size: 13px;
}

.icon-btn {
  width: 36px;
  padding: 0;
  font-size: 17px;
}

.primary-btn {
  border-color: #0f665e;
  background: var(--brand);
  color: #fff;
}

.text-btn {
  height: auto;
  padding: 0;
  border: 0;
  color: var(--brand);
  background: transparent;
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: 340px minmax(420px, 1fr) 340px;
  gap: 14px;
  padding: 14px;
  height: calc(100vh - 58px);
  min-height: 0;
  overflow: hidden;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 0;
}

.settings,
.results {
  overflow: auto;
}

.results {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
}

.results .section {
  overflow: auto;
}

.result-actions {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.panel-head,
.section-title,
.inspector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0 0 2px;
  font-size: 14px;
  line-height: 1.2;
}

.status-pill {
  border: 1px solid rgba(24, 124, 114, 0.25);
  border-radius: 999px;
  background: rgba(24, 124, 114, 0.08);
  color: #0e544e;
  padding: 5px 9px;
  font-weight: 900;
}

.section {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.section:last-child {
  border-bottom: 0;
}

.section-title {
  margin-bottom: 10px;
  color: #39464d;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 11px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-spaced {
  margin-top: 11px;
}

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

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

textarea {
  min-height: 78px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(24, 124, 114, 0.7);
  box-shadow: 0 0 0 3px rgba(24, 124, 114, 0.12);
}

.upload {
  display: grid;
  place-items: center;
  min-height: 122px;
  border: 1px dashed #b9c5c9;
  border-radius: var(--radius);
  background: #f7fafb;
  color: var(--muted);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload img {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload.has-image img,
.visual.has-image img,
.thumb.has-image img {
  display: block;
}

.upload.has-image .upload-copy {
  display: none;
}

.upload-copy strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
  font-size: 13px;
}

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

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: #334047;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.chip.active {
  color: #0e544e;
  border-color: rgba(24, 124, 114, 0.45);
  background: rgba(24, 124, 114, 0.09);
}

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

.color-field {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px;
}

.color-field input[type="color"] {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.color-field span {
  font-size: 12px;
  font-weight: 900;
}

.canvas-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.tabs,
.segmented {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.tabs button,
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.tabs button.active,
.segmented button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(28, 41, 48, 0.1);
}

.stage {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(23, 32, 39, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(23, 32, 39, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
}

.stage.mobile {
  padding-inline: clamp(18px, 12vw, 84px);
}

.creative {
  width: min(100%, 520px);
  aspect-ratio: 1 / 1;
  background: #fbfcfc;
  box-shadow: var(--shadow);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  transition: width 180ms ease;
}

.creative.size-story {
  width: min(100%, 340px);
  aspect-ratio: 9 / 16;
}

.creative.size-landscape {
  width: min(100%, 640px);
  aspect-ratio: 1.91 / 1;
}

.creative.layout-split .visual {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
}

.creative.layout-split .copy {
  width: 50%;
  height: 100%;
  padding: 8%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
}

.creative.layout-poster .visual {
  position: absolute;
  inset: 0;
}

.creative.layout-poster .visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(10, 18, 20, 0.74), rgba(10, 18, 20, 0.08) 62%);
}

.creative.layout-poster .copy {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 7%;
  color: #fff;
  text-align: left;
  z-index: 2;
}

.creative.layout-card .visual {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 6%;
  height: 45%;
  border-radius: 8px;
  overflow: hidden;
  background: #d9e4e6;
}

.creative.layout-card .copy {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: 7%;
  text-align: center;
}

.visual {
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 176, 0, 0.32), transparent 34%),
    linear-gradient(135deg, #d7ebea, #f8f2df 52%, #e9eef1);
}

.visual img,
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.logo-lock {
  position: absolute;
  left: 6%;
  top: 6%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #17312e;
  font-size: clamp(10px, 1.8vw, 13px);
  font-weight: 900;
  box-shadow: 0 6px 18px rgba(23, 32, 39, 0.14);
}

.logo-dot {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--brand);
}

.headline {
  margin: 0;
  font-size: clamp(24px, 4.2vw, 40px);
  line-height: 0.98;
  letter-spacing: 0;
  font-weight: 950;
  max-width: 100%;
  overflow-wrap: normal;
  color: inherit;
}

.subline {
  margin: 14px 0 0;
  max-width: 28ch;
  color: currentColor;
  opacity: 0.82;
  font-size: clamp(13px, 2vw, 18px);
  line-height: 1.35;
  font-weight: 650;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  min-height: 42px;
  border-radius: 8px;
  background: var(--brand-2);
  color: #161616;
  padding: 0 18px;
  font-size: clamp(12px, 1.9vw, 15px);
  font-weight: 950;
}

.inspector {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.inspector strong,
.inspector span {
  display: block;
}

.inspector strong {
  color: var(--ink);
  font-size: 13px;
}

.badge-row {
  flex-wrap: wrap;
  gap: 7px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.badge.ok {
  color: #0e544e;
}

.badge.warn {
  color: #7c5600;
}

.queue-list,
.asset-grid,
.rule-list {
  display: grid;
  gap: 10px;
}

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

.job {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.job-top {
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 850;
}

.progress {
  height: 7px;
  background: #e8eef0;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: var(--brand);
  transition: width 250ms ease;
}

.asset {
  display: grid;
  grid-template-columns: 82px 1fr;
  min-height: 82px;
}

.asset.selected {
  border-color: rgba(24, 124, 114, 0.55);
  box-shadow: 0 0 0 3px rgba(24, 124, 114, 0.1);
}

.thumb {
  background:
    linear-gradient(135deg, rgba(24, 124, 114, 0.22), rgba(255, 176, 0, 0.24)),
    #eef3f4;
  position: relative;
  overflow: hidden;
}

.asset-body {
  padding: 10px;
  display: grid;
  gap: 7px;
}

.asset-title {
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 900;
}

.asset-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.mini-actions {
  display: flex;
  gap: 6px;
}

.mini-actions button {
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: #3a474d;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 850;
}

.rule {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3c474e;
  font-size: 12px;
  font-weight: 750;
}

.rule input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

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

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

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

@media (max-width: 820px) {
  .app {
    grid-template-rows: auto 1fr;
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .project-field {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .result-actions,
  .canvas-toolbar,
  .toolbar-right,
  .inspector {
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 10px;
    height: auto;
    overflow: visible;
  }

  .stage {
    padding: 18px;
  }

  .creative.layout-split .copy {
    padding: 7%;
  }

  .headline {
    font-size: clamp(24px, 10vw, 48px);
  }
}
