:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #6b7280;
  --line: #d7d2c8;
  --paper: #f6f3ef;
  --surface: #ffffff;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #b45309;
  --ok-bg: #dcfce7;
  --low-bg: #fef3c7;
  --zero-bg: #f3f4f6;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

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

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 18px 14px 36px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.logout-link,
.home-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.home-link {
  background: #111827;
  border-color: #111827;
  color: #fff;
  padding: 10px 13px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

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

.sync-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.search-panel,
.stats-grid article,
.product-card,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search-panel {
  padding: 14px;
}

.season-selector {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.season-selector > span {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.season-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  flex: 1;
  max-width: 420px;
}

.season-button {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.season-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.season-button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.search-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 8px;
}

.search-row input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

.search-row button,
.scanner-actions button,
.filter {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.search-row button {
  min-height: 48px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.filters {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter {
  flex: 0 0 auto;
  padding: 0 12px;
  color: var(--muted);
}

.filter.active {
  background: #111827;
  border-color: #111827;
  color: #fff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 18px;
}

.no-price-view .stats-grid {
  display: none;
}

.stats-grid article {
  padding: 12px;
}

.stats-grid span {
  display: block;
  font-size: 22px;
  font-weight: 800;
}

.stats-grid p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.scanner-panel {
  margin-bottom: 18px;
  background: #111827;
  border-radius: 8px;
  overflow: hidden;
}

.scanner-panel video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.scanner-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  color: #fff;
}

.scanner-actions button {
  padding: 0 14px;
}

.hidden {
  display: none;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.results-header h2 {
  font-size: 18px;
}

.results-header span {
  color: var(--muted);
  font-size: 13px;
}

.products-list {
  display: grid;
  gap: 10px;
}

.product-card {
  overflow: hidden;
}

.product-summary {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 84px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 10px 12px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.product-card.open .product-summary {
  border-bottom-color: var(--line);
}

.product-image {
  display: grid;
  place-items: center;
  width: 68px;
  aspect-ratio: 1 / 1;
  border: 1px dashed #b9b2a7;
  border-radius: 6px;
  background: #f7f7f5;
  color: #9b9288;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  overflow: hidden;
}

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

.product-title strong {
  display: block;
  font-size: 16px;
  line-height: 1.25;
}

.product-title span,
.product-price {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.product-price {
  color: var(--accent-dark);
  font-weight: 800;
}

.availability-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 800;
}

.product-status {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.product-total {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.availability-badge.available {
  background: var(--ok-bg);
  color: #166534;
}

.availability-badge.low {
  background: var(--low-bg);
  color: var(--warn);
}

.availability-badge.zero {
  background: var(--zero-bg);
  color: var(--muted);
}

.variant-block {
  display: none;
  padding: 12px 14px 14px;
}

.product-card.open .variant-block {
  display: block;
}

.detail-image {
  width: 100%;
  max-height: 360px;
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: #f7f7f5;
}

.detail-image img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.color-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  gap: 3px;
}

.size-cell {
  min-width: 0;
  min-height: 34px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 4px 2px;
  text-align: center;
}

.size-cell .size {
  display: block;
  font-size: 11px;
  font-weight: 800;
}

.size-cell .qty {
  display: block;
  margin-top: 1px;
  font-size: 10px;
}

.size-cell.available {
  background: var(--ok-bg);
  border-color: #86efac;
}

.size-cell.low {
  background: var(--low-bg);
  border-color: #facc15;
}

.size-cell.zero {
  background: var(--zero-bg);
  color: var(--muted);
}

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

@media (min-width: 760px) {
  .app-shell {
    padding-top: 28px;
  }

  h1 {
    font-size: 34px;
  }

  .products-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 430px) {
  .topbar {
    display: grid;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .home-link {
    flex: 1 1 100%;
    text-align: center;
  }

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

  .product-image {
    width: 58px;
  }

  .availability-badge {
    grid-column: 2;
    justify-self: start;
  }

  .product-status {
    grid-column: 2;
    justify-items: start;
  }
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.login-shell {
  width: min(100%, 380px);
}

.login-card {
  display: grid;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.login-card h1 {
  margin-bottom: 8px;
}

.login-card label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-card input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
}

.login-card button {
  min-height: 46px;
  margin-top: 8px;
  border: 0;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.login-error {
  border-radius: 6px;
  background: #fee2e2;
  color: #991b1b;
  padding: 9px 10px;
  font-size: 13px;
  font-weight: 700;
}
