:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --ink: #1c1917;
  --muted: #78716c;
  --card: #fffcf7;
  --line: #e7e0d4;
  --accent: #c2410c;
  --accent-ink: #fff7ed;
  --danger: #b91c1c;
  --shadow: 0 18px 50px rgba(28, 25, 23, 0.08);
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #fff8ee, var(--bg) 42%);
  color: var(--ink);
}
main { padding: 2rem 1.25rem 3rem; }
h1 { margin: 0.15rem 0 0.5rem; font-size: 1.8rem; letter-spacing: -0.03em; }
p { color: var(--muted); }
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: min(100%, 22rem);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}
.auth-copy { margin: 0 0 1.25rem; }
.auth-error {
  margin: 0 0 1rem;
  color: var(--danger);
  font-weight: 600;
}
.pin-input {
  width: 100%;
  letter-spacing: 0.7em;
  text-align: center;
  font-size: 1.6rem;
  padding: 0.7rem 0.5rem 0.7rem 1.1rem;
  border-radius: 0.9rem;
  border: 1px solid var(--line);
  background: #fff;
  margin-bottom: 1rem;
}
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}
.pin-pad button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0.9rem;
  min-height: 3.2rem;
  font-size: 1.15rem;
  font-weight: 650;
  cursor: pointer;
}
.pin-pad button:hover { background: #fff7ed; }
.pin-enter {
  background: var(--accent) !important;
  color: var(--accent-ink);
  border-color: transparent !important;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.topbar form { margin: 0; }
.ghost {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
button.primary, .primary {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-weight: 650;
}
.lede { margin: 0; font-size: 0.92rem; }
.kicker { margin: 0 0 0.2rem; font-size: 0.85rem; }
.kicker a { color: var(--accent); text-decoration: none; font-weight: 650; }
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.7rem;
  margin: 0 0 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 650;
}
.filters .filter-q { flex: 1 1 16rem; min-width: 12rem; }
.filters select,
.filters input[type="search"] {
  appearance: none;
  min-height: 2.4rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 550;
}
.filters a.ghost { text-decoration: none; color: inherit; }
.catalog td.empty {
  text-align: center;
  padding: 1.5rem 0.7rem;
  color: var(--muted);
  font-weight: 550;
}
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 16rem);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}
table.catalog {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.catalog th, .catalog td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.catalog th {
  position: sticky;
  top: 0;
  background: #fff7ed;
  text-align: left;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  z-index: 1;
}
.catalog th a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  white-space: nowrap;
}
.catalog th a:hover { color: var(--accent); }
.catalog th.sorted a { color: var(--accent); }
.catalog td.name { min-width: 14rem; font-weight: 600; }
.product-cell {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.catalog .thumb-link {
  flex: 0 0 2.75rem;
  line-height: 0;
  border-radius: 0.45rem;
  text-decoration: none;
  color: inherit;
}
.catalog .thumb {
  display: block;
  width: 2.75rem;
  height: 2.75rem;
  object-fit: cover;
  object-position: center;
  border-radius: 0.45rem;
  border: 1px solid var(--line);
  background: #fff;
}
.catalog .thumb-link:hover .thumb { border-color: var(--accent); }
.catalog .thumb-empty { display: block; }
.catalog .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.diff-pos { color: #15803d; font-weight: 650; }
.diff-neg { color: var(--danger); font-weight: 650; }
.actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.detail-actions { margin-bottom: 1.25rem; }
.chip {
  display: inline-block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}
a.chip:hover { background: #fff7ed; border-color: var(--accent); color: var(--accent); }
.chip-disabled { color: #a8a29e; background: #f5f5f4; }
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.85rem 1.25rem;
  margin: 0 0 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.facts div { margin: 0; }
.facts dt { margin: 0; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.facts dd { margin: 0.15rem 0 0; font-weight: 650; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 0.7rem; }
.desc { white-space: pre-wrap; }
.thumbs { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.thumb-btn {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  border-radius: 0.75rem;
  line-height: 0;
}
.thumbs img {
  width: 7.5rem;
  height: 7.5rem;
  object-fit: cover;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: #fff;
}
.thumb-btn:hover img { border-color: var(--accent); }
html.lightbox-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 2.5rem 1.25rem 1.25rem;
  background: rgba(28, 25, 23, 0.72);
}
.lightbox-img {
  max-width: min(96vw, 72rem);
  max-height: min(88vh, 56rem);
  object-fit: contain;
  border-radius: 0.85rem;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  background: #fff;
}
.lightbox-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  appearance: none;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: #fff7ed; color: var(--accent); }
