:root {
  --ink: #2a2723;
  --muted: #6f675f;
  --paper: #fbfaf6;
  --linen: #eee7dc;
  --sage: #5f7668;
  --sage-dark: #334c43;
  --clay: #a75f46;
  --gold: #c69745;
  --sky: #d7e8ee;
  --white: #ffffff;
  --line: #ddd4c8;
  --shadow: 0 18px 50px rgba(42, 39, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 52px);
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

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

h1 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  line-height: 1;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.35rem);
  line-height: 1.05;
}

h3 {
  font-size: 1.15rem;
}

.eyebrow {
  color: var(--clay);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view-tabs,
.filters,
.form-actions,
.stat-row,
.cart-button,
.draft-pill {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tab,
.filter,
.cart-button,
.draft-pill,
.ghost-action,
.primary-action {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.tab,
.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 700;
}

.tab svg,
.cart-button svg,
.primary-action svg,
.ghost-action svg,
.draft-pill svg,
.notice svg,
.owner-hint svg,
.photo-drop svg {
  width: 18px;
  height: 18px;
}

.tab.is-active,
.filter.is-active,
.primary-action {
  color: var(--white);
  background: var(--sage-dark);
  border-color: var(--sage-dark);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 56px;
}

.notice,
.owner-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--sky);
  border: 1px solid #bfd5dc;
  border-radius: 8px;
  color: #253b43;
}

.notice {
  margin-bottom: 22px;
}

.app-view {
  display: none;
}

.app-view.is-visible {
  display: block;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head.compact {
  align-items: center;
}

.cart-button,
.draft-pill {
  padding: 0 14px;
  background: var(--white);
  font-weight: 700;
}

.filters {
  flex-wrap: wrap;
  margin-bottom: 20px;
}

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

.product-card,
.checkout-panel,
.add-form,
.inventory-panel,
.inventory-item {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.product-card {
  overflow: hidden;
}

.product-image {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--linen);
}

.product-image img,
.photo-drop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--white);
  background: var(--sage-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.product-badge.unavailable {
  background: var(--clay);
}

.product-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.product-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.price {
  color: var(--sage-dark);
  font-weight: 900;
}

.description,
.field-help,
.inventory-meta,
.empty-state {
  color: var(--muted);
  line-height: 1.45;
}

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

.tag {
  padding: 6px 9px;
  border-radius: 8px;
  background: var(--linen);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.checkout-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 16px;
}

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

.primary-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  font-weight: 800;
}

.ghost-action {
  color: var(--ink);
  background: var(--white);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.owner-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.add-form,
.inventory-panel {
  padding: 18px;
}

.add-form {
  display: grid;
  gap: 14px;
}

label,
.stock-box {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: var(--paper);
}

textarea {
  resize: vertical;
}

.stock-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.stock-box legend {
  padding: 0 6px;
  color: var(--sage-dark);
}

.check-row {
  grid-template-columns: 20px 1fr;
  align-items: center;
  font-weight: 700;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.photo-drop {
  min-height: 210px;
  place-items: center;
  text-align: center;
  padding: 18px;
  border: 2px dashed var(--gold);
  border-radius: 8px;
  background: #fff8ec;
  overflow: hidden;
  position: relative;
}

.photo-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-drop img {
  display: none;
  border-radius: 8px;
  max-height: 260px;
}

.photo-drop.has-image {
  padding: 0;
  border-style: solid;
}

.photo-drop.has-image svg,
.photo-drop.has-image span,
.photo-drop.has-image small {
  display: none;
}

.photo-drop.has-image img {
  display: block;
}

.inventory-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.inventory-item {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 14px;
  padding: 12px;
}

.inventory-item img {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--linen);
}

.inventory-copy {
  display: grid;
  gap: 8px;
}

.inventory-title-row,
.inventory-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.inventory-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.mini-action {
  min-height: 36px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
}

.mini-action.publish {
  color: var(--white);
  background: var(--sage);
  border-color: var(--sage);
}

.mini-action.danger {
  color: var(--white);
  background: var(--clay);
  border-color: var(--clay);
}

.status {
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 900;
  background: var(--linen);
}

.status.live {
  color: var(--white);
  background: var(--sage-dark);
}

.status.draft {
  color: var(--ink);
  background: var(--gold);
}

.status.out {
  color: var(--white);
  background: var(--clay);
}

@media (max-width: 900px) {
  .topbar,
  .section-head,
  .checkout-panel {
    align-items: stretch;
    flex-direction: column;
  }

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

  .checkout-panel {
    display: flex;
  }
}

@media (max-width: 560px) {
  .view-tabs,
  .form-actions {
    width: 100%;
  }

  .tab,
  .primary-action,
  .ghost-action {
    flex: 1;
  }

  .inventory-item {
    grid-template-columns: 86px 1fr;
  }

  .inventory-item img {
    width: 86px;
    height: 86px;
  }
}
