:root {
  --bg: #0c0a08;
  --panel: #16110c;
  --panel-2: #1d1610;
  --line: rgba(212, 175, 106, 0.22);
  --gold: #d4af6a;
  --gold-2: #f0d9a6;
  --text: #f6efe4;
  --muted: #b7a892;
  --danger: #e08a7a;
  --ok: #8fbf8a;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Outfit, sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(212, 175, 106, 0.12), transparent 50%),
    var(--bg);
  color: var(--text);
}

.gold-line {
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-2), var(--gold), transparent);
}

.topbar, .layout { width: min(1280px, calc(100% - 32px)); margin: 0 auto; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 22px 0 16px;
  gap: 16px;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mode-switch {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #120e0a;
}
.mode-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
}
.mode-btn.is-active {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #2a1d0c;
}
.mode-only[hidden] { display: none !important; }
.mode-switch { flex-wrap: wrap; }
body[data-mode="print"] .layout-switch { display: none; }
.logo-preview {
  margin-top: 10px;
  max-width: 120px;
}
.logo-preview img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  display: block;
}
.thumb-item .code-field input {
  padding: 7px 8px;
  font-size: 12px;
  text-transform: uppercase;
}
.result-card[data-ratio="3:4"] img, .result-card[data-ratio="3:4"] .placeholder { aspect-ratio: 3 / 4; }
.results.print-results { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.eyebrow {
  margin: 0 0 4px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
}
h1, h2, h3 { font-family: "Cormorant Garamond", serif; margin: 0; font-weight: 600; }
h1 { font-size: 42px; line-height: 1; }
h2 { font-size: 28px; }
h3 { font-size: 30px; }

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding-bottom: 60px;
}
.span-all { grid-column: 1 / -1; }

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel-head, .generate-bar, .generate-actions, .row-actions, .progress-meta, .result-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-head { margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 14px; }
.count, .lock-pill {
  border: 1px solid var(--line);
  color: var(--gold-2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  text-align: center;
  min-height: 108px;
  border: 1px dashed var(--gold);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  background: rgba(212, 175, 106, 0.04);
}
.dropzone.drag { background: rgba(212, 175, 106, 0.12); }
.dropzone span { color: var(--muted); font-size: 13px; max-width: 360px; }

.layout-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  aspect-ratio: 3 / 4;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  cursor: pointer;
}
.thumb span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px;
  font-size: 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.8));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px 10px; }
.compact-fields input { padding: 8px 10px; }
.span-2 { grid-column: 1 / -1; }
input, select, textarea, button, .csv-btn {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  background: #0d0b09;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
input:focus, select:focus { outline: 1px solid var(--gold); }

.primary-btn, .ghost-btn, .csv-btn {
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid var(--line);
}
.primary-btn {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #2a1d0c;
  border: 0;
  font-weight: 600;
}
.primary-btn:disabled { opacity: 0.5; cursor: wait; }
.ghost-btn, .csv-btn {
  background: transparent;
  color: var(--gold-2);
}
.csv-btn { display: inline-flex; align-items: center; }

.look-fold {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.15);
}
.look-fold summary {
  cursor: pointer;
  color: var(--gold-2);
  font-size: 13px;
  padding: 4px 0;
}
.look-defaults { margin: 10px 0 6px; }
.card-list { display: grid; gap: 10px; }
.job-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #120e0a;
}
.job-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.job-card-head strong { font-size: 13px; color: var(--gold-2); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
}
.chip.is-on, .size-chip:checked + span {
  border-color: var(--gold);
  color: #2a1d0c;
  background: var(--gold);
}
.size-option { display: inline-flex; }
.size-option input { position: absolute; opacity: 0; pointer-events: none; }
.size-option span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.size-option input:checked + span {
  background: var(--gold);
  color: #2a1d0c;
  border-color: var(--gold);
}
.job-card .grid-3 .span-2 { grid-column: 1 / -1; }
.icon-btn {
  background: transparent;
  color: var(--danger);
  border: 0;
  cursor: pointer;
  font-size: 18px;
}

.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.check input { width: auto; }

.progress { margin-top: 16px; }
.track {
  height: 8px;
  background: #2a2218;
  border-radius: 999px;
  overflow: hidden;
}
.fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width 0.25s ease;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.result-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #100d0a;
}
.result-card img, .result-card .placeholder {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: #1a1510;
  color: var(--muted);
  font-size: 13px;
}
.result-card[data-ratio="16:9"] img, .result-card[data-ratio="16:9"] .placeholder { aspect-ratio: 16 / 9; }
.result-card[data-ratio="1:1"] img, .result-card[data-ratio="1:1"] .placeholder { aspect-ratio: 1 / 1; }
.result-card[data-ratio="9:16"] img, .result-card[data-ratio="9:16"] .placeholder { aspect-ratio: 9 / 16; }
.result-card[data-ratio="3:2"] img, .result-card[data-ratio="3:2"] .placeholder { aspect-ratio: 3 / 2; }
.results.banner-results { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.result-body { padding: 10px 12px 12px; }
.result-body strong { display: block; font-size: 13px; word-break: break-all; }
.result-body small { color: var(--muted); }
.result-card.failed .placeholder { color: var(--danger); }
.result-card.ok { border-color: rgba(143, 191, 138, 0.35); }
.result-actions { margin-top: 8px; }
.result-actions a, .result-actions button {
  font-size: 12px;
  padding: 7px 10px;
}
.rework-badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--gold-2);
}
.rework-card { width: min(720px, 100%); }
.rework-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #100d0a;
  margin-bottom: 10px;
}
.rework-preview img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #100d0a;
}
textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  background: #0d0b09;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 1.45;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  display: grid;
  gap: 12px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
code { color: var(--gold-2); }

@media (max-width: 900px) {
  .layout, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  h1 { font-size: 32px; }
  .topbar { align-items: start; flex-direction: column; }
}
