:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #20211f;
  --muted: #6f706c;
  --line: #ded8cd;
  --brand: #276c5f;
  --brand-dark: #184c44;
  --accent: #c7673c;
  --accent-soft: #f3d8c6;
  --shadow: 0 16px 45px rgba(32, 33, 31, 0.12);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(39, 108, 95, 0.08), transparent 260px),
    var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(246, 243, 238, 0.88);
  border-bottom: 1px solid rgba(222, 216, 205, 0.75);
  backdrop-filter: blur(16px);
}

.auth-panel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.auth-button {
  min-height: 36px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: var(--brand);
  color: white;
  padding: 0 14px;
  font-weight: 800;
}

.auth-button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: #ebe6dc;
  color: var(--muted);
}

.session-email {
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
  line-height: 1.1;
}

.brand-lockup small {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 3px;
}

.tenant-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tenant-tab,
.chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  color: var(--ink);
  padding: 0 14px;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.tenant-tab[aria-current="page"],
.chip.is-active {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.store-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: clamp(22px, 5vw, 56px);
  align-items: stretch;
  padding: clamp(28px, 6vw, 72px) clamp(16px, 4vw, 48px) clamp(20px, 4vw, 40px);
}

.admin-strip {
  padding: 0 clamp(16px, 4vw, 48px) 22px;
}

.admin-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.78);
}

.admin-card strong {
  flex: 0 0 auto;
}

.admin-card span {
  color: var(--muted);
  line-height: 1.4;
}

.admin-card.is-error {
  border-color: #b93f2f;
  background: #fff5f2;
}

.store-copy {
  align-self: center;
  max-width: 760px;
}

.eyebrow {
  display: inline-flex;
  color: var(--brand-dark);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-top: 12px;
  font-size: clamp(2.6rem, 6vw, 5.8rem);
  line-height: 0.94;
  letter-spacing: 0;
  max-width: 9ch;
}

.store-copy p {
  max-width: 60ch;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.65;
}

.store-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.primary-action,
.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 800;
  text-decoration: none;
}

.primary-action {
  background: var(--brand);
  color: white;
}

.ghost-action {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 253, 248, 0.72);
}

.store-visual {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.store-visual img {
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
  display: block;
}

.visual-panel {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-pill {
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.78);
}

.stat-pill strong,
.stat-pill span {
  display: block;
}

.stat-pill strong {
  font-size: 1.08rem;
}

.stat-pill span {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.catalog-workspace {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 22px;
  padding: 0 clamp(16px, 4vw, 48px) 56px;
}

.filters-panel {
  align-self: start;
  position: sticky;
  top: 88px;
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.82);
}

.filter-group {
  display: grid;
  gap: 9px;
}

.filter-group label,
.filter-label {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

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

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 30%, transparent);
  outline-offset: 2px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.products-area {
  min-width: 0;
}

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

.section-heading h2 {
  margin-top: 4px;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  line-height: 1.04;
}

#resultCount {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.product-card {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.product-card button {
  all: unset;
  display: grid;
  cursor: pointer;
}

.product-photo {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #e9e1d6;
}

.product-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 220ms ease;
}

.product-card:hover img {
  transform: scale(1.035);
}

.badge {
  position: absolute;
  left: 10px;
  top: 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #65301d;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 900;
}

.product-info {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.product-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.product-title-row h3 {
  font-size: 1rem;
  line-height: 1.2;
}

.price {
  color: var(--brand-dark);
  font-weight: 900;
  white-space: nowrap;
}

.meta-line,
.variant-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(32, 33, 31, 0.18);
}

.empty-state {
  padding: 44px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.7);
}

.empty-state p {
  margin-top: 8px;
  color: var(--muted);
}

.product-dialog {
  width: min(880px, calc(100vw - 24px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.product-dialog::backdrop {
  background: rgba(23, 24, 22, 0.58);
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 1.4rem;
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.92fr) minmax(280px, 1fr);
}

.dialog-layout img {
  width: 100%;
  height: 100%;
  min-height: 480px;
  object-fit: cover;
  display: block;
}

.dialog-details {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(22px, 5vw, 42px);
}

.dialog-details h2 {
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1;
}

.dialog-details p {
  color: var(--muted);
  line-height: 1.65;
}

.dialog-meta {
  display: grid;
  gap: 10px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 860px) {
  .topbar,
  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .auth-panel {
    margin-left: 0;
  }

  .admin-card {
    align-items: start;
    flex-direction: column;
  }

  .tenant-nav {
    justify-content: flex-start;
  }

  .store-intro,
  .catalog-workspace,
  .dialog-layout {
    grid-template-columns: 1fr;
  }

  .filters-panel {
    position: static;
  }

  .dialog-layout img {
    min-height: 320px;
    max-height: 420px;
  }
}

@media (max-width: 560px) {
  .store-actions,
  .dialog-actions {
    display: grid;
  }

  .visual-panel {
    grid-template-columns: 1fr;
  }

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