:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #24201b;
  --muted: #766f66;
  --line: #ded6cc;
  --green: #1f7a5b;
  --green-dark: #14543f;
  --coral: #d85b45;
  --gold: #b98522;
  --blue: #426b8a;
  --shadow: 0 18px 50px rgba(38, 29, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  padding: 20px 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1;
}

h2 {
  font-size: 20px;
  line-height: 1.15;
}

.subtitle {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 10px;
}

.metric {
  min-height: 82px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric span {
  display: block;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.controls {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 0.75fr));
  gap: 10px;
  padding: 12px;
  background: rgba(246, 243, 238, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  border-color: var(--green);
  outline: 3px solid rgba(31, 122, 91, 0.16);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.message-panel {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: start;
}

.icon-button,
.copy,
.posted,
.image-link,
.story-link,
.whatsapp,
.secondary-action,
.share-main {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line);
  cursor: pointer;
  text-decoration: none;
}

.icon-button {
  padding: 0 12px;
  color: var(--green-dark);
  background: #eef7f2;
}

textarea {
  width: 100%;
  min-height: 390px;
  resize: vertical;
  padding: 14px;
  color: var(--ink);
  background: #fbfaf8;
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.45;
}

.panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.panel-actions .wide {
  grid-column: 1 / -1;
}

.secondary-action {
  display: grid;
  place-items: center;
  padding: 0 10px;
  color: var(--green-dark);
  background: #eef7f2;
  text-align: center;
}

.share-main {
  display: grid;
  place-items: center;
  padding: 0 14px;
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
  font-weight: 800;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  min-width: 0;
}

.card {
  display: grid;
  overflow: hidden;
  min-height: 480px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.card.is-selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 91, 0.14);
}

.card.is-posted {
  opacity: 0.68;
}

.card-select {
  display: grid;
  grid-template-rows: 210px 1fr;
  width: 100%;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.image-wrap {
  position: relative;
  display: block;
  height: 210px;
  background: #e8dfd5;
}

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

.image-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  background: #e8dfd5;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.card.has-image-error .image-wrap img {
  display: none;
}

.card.has-image-error .image-fallback {
  display: grid;
}

.badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 8px;
  color: #ffffff;
  background: var(--coral);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.card-body {
  display: grid;
  grid-template-rows: auto minmax(58px, auto) auto auto;
  gap: 9px;
  padding: 14px;
  min-width: 0;
}

.meta-row,
.price-row,
.stats {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.category,
.score {
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.category {
  overflow: hidden;
  color: var(--blue);
  background: #eef4f7;
  text-overflow: ellipsis;
}

.score {
  flex: 0 0 auto;
  color: var(--green-dark);
  background: #e7f4ee;
}

.product-name {
  display: -webkit-box;
  overflow: hidden;
  min-height: 58px;
  line-height: 1.22;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.price {
  font-size: 24px;
  font-weight: 900;
  color: var(--coral);
}

.old-price {
  overflow: hidden;
  color: var(--muted);
  text-decoration: line-through;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats {
  display: block;
  overflow: hidden;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 44px;
  grid-template-areas:
    "copy image posted"
    "story story posted"
    "whatsapp whatsapp posted";
  gap: 8px;
  align-items: center;
  padding: 0 14px 14px;
}

.copy {
  grid-area: copy;
}

.image-link {
  grid-area: image;
}

.story-link {
  grid-area: story;
}

.whatsapp {
  grid-area: whatsapp;
}

.posted {
  grid-area: posted;
  align-self: stretch;
}

.copy,
.image-link,
.story-link,
.posted {
  background: #fbfaf8;
}

.image-link,
.story-link {
  display: grid;
  place-items: center;
  color: var(--green-dark);
  font-weight: 700;
}

.story-link {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.whatsapp {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
  font-weight: 800;
}

.posted {
  color: var(--gold);
  font-size: 0;
}

.posted::before {
  content: "OK";
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 900;
}

.card.is-posted .posted::before {
  content: "Feito";
  font-size: 11px;
  font-weight: 900;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 36px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.story-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(216, 91, 69, 0.28), transparent 34%),
    linear-gradient(135deg, #15110d, #253b33 48%, #12100d);
  color: #ffffff;
}

.story-shell {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(260px, 360px);
  gap: 18px;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.story-card {
  position: relative;
  overflow: hidden;
  width: min(420px, 100%);
  aspect-ratio: 9 / 16;
  background: #15110d;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.story-card img {
  width: 100%;
  height: 58%;
  object-fit: cover;
  display: block;
}

.story-content {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  gap: 10px;
  padding: 24px;
  color: #ffffff;
  background: linear-gradient(180deg, rgba(21, 17, 13, 0.1), rgba(21, 17, 13, 0.96) 20%);
}

.story-tag {
  width: max-content;
  padding: 7px 10px;
  color: var(--green-dark);
  background: #dcf5e8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.story-title {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  font-size: 28px;
  line-height: 1.08;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.story-price {
  font-size: 42px;
  font-weight: 900;
  color: var(--coral);
}

.story-cta {
  margin-top: auto;
  padding: 14px;
  color: #ffffff;
  background: var(--green);
  border-radius: 8px;
  text-align: center;
  font-weight: 900;
}

.story-tools {
  display: grid;
  gap: 10px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  backdrop-filter: blur(14px);
}

.story-tools h1 {
  color: #ffffff;
  font-size: 28px;
}

.story-tools p {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.72);
}

.story-tools button,
.story-tools a {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 0 14px;
  color: #ffffff;
  background: var(--green);
  border: 0;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.story-tools .secondary {
  color: var(--green-dark);
  background: #eef7f2;
}

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

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

  .message-panel {
    position: static;
  }

  textarea {
    min-height: 260px;
  }

  .story-shell {
    grid-template-columns: 1fr;
  }

  .story-card {
    justify-self: center;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 12px;
  }

  .summary-grid,
  .controls {
    grid-template-columns: 1fr;
  }

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