:root {
  color-scheme: light;
  --ink: #18211d;
  --muted: #65726c;
  --line: #d8ded8;
  --soft: #f3f5f0;
  --paper: #ffffff;
  --brand: #0f4b3a;
  --bad: #b43d3d;
  --warn: #9b6400;
  --ok: #23724d;
  --shadow: 0 14px 36px rgba(23, 39, 32, 0.1);
  font-family: Arial, "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef2ec;
}

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

button {
  border: 1px solid #143f32;
  background: #143f32;
  color: #fff;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: #143f32;
}

button.danger {
  background: var(--bad);
  border-color: var(--bad);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.topbar {
  min-height: 88px;
  padding: 18px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 5;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
}

.top-actions,
.row-actions,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.token-input {
  width: 220px;
}

.shell {
  padding: 22px;
  max-width: 1540px;
  margin: 0 auto;
}

.summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.stat span,
.stat small {
  color: var(--muted);
  font-size: 12px;
  display: block;
}

.stat span {
  margin-bottom: 7px;
}

.stat strong {
  font-size: 28px;
  display: block;
  margin-bottom: 4px;
}

.workspace {
  display: grid;
  grid-template-columns: 190px 390px 1fr;
  gap: 16px;
  align-items: start;
}

.shop-nav,
.sidebar,
.details {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.shop-nav {
  padding: 12px;
  position: sticky;
  top: 110px;
  display: grid;
  gap: 8px;
}

.shop-nav-title {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 4px 8px;
}

.shop-nav-item {
  width: 100%;
  min-height: 72px;
  display: grid;
  gap: 4px;
  align-content: center;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px;
}

.shop-nav-item:hover,
.shop-nav-item.active {
  border-color: #143f32;
  background: #eef5ee;
}

.shop-nav-item strong,
.shop-nav-item span,
.shop-nav-item small {
  display: block;
}

.shop-nav-item span,
.shop-nav-item small {
  color: var(--muted);
  font-size: 12px;
}

.filters {
  padding: 14px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cbd4cc;
  border-radius: 6px;
  min-height: 40px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.list {
  max-height: calc(100dvh - 250px);
  overflow: auto;
}

.list-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  border-radius: 0;
  display: block;
  padding: 13px 14px;
}

.list-item:hover,
.list-item.selected {
  background: #eef5ee;
}

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

.sku-line {
  margin-bottom: 5px;
}

.sku {
  font-weight: 800;
  color: #123c31;
}

.product-name {
  font-size: 20px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.details {
  padding: 18px;
  min-height: 620px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.grid-2.tight {
  gap: 10px;
}

.panel,
.edit-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcf9;
}

.edit-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  background: #fffaf0;
}

.section {
  margin-top: 14px;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #e5ebe5;
  color: #26473c;
}

.status.READY,
.status.APPROVED_FOR_IMAGE_WORKER,
.status.APPROVED_FINAL {
  background: #dcefe4;
  color: var(--ok);
}

.status.BUSINESS_INPUT,
.status.PHOTO_INPUT,
.status.SOURCE_CONFLICT,
.status.CODEX_CURATION,
.status.BRIEF_REJECTED,
.status.REJECTED_NEEDS_REGEN,
.status.NEEDS_BUSINESS_INPUT,
.status.NEEDS_PHOTO_INPUT {
  background: #f7e1de;
  color: var(--bad);
}

.status.READY_FOR_HUMAN_REVIEW,
.status.WAITING_OUTPUT_REVIEW,
.status.DESIGN_TEMPLATE_PENDING {
  background: #fff0d7;
  color: var(--warn);
}

.chips,
.shop-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cfdbd2;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  color: #2f493f;
  background: #fff;
}

.usp {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

.usp strong {
  display: block;
  margin-bottom: 4px;
}

.usp.compact {
  font-size: 13px;
}

.photo-grid,
.output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.photo-box,
.output-card,
.brief-card,
.shop-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.photo-box {
  color: var(--ink);
  padding: 0;
  text-align: left;
  min-height: 0;
}

.photo-box img,
.output-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
  background: #edf0ed;
}

.photo-box span,
.output-card .body,
.brief-card,
.shop-card {
  display: block;
  padding: 10px;
}

.image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.photo-missing {
  display: grid;
  place-items: center;
  min-height: 120px;
  background: #edf0ed;
  color: var(--muted);
}

.shop-card {
  width: calc(50% - 3px);
  display: grid;
  gap: 6px;
}

.feedback-box {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.feedback-note {
  background: #fff7e6;
  border: 1px solid #efd9a8;
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #17231f;
  color: #edf5ed;
  padding: 12px;
  border-radius: 8px;
  max-height: 320px;
  overflow: auto;
}

.empty {
  color: var(--muted);
  padding: 40px;
  text-align: center;
}

.image-dialog {
  width: min(96vw, 1200px);
  height: min(96dvh, 1200px);
  padding: 48px 16px 16px;
  border: 0;
  border-radius: 8px;
  background: #111;
}

.image-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.image-dialog img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #fff;
  color: #111;
  border-color: #fff;
}

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

.edit-photos-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.edit-photo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px;
  background: #f1f3f1;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.edit-photo-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.small-btn {
  min-height: 28px !important;
  height: 28px;
  padding: 0 8px !important;
  font-size: 12px !important;
}

.grid-3-columns-span-all {
  grid-column: 1 / -1;
}

@media (max-width: 1100px) {
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .shop-nav {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shop-nav-title {
    grid-column: 1 / -1;
  }

  .list {
    max-height: 360px;
  }
}
