:root {
  --bg: #fff2e5;
  --ink: #010101;
  --muted: #5f5f73;
  --panel: #fffaf4;
  --line: #ead7ea;
  --red: #f47c7c;
  --teal: #4d7ead;
  --mustard: #f0aa75;
  --blue: #7db7ff;
  --lavender: #cba6f7;
  --pink: #f0a3d6;
  --sage: #688b7c;
  --slate: #8787b4;
  --shadow: 0 20px 60px rgba(52, 44, 37, 0.12);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(244, 124, 124, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(203, 166, 247, 0.12) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  padding: 22px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 410px) 1fr;
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
}

.controls,
.results {
  background: rgba(255, 250, 244, 0.94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.controls {
  position: sticky;
  top: 22px;
  align-self: start;
  padding: 22px;
  border-radius: 8px;
}

.brand-row {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-logo {
  display: block;
  width: 86px;
  max-height: 64px;
  object-fit: contain;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

.brand-row p {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.35;
}

.generator-form {
  display: grid;
  gap: 15px;
}

label {
  display: grid;
  gap: 7px;
  color: #4d473e;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d7c4d7;
  border-radius: 6px;
  background: #fff9f2;
  color: var(--ink);
  min-height: 44px;
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 127, 120, 0.14);
}

textarea {
  padding-top: 12px;
  resize: vertical;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.actions,
.toolbar-actions,
.pin-meta,
.source-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.toolbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.toolbar-actions button {
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  min-height: 44px;
  padding: 0 17px;
  font-weight: 800;
}

.csv-status {
  max-width: 300px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
}

.csv-download-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid #cfc5b7;
  border-radius: 6px;
  background: #fff9f2;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.csv-download-link[hidden] {
  display: none;
}

.secondary-button {
  min-width: 116px;
  background: var(--teal);
}

.primary-button {
  flex: 1;
}

.icon-button,
.small-copy {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid #cfc5b7;
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.source-panel,
.csv-panel,
.product-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #efd1c1;
  border-radius: 8px;
  background: #fff7ef;
}

.product-panel {
  background: #fffdf8;
}

.csv-panel {
  background: #f8fbff;
  border-color: #c9dcf4;
}

.brand-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d9c2ef;
  border-radius: 8px;
  background: #fbf6ff;
}

.panel-heading h2 {
  font-size: 15px;
}

.panel-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.color-grid label {
  gap: 6px;
  font-size: 11px;
}

input[type="color"] {
  min-height: 38px;
  padding: 4px;
}

.source-actions {
  align-items: center;
}

.source-actions p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.image-tray {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.image-tray.has-images {
  display: grid;
}

.image-choice {
  position: relative;
  min-height: 72px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: white;
  padding: 0;
}

.image-choice.active {
  border-color: var(--pink);
}

.image-choice img {
  display: block;
  width: 100%;
  height: 72px;
  object-fit: cover;
}

.image-choice span {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(34, 32, 29, 0.82);
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.graphic-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 8px 10px;
  border: 1px dashed #d7c4d7;
  border-radius: 6px;
  background: #fff9f2;
  color: var(--muted);
  font-size: 12px;
}

.graphic-preview img {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
}

.seo-file-box {
  padding: 10px;
  border: 1px solid #ead7ea;
  border-radius: 6px;
  background: #fff9f2;
}

.seo-file-box p {
  margin-top: 7px;
  color: #5c554d;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.quick-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.quick-panel h2 {
  font-size: 16px;
  margin-bottom: 12px;
}

dl {
  display: grid;
  gap: 13px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  line-height: 1.4;
}

.results {
  min-height: calc(100vh - 44px);
  border-radius: 8px;
  overflow: hidden;
}

.results-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.78);
  backdrop-filter: blur(8px);
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.results-toolbar h2 {
  margin-top: 4px;
  font-size: clamp(22px, 3vw, 38px);
  line-height: 1.05;
}

.pin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.pin-card {
  display: block;
  width: 100%;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 28px rgba(45, 39, 34, 0.09);
}

.pin-copy {
  padding: 14px;
}

.pin-size {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.package-details,
.package-section {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.package-details div,
.package-section {
  padding: 10px;
  border: 1px solid #ead7ea;
  border-radius: 6px;
  background: #fff9f2;
}

.package-details strong,
.package-section strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
  text-transform: uppercase;
}

.package-details p,
.package-section p {
  margin-top: 5px;
  color: #5c554d;
  font-size: 13px;
  line-height: 1.4;
}

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

.mini-copy,
.text-button {
  border: 1px solid #cfc5b7;
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  min-height: 30px;
  padding: 0 10px;
}

.mini-copy.copied,
.text-button.copied,
.small-copy.copied,
.icon-button.copied {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.text-button {
  width: 100%;
  margin-top: 10px;
}

.char-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.keywords {
  color: var(--teal);
  font-weight: 800;
}

.copy-fallback {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(1, 1, 1, 0.32);
}

.copy-fallback[hidden] {
  display: none;
}

.copy-fallback-panel {
  width: min(720px, 100%);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.copy-fallback-panel p {
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.copy-fallback-panel textarea {
  min-height: 190px;
}

.pin-meta {
  justify-content: space-between;
  margin-bottom: 9px;
}

.format {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.small-copy {
  width: 34px;
  min-width: 34px;
  height: 34px;
  font-size: 12px;
}

.pin-card h3 {
  font-size: 19px;
  line-height: 1.1;
  font-family: var(--brand-font, Inter, ui-sans-serif, system-ui, sans-serif);
}

.description,
.hashtags,
.visual-prompt {
  margin-top: 9px;
  color: #5c554d;
  font-size: 14px;
  line-height: 1.45;
}

.hashtags {
  color: var(--teal);
  font-weight: 700;
}

details {
  margin-top: 11px;
  border-top: 1px solid #ece4da;
  padding-top: 9px;
}

summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

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

  .controls {
    position: static;
  }

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

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .controls,
  .results {
    border-radius: 6px;
  }

  .brand-row {
    grid-template-columns: 72px 1fr;
  }

  .brand-logo {
    width: 72px;
  }

  .field-grid,
  .results-toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .toolbar-actions {
    justify-content: stretch;
  }

  .toolbar-actions button {
    flex: 1;
  }

  .source-actions {
    align-items: stretch;
    display: grid;
  }

  .image-tray {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .pin-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  .pin-grid {
    grid-template-columns: 1fr;
  }
}
