:root {
  --yellow: #dfba2f;
  --yellow-2: #f0d35a;
  --yellow-soft: #f7e7a1;
  --cream: #fff8dd;
  --ink: #1d2224;
  --ink-2: #2c3335;
  --muted: #6e7470;
  --line: #d7c98c;
  --panel: #fffdf6;
  --green: #4c5b55;
  --red: #a94335;
  --shadow: 0 8px 24px rgba(29,34,36,.10);
  --radius: 16px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: #f3f0e4;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(29,34,36,.98);
  color: #fff;
  border-bottom: 4px solid var(--yellow);
}
.topbar-inner {
  width: min(1180px, 100%);
  margin: 0 auto;
  min-height: 66px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
  border: 2px solid #f7e598;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.12);
}
.brand-name {
  font-size: 1.12rem;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.brand-sub {
  color: #c9ccca;
  font-size: .73rem;
  margin-top: 2px;
}
.top-actions { display: flex; gap: 8px; }
.icon-btn, .ghost-btn {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid #545c5b;
  padding: 0 13px;
  background: #252b2d;
  color: #fff;
  cursor: pointer;
}
.icon-btn:hover, .ghost-btn:hover { border-color: var(--yellow); }

main { width: min(1180px, 100%); margin: 0 auto; padding: 20px 16px 140px; }
.hero {
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  min-height: 205px;
  display: flex;
  align-items: flex-end;
  background:
    linear-gradient(120deg, rgba(223,186,47,.98), rgba(238,205,83,.94) 58%, rgba(204,169,36,.92)),
    #dfba2f;
  box-shadow: var(--shadow);
  border: 1px solid rgba(45,53,53,.14);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 92px, rgba(0,0,0,.035) 92px 97px),
    linear-gradient(180deg, transparent, rgba(0,0,0,.07));
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 1; max-width: 760px; padding: 24px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(29,34,36,.90);
  color: #fff;
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.hero h1 {
  margin: 12px 0 8px;
  font-size: clamp(2rem, 8vw, 4.6rem);
  line-height: .92;
  letter-spacing: -.045em;
}
.hero p { margin: 0; max-width: 600px; font-size: 1rem; color: #313634; }

.toolbar {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}
.search {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 0 14px;
  outline: none;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(29,34,36,.04);
}
.search:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(223,186,47,.20); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-btn {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid #c6b56c;
  padding: 0 12px;
  background: #fff9e7;
  color: var(--ink-2);
  cursor: pointer;
  font-size: .88rem;
  font-weight: 700;
}
.filter-btn.active { background: var(--green); color: #fff; border-color: var(--green); }

.content-head {
  margin-top: 22px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}
.section-title { margin: 0; font-size: 1.25rem; }
.section-note { color: var(--muted); font-size: .86rem; }

.products-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.product-card {
  background: var(--panel);
  border: 1px solid #ddd4ad;
  border-radius: var(--radius);
  padding: 13px;
  display: grid;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(29,34,36,.035);
}
.product-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.category-label {
  color: var(--muted);
  font-size: .69rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.product-name { margin-top: 3px; font-weight: 850; font-size: 1rem; }
.price { white-space: nowrap; font-weight: 950; font-size: 1.15rem; color: #625018; }
.price small { font-size: .75rem; font-weight: 700; color: var(--muted); }
.product-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.qty {
  display: grid;
  grid-template-columns: 44px minmax(50px, 1fr) 44px;
  height: 46px;
  border: 1px solid #cfc59d;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.qty button { border: 0; background: #f5f1df; cursor: pointer; font-size: 1.25rem; font-weight: 900; color: var(--ink); }
.qty button:active { background: var(--yellow-soft); }
.qty input { width: 100%; border: 0; border-inline: 1px solid #ddd6b8; outline: 0; text-align: center; font-weight: 850; color: var(--ink); background: #fff; }
.add-zero {
  min-height: 46px;
  min-width: 74px;
  border-radius: 12px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  cursor: pointer;
  padding: 0 12px;
  font-weight: 800;
}

.empty-state {
  padding: 34px 16px;
  border: 1px dashed #c7ba81;
  border-radius: var(--radius);
  margin-top: 12px;
  text-align: center;
  background: #fbf8eb;
  color: var(--muted);
}

.summary-bar {
  position: fixed;
  z-index: 40;
  left: 10px;
  right: 10px;
  bottom: calc(10px + var(--safe-bottom));
  min-height: 68px;
  border-radius: 18px;
  background: rgba(29,34,36,.98);
  color: #fff;
  border: 1px solid #4b5352;
  box-shadow: 0 12px 30px rgba(0,0,0,.20);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px 10px 15px;
}
.summary-meta { min-width: 0; }
.summary-label { color: #cfd2d0; font-size: .73rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.summary-count { font-weight: 850; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-total { color: var(--yellow-2); font-size: 1.35rem; font-weight: 950; white-space: nowrap; }

.admin-wrap { max-width: 1080px; margin: 0 auto; }
.admin-panel {
  background: var(--panel);
  border: 1px solid #d8cfaa;
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.admin-title { margin: 0 0 3px; font-size: 1.45rem; }
.admin-sub { margin: 0 0 16px; color: var(--muted); font-size: .9rem; }
.form-grid { display: grid; gap: 10px; }
.field { display: grid; gap: 6px; }
.field label { font-size: .78rem; font-weight: 800; color: var(--green); }
.field input {
  min-height: 46px;
  width: 100%;
  border: 1px solid #cfc59d;
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  outline: 0;
}
.field input:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(223,186,47,.18); }
.primary {
  min-height: 46px;
  border: 1px solid #caa919;
  border-radius: 12px;
  padding: 0 16px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}
.primary:active { transform: translateY(1px); }
.secondary {
  min-height: 44px;
  border: 1px solid #c9bf99;
  border-radius: 12px;
  padding: 0 14px;
  background: #faf6e8;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.message { margin-top: 10px; min-height: 20px; font-size: .86rem; color: var(--red); }
.message.ok { color: var(--green); }

.admin-list { margin-top: 16px; display: grid; gap: 10px; }
.admin-item {
  border: 1px solid #ddd4ad;
  border-radius: 15px;
  background: #fffdf7;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.admin-item-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.admin-item-name { font-weight: 900; }
.admin-item-category { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.admin-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.admin-mini { display: grid; gap: 5px; }
.admin-mini label { font-size: .72rem; color: var(--muted); font-weight: 800; }
.admin-mini input[type="number"] { min-height: 44px; border: 1px solid #cfc59d; border-radius: 10px; padding: 0 9px; width: 100%; background: #fff; }
.active-check { min-height: 44px; display: inline-flex; align-items: center; gap: 7px; font-size: .84rem; font-weight: 800; }
.active-check input { width: 20px; height: 20px; accent-color: var(--green); }
.save-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.saved-note { color: var(--green); font-size: .75rem; font-weight: 800; min-height: 18px; }

.back-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; font-weight: 850; margin-bottom: 12px; }
.back-link:hover { text-decoration: underline; }
.warning {
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff5d4;
  border: 1px solid #e6cf73;
  color: #5b4a18;
  font-size: .84rem;
  margin-bottom: 12px;
}

.noscript { margin: 20px; padding: 16px; border-radius: 12px; background: #fff; }

@media (min-width: 700px) {
  main { padding-top: 28px; }
  .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .toolbar { grid-template-columns: minmax(280px, 1fr) auto; align-items: center; }
  .filters { justify-content: flex-end; }
  .hero { min-height: 260px; }
  .hero-copy { padding: 32px; }
  .form-grid.two { grid-template-columns: 1fr 1fr; }
  .admin-panel { padding: 20px; }
}

@media (min-width: 980px) {
  .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-bar { left: 50%; right: auto; width: min(720px, calc(100% - 32px)); transform: translateX(-50%); }
  .admin-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 430px) {
  .brand-sub { display: none; }
  .topbar-inner { padding-inline: 12px; }
  main { padding-inline: 12px; }
  .hero-copy { padding: 20px; }
  .hero p { font-size: .92rem; }
  .add-zero { display: none; }
  .product-actions { grid-template-columns: 1fr; }
}

.admin-toolbar{display:flex;gap:10px;align-items:center;margin-bottom:14px}.admin-toolbar .search{flex:1}.product-image-wrap{width:100%;aspect-ratio:16/9;border-radius:14px;overflow:hidden;background:#ece8d8;margin-bottom:12px}.product-image{width:100%;height:100%;object-fit:cover;display:block}.admin-preview{width:88px;height:66px;border-radius:10px;overflow:hidden;background:#ece8d8;margin-bottom:10px}.admin-preview img{width:100%;height:100%;object-fit:cover;display:block}.new-item{margin:14px 0;padding:16px;border:1px solid rgba(0,0,0,.12);border-radius:16px;background:rgba(255,255,255,.7)}.admin-fields-new{grid-template-columns:repeat(2,minmax(0,1fr))}.admin-wide{grid-column:1/-1}@media(max-width:640px){.admin-toolbar{align-items:stretch;flex-direction:column}.admin-toolbar .primary{width:100%}.admin-fields-new{grid-template-columns:1fr}.admin-wide{grid-column:auto}}
