:root {
  --ink: #141414; --muted: #7a756c; --line: #ebe6dc; --bg: #f5f1ea; --card: #fff;
  --amber: #e39b2d; --amber-soft: #fbefd9; --amber-ink: #8a5a10; --err: #c0392b; --ok: #2f7d4f;
  --r: 16px; --shadow: 0 1px 2px rgba(20,20,20,.05), 0 4px 16px rgba(20,20,20,.04);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif; }
body.has-tabs { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
a { color: inherit; }
h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.01em; margin: 6px 0 16px; }
h2 { font-size: 18px; margin: 26px 0 10px; }
.muted { color: var(--muted); } .small { font-size: 14px; } .error { color: var(--err); } .ok { color: var(--ok); }

/* шапка */
.top { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px;
       padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--ink); color: #fff; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .02em; text-decoration: none; white-space: nowrap; }
.brand__cat { width: 28px; height: 28px; filter: invert(1); }
.who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; opacity: .8; text-decoration: none; }
.wrap { max-width: 980px; margin: 0 auto; padding: 16px 16px 28px; }

/* нижняя панель */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: rgba(255,255,255,.96);
          backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line);
          padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px;
            font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--ink); } .tabbar a.on svg { stroke: var(--amber); }
.tabbar__badge { position: absolute; top: 3px; left: 54%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
                 background: var(--amber); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* карточки и списки */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.card h2 { margin-top: 0; }
.narrow { max-width: 420px; margin: 28px auto; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { margin-bottom: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: var(--card);
       border-radius: var(--r); text-decoration: none; box-shadow: var(--shadow); }
.row__title { font-weight: 650; }
.row__right { text-align: right; flex-shrink: 0; }
.sum { font-weight: 750; white-space: nowrap; }
.badge { display: inline-block; margin-top: 4px; padding: 3px 9px; border-radius: 999px; background: #efe9de; font-size: 12px; font-weight: 600; white-space: nowrap; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.kv > span:first-child { color: var(--muted); }
.kv b { white-space: nowrap; }
.big { font-size: 24px; }
.inv { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.pos { list-style: none; margin: 0; padding: 0; }
.pos li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pos__name { font-weight: 600; }
.pos__calc { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; font-size: 15px; }
.pos__calc b { white-space: nowrap; }
.total { padding-top: 12px; font-size: 18px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.banner { background: var(--amber-soft); color: var(--amber-ink); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; font-weight: 600; }
.dev { background: #fff7d6; padding: 8px 12px; border-radius: 10px; }

/* формы и кнопки */
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0; }
input, textarea, select { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: inherit; font-size: 16px; border: 1px solid #d9d2c5;
        border-radius: 12px; background: #fff; color: var(--ink); }
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--amber); border-color: transparent; }
input.code { letter-spacing: 6px; font-size: 22px; text-align: center; }
button, .btn { display: block; width: 100%; padding: 14px 16px; margin-top: 12px; border: 0; border-radius: 14px; background: var(--ink);
               color: #fff; font: inherit; font-size: 16px; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer; }
button:disabled { opacity: .5; }
.btn.amber, button.amber { background: var(--amber); color: #fff; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.pick button { text-align: left; }

/* каталог */
.search { position: relative; margin-bottom: 10px; }
.search input { margin: 0; padding-left: 40px; border-radius: 14px; border-color: transparent; box-shadow: var(--shadow); }
.search svg { position: absolute; left: 13px; top: 13px; width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 14px;
        font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; margin: 0; width: auto; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.tune { display: inline-flex; align-items: center; gap: 6px; }
.chip.tune i { font-style: normal; background: var(--amber); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 12px; }
.count { font-size: 13px; color: var(--muted); margin: 2px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.prod { display: flex; flex-direction: column; background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.prod__img { position: relative; aspect-ratio: 1; background: #faf7f2; cursor: pointer; }
.prod__img img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.prod__tag { position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 999px; background: rgba(20,20,20,.82); color: #fff; font-size: 11px; font-weight: 700; }
.prod__body { display: flex; flex-direction: column; flex: 1; padding: 10px 12px 12px; }
.prod__brand { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--amber-ink); }
.prod__title { font-size: 14px; font-weight: 650; line-height: 1.3; margin: 3px 0 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.prod__meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.prod__foot { margin-top: auto; }
.price { font-size: 17px; font-weight: 800; }
.price s { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.price__unit { font-size: 12px; color: var(--muted); }
.add { margin-top: 8px; padding: 10px; border-radius: 12px; font-size: 14px; }
.stepper { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; background: var(--amber-soft); border-radius: 12px; }
.stepper button { width: 40px; margin: 0; padding: 9px 0; background: transparent; color: var(--amber-ink); font-size: 20px; line-height: 1; }
.stepper span { font-weight: 750; font-size: 14px; color: var(--amber-ink); }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }

/* шторка фильтров и карточка товара */
.sheet { position: fixed; inset: 0; z-index: 50; display: none; }
.sheet.open { display: block; }
.sheet__bg { position: absolute; inset: 0; background: rgba(20,20,20,.45); }
.sheet__box { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; background: var(--bg); border-radius: 22px 22px 0 0;
              padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .sheet__box { left: 50%; transform: translateX(-50%); width: 560px; bottom: 5vh; border-radius: 22px; } }
.sheet__grip { width: 40px; height: 5px; border-radius: 3px; background: #d6cfc2; margin: 0 auto 10px; }
.sheet h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 8px; }
.sheet .chips { flex-wrap: wrap; overflow: visible; }
.detail__img { background: #fff; border-radius: var(--r); aspect-ratio: 1; max-height: 46vh; width: 100%; object-fit: contain; }

/* корзина */
.cart-line { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 64px; height: 64px; object-fit: contain; background: #faf7f2; border-radius: 12px; }
.cart-line .stepper { width: 140px; }
.cart-line__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.day { flex-shrink: 0; width: auto; margin: 0; padding: 10px 12px; border-radius: 12px; background: #fff; color: var(--ink); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.day.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.sticky-total { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); margin: 0 -16px; padding: 12px 16px; background: rgba(245,241,234,.96);
                backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
