/* LoLo — вітрина. Колір бренду приходить з налаштувань таблиці (--brand). */
:root {
  --brand: #1F9D55;
  --brand-ink: #0E5A30;
  --brand-soft: #E7F5EC;
  --ink: #15201A;
  --muted: #66736B;
  --line: #E3E8E4;
  --bg: #F6F8F6;
  --card: #FFFFFF;
  --warn: #C2410C;
  --danger: #B42318;
  --ok: #15803D;
  --radius: 16px;
  --f: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--f); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.wrap { max-width: 1160px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

/* ---------- шапка ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(246, 248, 246, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.top-in { display: flex; align-items: center; gap: 10px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { height: 36px; width: auto; }
.brand-name { font-weight: 800; font-size: 24px; letter-spacing: -.02em; color: var(--brand); }
.opt-badge { background: var(--ink); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .08em; padding: 4px 9px; border-radius: 99px; }
.cart-btn { margin-left: auto; position: relative; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; }
.cart-count { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.cart-btn.bump { animation: bump .35s; }
@keyframes bump { 50% { transform: scale(1.12); } }

/* ---------- hero ---------- */
.hero { padding: 22px 0 10px; display: grid; gap: 12px; }
.hero h1 { margin: 0; font-size: clamp(22px, 4.4vw, 34px); line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; max-width: 22ch; }
.live { display: inline-flex; align-items: center; gap: 8px; width: fit-content; background: var(--ink); color: #fff; border-radius: 99px; padding: 7px 14px; font-weight: 600; font-size: 14px; }
.live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #F04438; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.opt-note { background: var(--brand-soft); color: var(--brand-ink); border-radius: 12px; padding: 10px 14px; font-weight: 500; width: fit-content; max-width: 100%; }
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1.5px solid var(--ink); border-radius: 16px; padding: 0 14px; height: 56px; max-width: 640px; }
.search svg { color: var(--muted); flex: 0 0 auto; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; height: 100%; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- тематики ---------- */
.topics { display: flex; gap: 8px; overflow-x: auto; padding: 6px 0 4px; scrollbar-width: none; }
.topics::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 8px 14px; font-weight: 500; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.status-line { color: var(--muted); font-size: 13px; min-height: 20px; margin: 6px 0; }

/* ---------- сітка ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1020px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 8px 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 35% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: 0 0 0 0 transparent; } }
.ph { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: var(--brand-soft); border: 0; padding: 0; width: 100%; display: block; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 42px; color: var(--brand); opacity: .55; }
.code { position: absolute; left: 6px; top: 6px; background: rgba(255, 255, 255, .94); border-radius: 7px; padding: 2px 7px; font-size: 12px; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--ink); }
.tag { position: absolute; right: 6px; top: 6px; border-radius: 7px; padding: 2px 7px; font-size: 11.5px; font-weight: 700; color: #fff; background: var(--ink); }
.tag.t-hit { background: #E5484D; } .tag.t-new { background: #3E63DD; } .tag.t-sale { background: #F5A524; color: #231A00; }
.card h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.price b { font-size: 17px; }
.price s { color: var(--muted); font-size: 12.5px; }
.stock { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stock::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stock.ok { color: var(--ok); } .stock.low { color: var(--warn); } .stock.no { color: #98A29C; }
.add { margin-top: auto; border: 0; border-radius: 11px; height: 42px; background: var(--brand); color: #fff; font-weight: 700; }
.add:disabled { background: #E9ECEA; color: #98A29C; cursor: not-allowed; }
.stepper { margin-top: auto; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; height: 42px; border-radius: 11px; background: var(--brand-soft); }
.stepper button { height: 42px; border: 0; background: transparent; font-size: 20px; font-weight: 700; color: var(--brand-ink); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper span { text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 10px; }
.skel { background: linear-gradient(90deg, #EEF1EF 25%, #F6F8F6 50%, #EEF1EF 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--radius); aspect-ratio: 3 / 4.4; }
@keyframes sk { to { background-position: -200% 0; } }
.more-wrap { display: flex; justify-content: center; padding: 18px 0 8px; }

/* ---------- кнопки ---------- */
.btn { border: 0; border-radius: 14px; min-height: 52px; padding: 0 20px; font-weight: 700; font-size: 16px; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; text-decoration: none; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); width: auto; }
.btn.dark { background: var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; flex: 0 0 auto; }
.link { background: none; border: 0; padding: 0; color: var(--brand-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- футер ---------- */
.foot { margin-top: 40px; background: var(--card); border-top: 1px solid var(--line); padding: 28px 0 calc(110px + env(safe-area-inset-bottom)); }
.foot-in { display: grid; gap: 24px; }
@media (min-width: 820px) { .foot-in { grid-template-columns: 1fr 1.3fr; } .foot-meta { grid-column: 1 / -1; } }
.foot-title { font-weight: 700; margin-bottom: 10px; }
.contacts { display: flex; flex-wrap: wrap; gap: 8px; }
.contacts a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; text-decoration: none; font-weight: 600; color: #fff; }
.c-tg { background: #229ED9; } .c-vb { background: #7360F2; } .c-ph { background: var(--ink); } .c-tt { background: #111; } .c-ig { background: #C13584; }
.terms details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.terms summary { font-weight: 600; cursor: pointer; }
.terms p { margin: 8px 0 0; color: var(--muted); white-space: pre-line; }
.foot-meta { color: var(--muted); font-size: 13px; }

/* ---------- плаваюча панель броні ---------- */
.pending-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 25; width: min(560px, calc(100% - 24px)); background: var(--ink); color: #fff; border-radius: 16px; padding: 12px 12px 12px 16px; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .22); }
.pending-bar .pb-txt { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; }
.pending-bar b { font-variant-numeric: tabular-nums; }
.pending-bar .btn { width: auto; min-height: 42px; padding: 0 16px; font-size: 14px; }
.cart-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 24; width: min(560px, calc(100% - 24px)); }
.cart-bar .btn { box-shadow: 0 10px 30px rgba(0, 0, 0, .18); justify-content: space-between; padding: 0 18px; }

/* ---------- шторка (кошик / оформлення) ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(12, 18, 14, .45); }
.sheet { position: fixed; z-index: 41; background: var(--bg); display: flex; flex-direction: column; inset: auto 0 0 0; max-height: 92vh; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: up .25s ease-out; }
@media (min-width: 760px) { .sheet { inset: 0 0 0 auto; width: 460px; max-height: none; border-radius: 0; animation: side .25s ease-out; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes side { from { transform: translateX(30px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 18px; flex: 1; }
.sheet-body { overflow-y: auto; padding: 16px; display: grid; gap: 12px; align-content: start; }
.line { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.line .mini { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--brand-soft); display: grid; place-items: center; font-weight: 800; color: var(--brand); }
.line .mini img { width: 100%; height: 100%; object-fit: cover; }
.line .nm { min-width: 0; font-size: 14px; line-height: 1.3; }
.line .nm small { display: block; color: var(--muted); font-variant-numeric: tabular-nums; }
.line .nm .warn { color: var(--warn); font-weight: 600; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); font-weight: 700; }
.qty button:disabled { opacity: .35; }
.qty span { min-width: 22px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 17px; font-weight: 700; padding: 4px 2px; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 13px; }
.alert { background: #FFF4ED; color: #9A3412; border: 1px solid #FED7AA; border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.alert.err { background: #FEF3F2; color: var(--danger); border-color: #FECDCA; }

.fld { display: grid; gap: 6px; position: relative; }
.fld label { font-size: 13px; font-weight: 600; color: var(--muted); }
.fld input, .fld textarea { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 13px 14px; font-size: 16px; }
.fld textarea { resize: vertical; min-height: 64px; }
.fld input:focus, .fld textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.fld.bad input { border-color: var(--danger); }
.fld .err-msg { color: var(--danger); font-size: 13px; }
.np-head { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.np-logo { background: #DA291C; color: #fff; font-weight: 800; font-size: 11px; border-radius: 6px; padding: 4px 6px; }
.suggest { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin-top: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 24px rgba(0, 0, 0, .12); max-height: 260px; overflow-y: auto; }
.suggest button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button:focus { background: var(--brand-soft); }
.suggest small { color: var(--muted); display: block; font-size: 12.5px; }
.suggest .none { padding: 11px 14px; color: var(--muted); font-size: 14px; }

/* ---------- повноекранні екрани (оплата / статус) ---------- */
.screen { position: fixed; inset: 0; z-index: 60; background: var(--bg); overflow-y: auto; padding: calc(20px + env(safe-area-inset-top)) 0 calc(24px + env(safe-area-inset-bottom)); }
.screen .wrap { max-width: 480px; display: grid; gap: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: grid; gap: 14px; }
.panel h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.timer { font-size: 40px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--brand-ink); }
.timer-cap { color: var(--muted); font-size: 14px; margin-top: -10px; }
.paytypes { display: flex; gap: 6px; flex-wrap: wrap; }
.paytypes span { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 12.5px; font-weight: 600; background: var(--bg); }
.big-ico { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; }
.big-ico svg { width: 36px; height: 36px; stroke-width: 2.4; }
.big-ico.ok { background: #DCFCE7; color: var(--ok); }
.big-ico.no { background: #FEE4E2; color: var(--danger); }
.big-ico.wait { background: var(--brand-soft); color: var(--brand-ink); }
.center { text-align: center; }
.items-mini { display: grid; gap: 6px; font-size: 14px; }
.items-mini div { display: flex; justify-content: space-between; gap: 10px; }
.items-mini span:first-child { min-width: 0; }
.test-badge { background: #FEF0C7; color: #93370D; border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: rot .8s linear infinite; margin: 0 auto; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- товар детально ---------- */
.pd-photo { border-radius: 16px; overflow: hidden; aspect-ratio: 1 / 1; background: var(--brand-soft); position: relative; }
.pd-photo img { width: 100%; height: 100%; object-fit: cover; }
.pd-photo .noimg { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 80px; color: var(--brand); opacity: .5; }
.pd-desc { color: var(--muted); white-space: pre-line; margin: 0; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); top: calc(72px + env(safe-area-inset-top)); z-index: 80; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; }

.gate { max-width: 420px; margin: 40px auto; }

@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* стрічка тестового режиму (зникає, щойно ввімкнено LiqPay) */
.test-ribbon { background: #FFF4CC; color: #6B4E00; font-size: 12.5px; font-weight: 600; text-align: center; padding: 6px 16px; line-height: 1.35; }
.test-ribbon[hidden] { display: none; }

/* фото поверх літери-заглушки; літера видна, лише якщо фото не завантажилось */
.ph img, .pd-photo img { position: relative; z-index: 1; }
.code, .tag { z-index: 2; }
