/* Цвета приходят из config.yaml → theme и выставляются в JS как CSS-переменные */
:root {
  --accent: #F5A33B; --accent-2: #E07B28; --bg: #0E1621; --card: #17212B;
  --text: #EAF0F6; --muted: #8A97A8; --success: #4CC38A; --danger: #E5484D;
  --line: rgba(255,255,255,.08); --radius: 16px;
  --on-accent: #1a1208; --ink: #000; --photo-bg: #0b1119;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; }
body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea { font: inherit; color: var(--text); }
.wrap { padding: 12px; max-width: 720px; margin: 0 auto; }
.loader { width: 36px; height: 36px; margin: 40vh auto; border: 3px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* шапка */
.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.hero-top { display: flex; align-items: center; gap: 12px; }
.logo { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent);
  background: var(--bg); display: grid; place-items: center; font-size: 24px; flex: none; }
.brand { flex: 1; min-width: 0; }
.brand h1 { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.brand small { color: var(--accent); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; font-weight: 600; }
.pill { border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 12px; padding: 4px 10px;
  text-align: center; font-size: 12px; color: var(--muted); line-height: 1.25; }
.pill b { display: block; color: var(--accent); font-size: 14px; }
.banner { margin-top: 12px; border-radius: 12px; padding: 10px 12px; font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); }
.banner.closed { background: color-mix(in srgb, var(--danger) 20%, var(--card)); color: var(--text); border: 1px solid var(--danger); }

/* поиск и фильтры */
.search { margin-top: 12px; display: flex; align-items: center; gap: 8px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.search input { flex: 1; background: none; border: 0; outline: 0; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.toggle { border: 1px solid var(--line); border-radius: 12px; padding: 9px; font-weight: 600; color: var(--muted); }
.toggle.on { color: var(--success); border-color: var(--success); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-weight: 600; white-space: nowrap; }
.chip.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); border-color: transparent; }

/* карточки */
.grid { display: grid; gap: 12px; margin-top: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card.off { opacity: .55; }
.photo { position: relative; aspect-ratio: 16/10; background: var(--photo-bg); display: grid; place-items: center; font-size: 56px; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tag { position: absolute; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.tag.stock { top: 10px; right: 10px; background: var(--success); color: #062113; }
.tag.nostock { top: 10px; right: 10px; background: var(--danger); color: #fff; }
.tag.badge { left: 10px; bottom: 10px; background: rgba(0,0,0,.7); color: #fff; }
.body { padding: 12px 14px 14px; }
.body h3 { margin: 0 0 4px; font-size: 17px; }
.desc { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.variants { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.vchip { border: 1px solid color-mix(in srgb, var(--success) 50%, transparent); color: var(--success);
  border-radius: 10px; padding: 6px 10px; font-weight: 600; font-size: 13px; }
.vchip.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); border-color: transparent; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.price { color: var(--accent); font-weight: 800; font-size: 18px; }
.add { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); font-weight: 700;
  border-radius: 12px; padding: 10px 16px; }
.add:disabled { opacity: .4; }
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 12px; padding: 4px; }
.stepper button { width: 34px; height: 34px; border-radius: 10px; background: var(--card); font-size: 18px; font-weight: 700; }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; }
.compact .photo { display: none; }
.compact .desc { -webkit-line-clamp: 1; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* корзина */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.topbar h2 { margin: 0; font-size: 20px; }
.back { font-size: 22px; padding: 4px 8px; }
.cline { display: flex; gap: 10px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); }
.cline:last-child { border-bottom: 0; }
.cline .info { flex: 1; min-width: 0; }
.cline .info b { display: block; }
.cline .info small { color: var(--muted); display: block; }
.sum { padding: 12px 14px; }
.sum div { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); }
.sum .total { color: var(--text); font-weight: 800; font-size: 18px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.sum .disc { color: var(--success); }
.form { display: grid; gap: 10px; margin-top: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea { width: 100%; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; outline: 0; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .hint a { color: var(--accent); }
.field.bad input { border-color: var(--danger); }

/* шторка с добавками */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; animation: fade .15s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; z-index: 21;
  background: var(--bg); border-radius: 20px 20px 0 0; padding-bottom: calc(90px + env(safe-area-inset-bottom));
  animation: up .2s ease-out; max-width: 720px; margin: 0 auto; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet .photo { aspect-ratio: 16/9; }
.sheet .close { position: absolute; top: 10px; left: 10px; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; font-size: 18px; z-index: 2; }
.group { margin: 14px 14px 0; }
.group h4 { margin: 0 0 6px; display: flex; justify-content: space-between; align-items: baseline; }
.group h4 small { color: var(--muted); font-weight: 500; }
.group h4 .req { color: var(--accent); }
.opt { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; padding: 11px 12px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; }
.opt.on { border-color: var(--accent); }
.opt.dis { opacity: .45; }
.opt .mark { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--muted); flex: none; display: grid; place-items: center; font-size: 13px; }
.opt.radio .mark { border-radius: 50%; }
.opt.on .mark { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.opt span { flex: 1; }
.opt em { font-style: normal; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #000c; color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 50; max-width: 90vw; text-align: center; }
.dev-main { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); font-weight: 800;
  border-radius: 14px; padding: 15px; max-width: 696px; margin: 0 auto; }
.dev-main:disabled { opacity: .6; }

/* ======================================================================
   Пресет «brutal» — необрутализм: толстые обводки, жёсткие тени без размытия,
   яркие плашки-наклейки, нажатие «вдавливает» кнопку. Цвета — из theme.
   ====================================================================== */
.style-brutal { --line: var(--ink); --bw: 2px; --sh: 4px 4px 0 var(--ink); --sh-sm: 2px 2px 0 var(--ink); }
.style-brutal, .style-brutal button, .style-brutal input, .style-brutal textarea {
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.style-brutal .hero, .style-brutal .card, .style-brutal .search, .style-brutal .toggle, .style-brutal .chip,
.style-brutal .pill, .style-brutal .vchip, .style-brutal .opt, .style-brutal .field input, .style-brutal .field textarea,
.style-brutal .stepper, .style-brutal .banner { border: var(--bw) solid var(--ink); }
.style-brutal .hero { box-shadow: var(--sh); border-radius: 18px; }
.style-brutal .brand h1 { font-size: 24px; font-weight: 700; text-transform: uppercase; letter-spacing: -.02em; line-height: 1; }
.style-brutal .brand small { color: var(--text); background: var(--accent-2); border: var(--bw) solid var(--ink);
  border-radius: 6px; padding: 1px 6px; display: inline-block; margin-top: 6px; font-size: 11px; }
.style-brutal .logo { border: var(--bw) solid var(--ink); background: var(--accent); box-shadow: var(--sh-sm); }
.style-brutal .pill { background: var(--card); color: var(--text); box-shadow: var(--sh-sm); }
.style-brutal .pill b { color: var(--text); }
.style-brutal [data-act="cart"].pill { background: var(--accent-2); }
.style-brutal .banner { background: var(--accent); color: var(--on-accent); box-shadow: var(--sh-sm); transform: rotate(-1deg); }
.style-brutal .banner.closed { background: var(--ink); color: var(--bg); transform: none; }
.style-brutal .search { background: var(--card); box-shadow: var(--sh-sm); }
.style-brutal .toggle { background: var(--card); color: var(--text); box-shadow: var(--sh-sm); }
.style-brutal .toggle.on { background: var(--accent-2); color: var(--text); border-color: var(--ink); }
.style-brutal .chips { padding: 12px 4px 8px; }
.style-brutal .chip { background: var(--card); box-shadow: var(--sh-sm); }
.style-brutal .chip.on { background: var(--accent); color: var(--on-accent); }
.style-brutal .grid { gap: 18px; }
.style-brutal .card { box-shadow: 5px 5px 0 var(--ink); border-radius: 16px; }
.style-brutal .card.off { opacity: 1; filter: grayscale(1); }
.style-brutal .photo { border-bottom: var(--bw) solid var(--ink); }
.style-brutal .tag { border: var(--bw) solid var(--ink); border-radius: 8px; text-transform: uppercase; letter-spacing: .03em; }
.style-brutal .tag.stock { background: var(--accent-2); color: var(--ink); transform: rotate(3deg); }
.style-brutal .tag.nostock { background: var(--ink); color: var(--bg); transform: rotate(3deg); }
.style-brutal .tag.badge { background: var(--ink); color: var(--accent-2); }
.style-brutal .body h3 { font-size: 18px; font-weight: 700; line-height: 1.2; }
.style-brutal .desc { color: var(--muted); }
.style-brutal .vchip { color: var(--text); background: var(--card); border-radius: 8px; }
.style-brutal .vchip.on { background: var(--accent-2); color: var(--ink); }
.style-brutal .price { color: var(--text); font-size: 20px; font-weight: 700; }
.style-brutal .add, .style-brutal .dev-main { background: var(--accent); color: var(--on-accent); border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-sm); border-radius: 10px; transition: transform .06s, box-shadow .06s; }
.style-brutal .add:active, .style-brutal .dev-main:active, .style-brutal .stepper button:active,
.style-brutal .chip:active, .style-brutal .toggle:active, .style-brutal .opt:active {
  transform: translate(2px, 2px); box-shadow: none; }
.style-brutal .dev-main { box-shadow: var(--sh); font-size: 16px; text-transform: uppercase; }
.style-brutal .stepper { background: var(--card); border-radius: 10px; }
.style-brutal .stepper button { background: var(--accent-2); border: var(--bw) solid var(--ink); border-radius: 8px; }
.style-brutal .cline { border-bottom: var(--bw) solid var(--ink); }
.style-brutal .sum .total { border-top: var(--bw) dashed var(--ink); }
.style-brutal .sum .disc { color: var(--success); font-weight: 700; }
.style-brutal .topbar h2 { font-size: 26px; font-weight: 700; text-transform: uppercase; }
.style-brutal .field label { color: var(--text); font-weight: 700; }
.style-brutal .field input, .style-brutal .field textarea { background: var(--card); box-shadow: var(--sh-sm); }
.style-brutal .field input:focus, .style-brutal .field textarea:focus { border-color: var(--ink); background: #fffdf5; box-shadow: var(--sh); }
.style-brutal .field.bad input { border-color: #E5484D; box-shadow: 2px 2px 0 #E5484D; }
.style-brutal .field .hint a { color: var(--text); background: var(--accent-2); padding: 0 3px; }
.style-brutal .sheet { border: var(--bw) solid var(--ink); border-bottom: 0; }
.style-brutal .sheet .close { background: var(--card); color: var(--ink); border: var(--bw) solid var(--ink); }
.style-brutal .group h4 { font-weight: 700; }
.style-brutal .group h4 .req { background: var(--accent); color: var(--on-accent); border: var(--bw) solid var(--ink);
  border-radius: 6px; padding: 0 6px; font-size: 12px; }
.style-brutal .opt { box-shadow: var(--sh-sm); margin-bottom: 8px; }
.style-brutal .opt.on { background: var(--accent-2); border-color: var(--ink); }
.style-brutal .opt .mark { border-color: var(--ink); }
.style-brutal .opt.on .mark { background: var(--ink); color: var(--accent-2); border-color: var(--ink); }
.style-brutal .toast { background: var(--ink); color: var(--accent-2); border-radius: 10px; }
.style-brutal .loader { border-color: var(--ink); border-top-color: var(--accent); }
.style-brutal .hero-top { flex-wrap: wrap; }
.style-brutal .brand { flex: 1 1 calc(100% - 70px); }
.style-brutal .brand h1 { overflow-wrap: normal; word-break: normal; font-size: clamp(20px, 7vw, 28px); }
.style-brutal .hero-top .pill { flex: 1 1 0; padding: 6px 10px; }
