/* =====================================================
   CABIX SHOP — витрина покупателя. Монохром: только чёрное, белое и серое.

   Почему без цвета: витрина одна на тысячи магазинов, и любой фирменный цвет
   одному подходит, а другому мешает. Чёрно-белая система выглядит дорого у
   всех, а роль «цвета» играют вес шрифта, заливка и рамка.

   Две темы, светлая и тёмная, живут в переменных ниже; переключает их атрибут
   data-theme на <html> (ставит shop.js и маленький скрипт в index.php ДО первой
   отрисовки). Никаких !important и никаких цветов вне :root — если понадобится
   третья тема, добавляется один блок переменных.
   ===================================================== */

/* ---------- Тема ---------- */
:root {
  --bg:            #ffffff;
  --surface:       #f4f4f7;
  --surface-2:     #eaeaf0;
  --surface-3:     #e0e0e8;
  --border:        rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.16);
  --text:          #0e0e14;
  --dim:           #5e5e70;
  --faint:         #9292a4;
  --accent:        #e54d5e;
  --on-accent:     #ffffff;
  --grid-line:     rgba(0, 0, 0, 0.07);
  --grid-size:     32px;
  --overlay:       rgba(10, 10, 11, .48);
  --shadow-sm:     0 1px 2px rgba(10, 10, 11, .04);
  --shadow-md:     0 4px 16px rgba(10, 10, 11, .08);
  --shadow-lg:     0 -8px 32px rgba(10, 10, 11, .12);
  --skeleton:      linear-gradient(90deg, #F0F0F2 25%, #E6E6E9 37%, #F0F0F2 63%);
  --radius:        16px;
  --radius-s:      12px;
  --tabbar:        62px;
}

html[data-theme="dark"],
html[data-theme="slate"] {
  --bg:            #0b0e14;
  --surface:       #161b22;
  --surface-2:     #1c2230;
  --surface-3:     #22293a;
  --border:        rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text:          #e6e6ef;
  --dim:           #8b8b9e;
  --faint:         #5a5a6e;
  --accent:        #e54d5e;
  --on-accent:     #ffffff;
  --grid-line:     rgba(255, 255, 255, 0.07);
  --grid-size:     32px;
  --overlay:       rgba(0, 0, 0, .62);
  --shadow-sm:     none;
  --shadow-md:     none;
  --shadow-lg:     0 -8px 32px rgba(0, 0, 0, .6);
  --skeleton:      linear-gradient(90deg, #1c2230 25%, #22293a 37%, #1c2230 63%);
}

html[data-theme="emerald"] {
  --bg:            #061510;
  --surface:       #0f2820;
  --surface-2:     #14352b;
  --surface-3:     #1a4236;
  --border:        rgba(16, 185, 129, 0.14);
  --border-strong: rgba(16, 185, 129, 0.24);
  --text:          #e6f7f0;
  --dim:           #84bfa9;
  --faint:         #548f7a;
  --accent:        #10b981;
  --on-accent:     #ffffff;
  --grid-line:     rgba(16, 185, 129, 0.10);
  --grid-size:     32px;
  --overlay:       rgba(0, 0, 0, .62);
  --shadow-sm:     none;
  --shadow-md:     none;
  --shadow-lg:     0 -8px 32px rgba(0, 0, 0, .6);
  --skeleton:      linear-gradient(90deg, #14352b 25%, #1a4236 37%, #14352b 63%);
}

html[data-theme="amber"] {
  --bg:            #120e0a;
  --surface:       #221a13;
  --surface-2:     #2d2319;
  --surface-3:     #392d21;
  --border:        rgba(245, 158, 11, 0.14);
  --border-strong: rgba(245, 158, 11, 0.24);
  --text:          #faeedb;
  --dim:           #c5a882;
  --faint:         #927552;
  --accent:        #f59e0b;
  --on-accent:     #120e0a;
  --grid-line:     rgba(245, 158, 11, 0.10);
  --grid-size:     32px;
  --overlay:       rgba(0, 0, 0, .62);
  --shadow-sm:     none;
  --shadow-md:     none;
  --shadow-lg:     0 -8px 32px rgba(0, 0, 0, .6);
  --skeleton:      linear-gradient(90deg, #2d2319 25%, #392d21 37%, #2d2319 63%);
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior-y: none;
  transition: background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
input, textarea { -webkit-user-select: text; user-select: text; }
img { display: block; -webkit-user-drag: none; user-drag: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
a { color: inherit; }
/* 16px — минимум, при котором Safari не увеличивает страницу при фокусе. */
input, textarea, select { font: inherit; font-size: 16px; color: var(--text); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.dim { color: var(--dim); }

/* ---------- Заставка до загрузки каталога ---------- */
.boot { padding: 30vh 24px; text-align: center; color: var(--faint); font-size: 14px; }

/* ---------- Шапка ---------- */
.hdr {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.hdr-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
/* Кружок с первой буквой названия — вместо логотипа, которого у магазина нет. */
.hdr-logo {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px;
  background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800; letter-spacing: -.5px;
}
.hdr-txt { flex: 1; min-width: 0; }
.hdr-txt h1 {
  margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hdr-txt small {
  display: block; color: var(--faint); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ibtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 38px;
  height: 38px;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.1s cubic-bezier(0.16, 1, 0.3, 1), color 0.18s;
}
.ibtn:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--accent);
  transform: translateY(-1px);
}
.ibtn:active {
  transform: scale(0.95);
}
.ibtn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon--slate, .theme-icon--dark { display: block; }
.theme-icon--light, .theme-icon--emerald, .theme-icon--amber { display: none; }

html[data-theme="light"] .theme-icon--slate,
html[data-theme="light"] .theme-icon--dark,
html[data-theme="light"] .theme-icon--emerald,
html[data-theme="light"] .theme-icon--amber { display: none; }
html[data-theme="light"] .theme-icon--light { display: block; }

html[data-theme="emerald"] .theme-icon--slate,
html[data-theme="emerald"] .theme-icon--dark,
html[data-theme="emerald"] .theme-icon--light,
html[data-theme="emerald"] .theme-icon--amber { display: none; }
html[data-theme="emerald"] .theme-icon--emerald { display: block; }

html[data-theme="amber"] .theme-icon--slate,
html[data-theme="amber"] .theme-icon--dark,
html[data-theme="amber"] .theme-icon--light,
html[data-theme="amber"] .theme-icon--emerald { display: none; }
html[data-theme="amber"] .theme-icon--amber { display: block; }

.theme-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  flex: 0 0 10px;
}

/* OmniRoute Language Dropdown */
.lang {
  position: relative;
  display: inline-flex;
}
.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 190px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 150;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.lang-dropdown.open {
  display: flex;
  animation: omni-pop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.lang-option {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}
.lang-option:hover {
  background: var(--surface-2);
  color: var(--text);
}
.lang-option.active {
  background: var(--surface-3);
  color: var(--accent);
  font-weight: 700;
}
@keyframes omni-pop {
  from { opacity: 0; transform: scale(0.95) translateY(-6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- Экран ---------- */
/* Нижний отступ = таббар + safe-area: последний товар не должен прятаться. */
#screen { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 12px); min-height: 60vh; }
.scr-head { padding: 18px 0 6px; }
.scr-head h2 { margin: 0; font-size: 25px; font-weight: 800; letter-spacing: -.7px; }
.scr-head p { margin: 3px 0 0; color: var(--dim); font-size: 13.5px; }

/* ---------- Поиск ---------- */
.search { position: relative; padding: 12px 0 2px; }
.search input {
  width: 100%; padding: 12px 40px 12px 42px;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface-2); outline: none; color: var(--text);
}
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--text); background: var(--surface); }
.search .s-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-38%); color: var(--faint); pointer-events: none; }
.search .s-clr {
  position: absolute; right: 8px; top: 50%; transform: translateY(-38%);
  width: 28px; height: 28px; border-radius: 9px; color: var(--dim); font-size: 13px;
  display: none; align-items: center; justify-content: center;
}
.search.has-text .s-clr { display: flex; }

/* ---------- Чипсы категорий ---------- */
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; color: var(--dim); white-space: nowrap;
}
.chip:active { transform: scale(.96); }
.chip.on { background: var(--accent); color: var(--on-accent); }
.chip .n { opacity: .55; margin-left: 5px; font-weight: 600; }

/* ---------- Сетка товаров ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; padding: 12px 0 8px; }
@media (max-width: 380px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

.pcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; text-align: left; box-shadow: var(--shadow-sm);
  height: 100%;
}
.pimg {
  position: relative; aspect-ratio: 1 / 1; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer;
}
.pimg img { width: 100%; height: 100%; object-fit: cover; }
.pimg .ph, .cimg .ph { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; color: var(--text); opacity: .22; }
.pimg .ph svg, .cimg .ph svg, .pm-img .ph svg { width: 100%; height: 100%; }
.pm-img .ph { display: flex; align-items: center; justify-content: center; color: var(--text); opacity: .2; }
.cimg .ph { width: 26px; height: 26px; }
.pimg:active img { transform: scale(.98); transition: transform .12s; }
/* Нет в наличии — фото обесцвечено и притушено: видно, не читая подпись. */
.pcard.out .pimg img { filter: grayscale(1); opacity: .38; }
.badge-out {
  position: absolute; left: 8px; top: 8px; padding: 4px 8px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border-strong);
  font-size: 10.5px; font-weight: 800; letter-spacing: .2px; text-transform: uppercase; color: var(--text);
}
.badge-rate {
  position: absolute; right: 8px; top: 8px; padding: 4px 8px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800;
  display: flex; align-items: center; gap: 3px;
}

.pbody { padding: 10px 11px 11px; display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.pname {
  font-size: 13.5px; font-weight: 600; line-height: 1.32; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px;
}
.pprice-box { min-height: 44px; display: flex; flex-direction: column; justify-content: flex-start; }
.pprice { font-size: 16px; font-weight: 800; letter-spacing: -.3px; margin-top: 1px; }
.punit { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* Кнопка «в корзину» и счётчик — всегда прижаты к низу карточки для ровного выравнивания. */
.padd {
  margin-top: auto !important; height: 38px; border-radius: 11px;
  background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: 13.5px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%;
}
.padd:active { transform: scale(.97); }
.padd.muted { background: var(--surface-2); color: var(--faint); }
.qtyrow {
  margin-top: auto !important; height: 38px; border-radius: 11px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
}
.qtyrow button { width: 40px; height: 100%; font-size: 19px; font-weight: 600; color: var(--text); }
.qtyrow button:active { background: var(--surface-3); }
.qtyrow b { font-size: 13.5px; font-weight: 700; }

/* ---------- Скелетоны загрузки ---------- */
.sk { border-radius: var(--radius); background: var(--skeleton); background-size: 400% 100%; animation: sk 1.2s ease-in-out infinite; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.sk-card .sk-img { aspect-ratio: 1 / 1; border-radius: 0; }
.sk-card .sk-line { height: 11px; margin: 10px 11px 0; border-radius: 6px; }
.sk-card .sk-line.s { width: 55%; margin-bottom: 14px; }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ---------- Пустые состояния ---------- */
.empty { padding: 56px 20px; text-align: center; }
/* Селектор БЕЗ .empty намеренно: тот же значок ставит окно «Заказ принят»,
   и, будучи привязанным к .empty, он оставался без размера и растягивался
   во всю ширину шторки. */
.e-ico { display: block; width: 46px; height: 46px; margin: 0 auto 12px; color: var(--text); opacity: .28; }
.e-ico svg { width: 100%; height: 100%; stroke-width: 1.4; }
.e-ico.solid { width: 56px; height: 56px; opacity: 1; }
.empty h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; }
.empty p { margin: 0 auto; max-width: 300px; color: var(--dim); font-size: 13.5px; }
.empty .btn { margin-top: 16px; max-width: 260px; margin-left: auto; margin-right: auto; }

/* ---------- Нижнее меню ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--bg); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: max(0px, calc((100% - 520px) / 2));
  padding-right: max(0px, calc((100% - 520px) / 2));
  display: flex;
  /* Поверх меню всегда должен быть виден фон, даже если страница прокручена. */
  backdrop-filter: saturate(180%) blur(12px);
}
.tab {
  flex: 1; height: var(--tabbar); position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 10.5px; font-weight: 600; letter-spacing: -.1px;
}
.tab svg { width: 23px; height: 23px; }
.tab.on { color: var(--text); }
.tab.on svg { stroke-width: 2.3; }
.tab:active { opacity: .6; }
.tab .cnt {
  position: absolute; top: 8px; left: 50%; margin-left: 4px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent);
  font-size: 10.5px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}

/* ---------- Кнопки ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 13px 18px; border-radius: 14px;
  background: var(--surface-2); color: var(--text);
  font-weight: 700; font-size: 15px; text-align: center;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-outline { background: transparent; border: 1.5px solid var(--border-strong); }
.btn-ghost { background: transparent; color: var(--dim); }
.btn-sm { min-height: 40px; padding: 9px 14px; font-size: 13.5px; border-radius: 11px; width: auto; }
.btn-danger { background: transparent; border: 1.5px solid var(--border-strong); color: var(--text); }
.linkbtn { color: var(--text); font-weight: 700; font-size: 13.5px; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Карточки-списки ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.card > h3 { margin: 0 0 10px; font-size: 15.5px; font-weight: 800; letter-spacing: -.2px; }
.rows { border: 1px solid var(--border); border-radius: var(--radius-s); overflow: hidden; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.row:last-child { border-bottom: none; }
.row > span:first-child { color: var(--dim); }
.row b { font-weight: 700; text-align: right; }
/* Строка-кнопка (язык, тема, установка) — стрелка справа. */
.row-btn { width: 100%; text-align: left; }
.row-btn:active { background: var(--surface-2); }
.row-btn .chev { color: var(--faint); font-size: 15px; }

/* ---------- Корзина ---------- */
.cline { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cline:last-of-type { border-bottom: none; }
.cimg { width: 58px; height: 58px; border-radius: 12px; background: var(--surface-2); overflow: hidden; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.cimg img { width: 100%; height: 100%; object-fit: cover; }
.cinfo { flex: 1; min-width: 0; }
.cinfo b { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.cinfo small { color: var(--faint); font-size: 12px; }
.cinfo .qtyrow { max-width: 132px; height: 34px; margin-top: 7px; }
.cinfo .qtyrow button { width: 36px; }
.csum { text-align: right; font-weight: 800; font-size: 14px; white-space: nowrap; align-self: flex-start; padding-top: 2px; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0 2px; font-size: 15px; }
.total-row b { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.total-row.sub { font-size: 13.5px; color: var(--dim); padding: 5px 0; }
.total-row.sub b { font-size: 13.5px; font-weight: 700; }

/* Итог корзины прилипает над меню — сумма видна всегда. */
.cart-foot {
  position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--border);
  margin: 14px -16px 0; padding: 12px 16px 14px;
}

/* ---------- Модалки (шторки снизу) ---------- */
body.modal-open { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
.overlay {
  position: fixed; inset: 0; z-index: 50; background: var(--overlay);
  display: flex; align-items: flex-end; justify-content: center;
  overscroll-behavior: contain; animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0; } }
@media (min-width: 640px) { .overlay { align-items: center; } }
.modal {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 92dvh;
  border-radius: 22px 22px 0 0; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-lg); animation: rise .24s cubic-bezier(.22, 1, .36, 1);
}
@keyframes rise { from { transform: translateY(24px); } }
@media (min-width: 640px) { .modal { border-radius: 22px; } @keyframes rise { from { transform: scale(.97); } } }
@media (prefers-reduced-motion: reduce) { .overlay, .modal { animation: none; } }
/* Полоска-«ручка» вверху: понятно, что шторку можно закрыть. */
.mhead { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.mhead::before { content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); }
@media (min-width: 640px) { .mhead::before { display: none; } }
.mhead b { font-size: 16.5px; font-weight: 800; letter-spacing: -.3px; }
.mclose { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 10px; background: var(--surface-2); color: var(--dim); font-size: 14px; display: flex; align-items: center; justify-content: center; }
.mclose:active { background: var(--surface-3); }
.mbody { padding: 16px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.mfoot { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); display: flex; gap: 10px; }
.mfoot .btn { flex: 1; }

/* ---------- Формы ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--dim); font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--surface-2); outline: none; color: var(--text);
}
.field input:focus, .field textarea:focus { border-color: var(--text); background: var(--surface); }
.field textarea { resize: vertical; min-height: 62px; }
.seg { display: flex; background: var(--surface-2); border-radius: 13px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 10px 4px; border-radius: 10px; font-weight: 700; font-size: 13.5px; color: var(--dim); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
html[data-theme="dark"] .seg button.on { background: var(--surface-3); }
.hint { font-size: 12.5px; line-height: 1.5; color: var(--dim); background: var(--surface-2); border-radius: var(--radius-s); padding: 11px 13px; margin: 0 0 14px; }
.hint b { color: var(--text); }
/* Ошибка без красного: рамка слева + жирный текст читаются в монохроме. */
.err { font-size: 13px; font-weight: 600; color: var(--text); border-left: 3px solid var(--text); padding: 8px 0 8px 11px; margin: 0 0 12px; background: var(--surface-2); border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.code-in { letter-spacing: 8px; font-size: 21px; text-align: center; font-weight: 700; }

/* ---------- Карточка товара ---------- */
.pm-img { aspect-ratio: 1 / 1; max-height: 360px; border-radius: var(--radius); background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 10px; }
.pm-img img { width: 100%; height: 100%; object-fit: contain; }
.pthumbs { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.pthumbs::-webkit-scrollbar { display: none; }
.pthumb { flex: 0 0 auto; width: 56px; height: 56px; border-radius: var(--radius-s); overflow: hidden; border: 2px solid transparent; background: var(--surface-2); }
.pthumb img { width: 100%; height: 100%; object-fit: cover; }
.pthumb.on { border-color: var(--text); }
.pm-name { margin: 2px 0 6px; font-size: 20px; font-weight: 800; line-height: 1.25; letter-spacing: -.5px; }
.pm-price { font-size: 24px; font-weight: 800; letter-spacing: -.7px; margin-bottom: 14px; }
.pm-price small { font-size: 13px; color: var(--faint); font-weight: 600; letter-spacing: 0; }

/* ---------- Отзывы ---------- */
.rev-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 18px 0 10px; }
.rev-head b { font-size: 15.5px; font-weight: 800; }
.rev-avg { font-size: 13.5px; font-weight: 700; white-space: nowrap; }
.rev-avg .stars { letter-spacing: -1px; }
.star-off { color: var(--border-strong); }
.rev-form { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 13px; margin-bottom: 14px; background: var(--surface-2); }
.rev-stars { display: flex; gap: 3px; margin-bottom: 9px; }
.rev-star { font-size: 27px; line-height: 1; color: var(--border-strong); padding: 0 2px; }
.rev-star.on { color: var(--text); }
.rev-form textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 11px; outline: none; background: var(--surface); color: var(--text); resize: vertical; }
.rev-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.rev-item:last-child { border-bottom: none; }
.rev-item.mine { background: var(--surface-2); border-radius: var(--radius-s); padding: 12px; border-bottom: none; margin-bottom: 8px; }
.rev-top { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.rev-top b { font-weight: 700; }
.rev-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .2px; text-transform: uppercase; border: 1px solid var(--border-strong); border-radius: 7px; padding: 2px 6px; color: var(--dim); }
.rev-stars-s { margin-left: auto; font-size: 13px; letter-spacing: -1px; }
.rev-text { font-size: 13.5px; margin-top: 5px; white-space: pre-wrap; line-height: 1.5; }
.rev-date { color: var(--faint); font-size: 11.5px; margin-top: 5px; }
.rev-reply { margin-top: 9px; padding: 9px 12px; border-left: 3px solid var(--text); background: var(--surface-2); border-radius: 0 var(--radius-s) var(--radius-s) 0; font-size: 13px; line-height: 1.5; }
.rev-reply b { font-weight: 800; }

/* ---------- Заказы ---------- */
.order { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 15px; margin-bottom: 12px; background: var(--surface); }
.order .top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.order .num { font-weight: 800; font-size: 14.5px; letter-spacing: .3px; }
.order .dt { color: var(--faint); font-size: 12px; margin-top: 3px; }
.order .items { margin: 10px 0 4px; font-size: 13px; color: var(--dim); }
.order .items div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.order .sum { display: flex; justify-content: space-between; font-weight: 800; font-size: 15px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px; }
/* Статус — заливкой и рамкой, а не цветом: смысл читается в монохроме. */
.status { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .2px; white-space: nowrap; }
.st-new { border: 1.5px dashed var(--border-strong); color: var(--text); }
.st-confirmed { border: 1.5px solid var(--text); color: var(--text); }
.st-done { background: var(--accent); color: var(--on-accent); }
.st-cancelled { background: var(--surface-2); color: var(--faint); text-decoration: line-through; }

/* ---------- Тосты ---------- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 12px); z-index: 99; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--accent); color: var(--on-accent); padding: 11px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600; max-width: 92%; text-align: center; box-shadow: var(--shadow-md); animation: rise .2s ease-out; }
html[data-theme="dark"] .toast { border: 1px solid var(--border-strong); }

/* ---------- Профиль ---------- */
.prof-head { display: flex; align-items: center; gap: 13px; padding: 6px 0 16px; }
.prof-ava { width: 54px; height: 54px; border-radius: 18px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 800; flex: 0 0 auto; }
.prof-ava svg { width: 26px; height: 26px; }
.prof-txt { min-width: 0; }
.prof-txt b { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.prof-txt small { color: var(--dim); font-size: 13px; }

/* Карта магазина */
.map-frame { width: 100%; height: 190px; border: 0; border-radius: var(--radius-s); margin-top: 10px; display: block; filter: grayscale(1) contrast(1.05); }
html[data-theme="dark"] .map-frame { filter: grayscale(1) invert(1) contrast(.92); }

.foot { padding: 22px 16px 8px; text-align: center; color: var(--faint); font-size: 11.5px; }

/* ---------- Варианты / Фасады (Clean Taste & High Contrast) ---------- */
.pm-variants-wrap {
  margin: 16px 0 14px;
}
.pm-variants-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 9px;
}
.pm-variants-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.pm-var-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .16s cubic-bezier(.16, 1, .3, 1);
  user-select: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.pm-var-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.pm-var-btn:active {
  transform: scale(0.98);
}
.pm-var-btn .v-radio {
  font-size: 14px;
  color: var(--dim);
  line-height: 1;
}
.pm-var-btn .v-name {
  font-weight: 600;
}
.pm-var-btn .v-sep {
  opacity: 0.35;
}
.pm-var-btn .v-price {
  font-weight: 800;
  color: var(--text);
}
.pm-var-btn.active {
  background: #2563EB !important;
  border-color: #2563EB !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4) !important;
  transform: translateY(-1px);
}
.pm-var-btn.active .v-radio,
.pm-var-btn.active .v-name,
.pm-var-btn.active .v-price {
  color: #FFFFFF !important;
}
.pm-var-btn.active .v-sep {
  color: #FFFFFF !important;
  opacity: 0.6;
}

/* Dark mode fine-tuning */
html[data-theme="dark"] .pm-var-btn {
  background: #1C1C1F;
  border-color: #2A2A2E;
  color: #F7F7F8;
}
html[data-theme="dark"] .pm-var-btn .v-price {
  color: #F7F7F8;
}
html[data-theme="dark"] .pm-var-btn:hover {
  background: #26262A;
  border-color: #3E3E44;
}
html[data-theme="dark"] .pm-var-btn.active {
  background: #2563EB !important;
  border-color: #2563EB !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.5) !important;
}

/* ---------- Omniroute-Inspired Modal Tabs & Content Cards ---------- */
.pm-desc-card {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: var(--radius-s);
  margin-bottom: 14px;
}
html[data-theme="dark"] .pm-desc-card {
  background: #18181B;
  border-color: #27272A;
  color: #E4E4E7;
}

.pm-specs-card {
  margin-bottom: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 8px 14px;
}
html[data-theme="dark"] .pm-specs-card {
  background: #18181B;
  border-color: #27272A;
}
.pm-specs-card .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
html[data-theme="dark"] .pm-specs-card .row {
  border-bottom-color: #27272A;
}
.pm-specs-card .row:last-child {
  border-bottom: none;
}
.pm-specs-card .row span {
  color: var(--dim);
}
.pm-specs-card .row b {
  color: var(--text);
  font-weight: 600;
}

.pm-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin: 16px 0 14px 0;
  padding-bottom: 4px;
}
html[data-theme="dark"] .pm-tabs-nav {
  border-bottom-color: #27272A;
}

.pm-tab-btn {
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--dim);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pm-tab-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}
.pm-tab-btn.on {
  color: #2563EB;
  background: rgba(37, 99, 235, 0.08);
  font-weight: 700;
  border-bottom: 2px solid #2563EB;
}
html[data-theme="dark"] .pm-tab-btn.on {
  color: #60A5FA;
  background: rgba(37, 99, 235, 0.16);
  border-bottom-color: #60A5FA;
}

.pm-saving-card {
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.25);
  border-radius: var(--radius-s);
  padding: 10px 14px;
  margin: 10px 0 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #16A34A;
  font-weight: 700;
  font-size: 13.5px;
}
html[data-theme="dark"] .pm-saving-card {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
  color: #4ADE80;
}

