/* ============================================================
   Cyber Obsidian & Bento — оформление loolm.com
   Чистый CSS3: переменные, грид, без фреймворков.

   Тема переключается атрибутом на <html>: data-theme="dark" (по
   умолчанию) или "light". Светлая — не инверсия тёмной, а своя
   раскладка: на белом неоновое свечение выглядит грязью, поэтому
   там оно заменено на тени и плотные границы.
   ============================================================ */

:root {
  /* поверхности */
  --bg-page:            #09090B;
  --bg-surface:         #121215;
  --bg-surface-elevated:#18181D;
  --bg-sunken:          #0D0D10;

  /* границы */
  --border-subtle:      rgba(255, 255, 255, .08);
  --border-strong:      rgba(255, 255, 255, .14);
  --border-active:      rgba(16, 185, 129, .45);

  /* акценты */
  --primary:            #10B981;
  --primary-ink:        #042F2E;
  --primary-glow:       rgba(16, 185, 129, .25);
  --primary-soft:       rgba(16, 185, 129, .12);
  --accent:             #3B82F6;
  --accent-soft:        rgba(59, 130, 246, .14);
  --warn:               #F59E0B;
  --warn-soft:          rgba(245, 158, 11, .14);
  --danger:             #EF4444;
  --danger-soft:        rgba(239, 68, 68, .14);

  /* текст */
  --text-primary:       #F8FAFC;
  --text-secondary:     #94A3B8;
  --text-muted:         #64748B;

  /* шрифты */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* сетка и ритм */
  --gap:      16px;
  --radius:   16px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --pad-card: 24px;
  --wrap:     1280px;
  --shell:    clamp(16px, 4vw, 40px);

  /* движение */
  --fast:   140ms;
  --base:   240ms;
  --slow:   420ms;
  --ease:   cubic-bezier(.22, .78, .26, 1);

  /* тени */
  --shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 18px 40px -28px rgba(0,0,0,.9);
  --shadow-pop:  0 2px 8px rgba(0,0,0,.45), 0 32px 64px -32px rgba(0,0,0,.95);
  --glass:       rgba(9, 9, 11, .78);
}

html[data-theme="light"] {
  --bg-page:            #F6F7F9;
  --bg-surface:         #FFFFFF;
  --bg-surface-elevated:#F2F4F7;
  --bg-sunken:          #ECEFF3;
  --border-subtle:      rgba(9, 9, 11, .09);
  --border-strong:      rgba(9, 9, 11, .16);
  --border-active:      rgba(5, 150, 105, .5);
  --primary:            #059669;
  --primary-ink:        #FFFFFF;
  --primary-glow:       rgba(5, 150, 105, .18);
  --primary-soft:       rgba(5, 150, 105, .1);
  --accent:             #2563EB;
  --accent-soft:        rgba(37, 99, 235, .1);
  --text-primary:       #0B0D12;
  --text-secondary:     #51586A;
  --text-muted:         #78808F;
  --shadow-card: 0 1px 2px rgba(9,13,24,.05), 0 14px 32px -24px rgba(9,13,24,.4);
  --shadow-pop:  0 2px 6px rgba(9,13,24,.07), 0 28px 56px -28px rgba(9,13,24,.45);
  --glass:       rgba(246, 247, 249, .82);
}

/* ——— основа ——— */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font: 15px/1.6 var(--font-sans);
  font-feature-settings: "kern" 1, "liga" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--base) var(--ease), color var(--base) var(--ease);
}

img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-head, inherit);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -.03em;
}
h1 { font-size: clamp(32px, 5.4vw, 60px); }
h2 { font-size: clamp(24px, 3.4vw, 38px); }
h3 { font-size: clamp(17px, 1.9vw, 21px); letter-spacing: -.02em; }
p  { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

code, .mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
code {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: .88em;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: var(--primary-soft); color: var(--text-primary); }

.sr {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ——— раскладка ——— */

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--shell); }
.row  { display: flex; align-items: center; gap: 12px; }
.row.wrap-row { flex-wrap: wrap; }
.col  { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.right { margin-left: auto; }
.center { text-align: center; }
.muted { color: var(--text-secondary); }
.dim   { color: var(--text-muted); }

.micro {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 650;
}

.lead {
  font-size: clamp(15px, 1.5vw, 18px);
  color: var(--text-secondary);
  max-width: 62ch;
  line-height: 1.65;
}

.sec { padding-block: clamp(40px, 6vw, 84px); }
.sec.tight { padding-block: clamp(24px, 3.5vw, 48px); }

.shead {
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: flex-end; justify-content: space-between;
  margin-bottom: clamp(18px, 2.6vw, 30px);
}

/* Градиентное выделение в заголовках */
.grad {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ============================================================
   BENTO GRID
   ============================================================ */

.bento {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(130px, auto);
}
.bento.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bento.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.tall-2 { grid-row: span 2; }
.tall-3 { grid-row: span 3; }

/* ============================================================
   SPOTLIGHT-КАРТОЧКА
   Два слоя: мягкое пятно внутри (::before) и световая кромка по
   границе (::after с маской). Оба двигаются за --mouse-x/y,
   которые ставит ui-effects.js через requestAnimationFrame.
   ============================================================ */

.bento-card {
  position: relative;
  isolation: isolate;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: var(--pad-card);
  min-width: 0;
  transition: transform var(--base) var(--ease),
              border-color var(--base) var(--ease),
              box-shadow var(--base) var(--ease);
}

.bento-card::before,
.bento-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--base) var(--ease);
  pointer-events: none;
}

/* Пятно света внутри карточки.

   Раньше здесь стоял z-index:-1 — псевдоэлемент уходил за фон карточки. Пока
   карточка была обычной, это работало. Но стоит добавить ей transform (наклон,
   подъём при наведении), как браузер заводит новый слой, и элемент с
   отрицательным z-index проваливается ЗА фон целиком: вместо подсветки
   появляется тёмный прямоугольник в размер карточки.

   Поэтому подсветка лежит в обычном потоке под содержимым, а содержимое
   поднято над ней. */
.bento-card::before {
  z-index: 0;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    var(--primary-soft),
    transparent 40%
  );
}

/* световая кромка: градиент, обрезанный маской до рамки в 1px */
.bento-card::after {
  padding: 1px;
  background: radial-gradient(
    380px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(16, 185, 129, .55),
    rgba(59, 130, 246, .22) 40%,
    transparent 65%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.bento-card:hover::before,
.bento-card:is(:focus-within)::before { opacity: 1; }
.bento-card:hover::after,
.bento-card:is(:focus-within)::after  { opacity: 1; }

/* Содержимое над подсветкой. Иначе текст и кнопки окажутся под пятном. */
.bento-card > * { position: relative; z-index: 1; }

.bento-card.lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.bento-card.flat { padding: 0; overflow: hidden; }
.bento-card.sunken { background: var(--bg-sunken); }
.bento-card.pad-sm { padding: 16px 18px; }

/* Карточка целиком кликабельна: ссылка растягивается поверх */
.bento-card .stretch::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

/* ============================================================
   СТЕКЛЯННАЯ ШАПКА
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid transparent;
  transition: border-color var(--base) var(--ease), background var(--base) var(--ease);
}
.topbar.stuck { border-bottom-color: var(--border-subtle); }
.topbar .wrap { display: flex; align-items: center; gap: clamp(10px, 2vw, 24px); min-height: 68px; }

.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand:hover { text-decoration: none; }

/* Навигация в «пилюле», как на макете */
.navpill {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}
.navpill a {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color var(--fast), background var(--fast);
}
.navpill a:hover { color: var(--text-primary); background: var(--bg-surface-elevated); text-decoration: none; }
.navpill a[aria-current] {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

.burger {
  display: none;
  margin-left: auto;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: inherit;
  cursor: pointer;
}

/* ============================================================
   КНОПКИ
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--fast) var(--ease),
              background var(--fast), border-color var(--fast), box-shadow var(--fast);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--border-active); }
.btn:active { transform: none; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 0 20px var(--primary-glow);
}
.btn-primary:hover {
  background: color-mix(in oklab, var(--primary) 88%, #fff);
  border-color: color-mix(in oklab, var(--primary) 88%, #fff);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 0 28px var(--primary-glow);
}

.btn-ghost { background: transparent; border-color: var(--border-subtle); color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-surface-elevated); }

.btn-quiet { background: none; border-color: transparent; color: var(--primary); padding-inline: 10px; }
.btn-quiet:hover { background: var(--primary-soft); transform: none; }

.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 14px 26px; font-size: 15.5px; }
.btn-wide { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

/* ============================================================
   БЕЙДЖИ, ЧИПЫ, СОСТОЯНИЯ
   ============================================================ */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}
.chip-primary { background: var(--primary-soft); border-color: var(--border-active); color: var(--primary); }
.chip-accent  { background: var(--accent-soft);  border-color: rgba(59,130,246,.4); color: var(--accent); }
.chip-warn    { background: var(--warn-soft);    border-color: rgba(245,158,11,.4); color: var(--warn); }
.chip-danger  { background: var(--danger-soft);  border-color: rgba(239,68,68,.4);  color: var(--danger); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.state { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
         border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 650; }
.state.ok, .state.paid, .state.done, .state.bound, .state.active {
  background: var(--primary-soft); color: var(--primary); }
.state.new, .state.pending, .state.issued, .state.running, .state.answered {
  background: var(--warn-soft); color: var(--warn); }
.state.cancel, .state.refund, .state.refunded, .state.blocked, .state.fail {
  background: var(--danger-soft); color: var(--danger); }
.state.draft, .state.closed, .state.retired {
  background: var(--bg-surface-elevated); color: var(--text-muted); }

/* Индикатор PageSpeed */
.gauge-wrap { display: inline-flex; align-items: center; gap: 10px; }
.gauge { color: var(--text-secondary); flex: 0 0 auto; }
.gauge .gauge-arc { transition: stroke-dashoffset 1.1s var(--ease); }
.gauge-label { font-size: 12.5px; color: var(--text-secondary); line-height: 1.3; }
.gauge-label b { display: block; color: var(--text-primary); font-size: 13px; }

.scorebar { display: flex; flex-wrap: wrap; gap: 8px; }
.scorebar .s {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 4px 9px; border-radius: 8px;
  background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle);
  font-size: 11px; color: var(--text-muted);
}
.scorebar .s b { font-family: var(--font-mono); font-size: 12.5px; color: var(--primary); }
.scorebar .s.mid b { color: var(--warn); }
.scorebar .s.low b { color: var(--danger); }

/* ============================================================
   ФОРМЫ
   ============================================================ */

label.f { display: block; }
label.f > span {
  display: block; margin-bottom: 6px;
  font-size: 12.5px; font-weight: 550; color: var(--text-secondary);
}

.inp, select.inp, textarea.inp {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 11px 14px;
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
.inp::placeholder { color: var(--text-muted); }
.inp:focus {
  outline: none;
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea.inp { resize: vertical; min-height: 92px; line-height: 1.6; }
select.inp {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.chk { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; line-height: 1.5; }
.chk input { margin-top: 3px; flex: 0 0 auto; width: 17px; height: 17px; accent-color: var(--primary); }

.search {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1 1 auto; min-width: 0; border: 0; background: none; color: inherit; font: inherit; font-size: 15px; }
.search input:focus { outline: none; }
.search svg { color: var(--text-muted); flex: 0 0 auto; }

/* Фильтры каталога */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters .f-btn {
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: all var(--fast);
}
.filters .f-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.filters .f-btn[aria-pressed="true"] {
  background: var(--primary-soft);
  border-color: var(--border-active);
  color: var(--primary);
  font-weight: 650;
}

/* ============================================================
   ТАБЛИЦЫ (админка)
   ============================================================ */

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left;
  padding: 11px 14px;
  font-size: 10.5px; font-weight: 650;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.tbl tbody tr { transition: background var(--fast); }
.tbl tbody tr:hover { background: var(--bg-surface-elevated); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Переключатель-тумблер в таблицах */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex: 0 0 auto; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle .track {
  position: absolute; inset: 0;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  transition: background var(--fast), border-color var(--fast);
  pointer-events: none;
}
.toggle .track::after {
  content: ""; position: absolute;
  top: 3px; left: 3px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--text-muted);
  transition: transform var(--base) var(--ease), background var(--fast);
}
.toggle input:checked + .track { background: var(--primary-soft); border-color: var(--border-active); }
.toggle input:checked + .track::after { transform: translateX(18px); background: var(--primary); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 3px var(--primary-soft); }

/* ============================================================
   КАРТОЧКА ШАБЛОНА В КАТАЛОГЕ
   ============================================================ */

.tpl-card { display: flex; flex-direction: column; gap: 0; overflow: hidden; padding: 0; }
.tpl-shot {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-sunken);
  overflow: hidden;
}
.tpl-shot img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--slow) var(--ease); }
.bento-card:hover .tpl-shot img { transform: scale(1.04); }
.tpl-shot .stub {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--text-muted); font-size: 12.5px;
}
.tpl-shot .over {
  position: absolute; inset: auto 12px 12px;
  display: flex; gap: 8px; align-items: center; justify-content: space-between;
  pointer-events: none;
}
.tpl-shot .over > * { pointer-events: auto; }
.tpl-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1 1 auto; }
.tpl-body .foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding-top: 4px; }

.price { font-family: var(--font-mono); font-size: clamp(18px, 2vw, 22px); font-weight: 700; letter-spacing: -.02em; }
.price s { color: var(--text-muted); font-size: 13px; font-weight: 400; margin-left: 8px; }
.price.free { color: var(--primary); }

/* ============================================================
   BEFORE / AFTER
   ============================================================ */

.ba { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--bg-sunken); touch-action: none; }
.ba .layer { display: block; width: 100%; }
.ba .after {
  position: absolute; inset: 0;
  width: 100%;
  clip-path: inset(0 0 0 var(--split, 50%));
}
.ba .after > * { width: 100%; height: 100%; object-fit: cover; }
.ba .handle {
  position: absolute; top: 0; bottom: 0;
  left: var(--split, 50%);
  width: 2px; background: var(--primary);
  box-shadow: 0 0 18px var(--primary-glow);
  cursor: ew-resize;
}
.ba .handle::after {
  content: "";
  position: absolute; top: 50%; left: 50%;
  width: 38px; height: 38px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(16,185,129,.22), 0 6px 18px rgba(0,0,0,.5);
}
.ba .tag-l, .ba .tag-r {
  position: absolute; top: 14px;
  padding: 5px 11px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 650;
  background: var(--glass); backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
}
.ba .tag-l { left: 14px; color: var(--text-secondary); }
.ba .tag-r { right: 14px; color: var(--primary); border-color: var(--border-active); }

/* ============================================================
   ПАНЕЛЬ ПРЕДПРОСМОТРА (demo)
   ============================================================ */

.devbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px var(--shell);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.devbar.hidden { transform: translateY(-100%); }
.seg {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.seg button {
  padding: 7px 12px; border: 0; border-radius: 7px;
  background: none; color: var(--text-secondary);
  cursor: pointer; font: inherit; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background var(--fast), color var(--fast);
}
.seg button:hover { color: var(--text-primary); }
.seg button[aria-pressed="true"] { background: var(--bg-surface-elevated); color: var(--primary); }

.stage { padding: clamp(16px, 3vw, 32px) var(--shell); display: grid; place-items: start center; }
.stage iframe {
  width: 100%; max-width: var(--device, 100%);
  height: min(78vh, 900px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: #fff;
  transition: max-width var(--slow) var(--ease);
  box-shadow: var(--shadow-pop);
}

.swatches { display: flex; gap: 8px; align-items: center; }
.swatches input[type="color"] {
  width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 9px; background: none; cursor: pointer;
}

/* ============================================================
   КАРКАС КАБИНЕТА И АДМИНКИ
   ============================================================ */

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand { padding: 4px 8px 18px; }
.side a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 14px;
  transition: background var(--fast), color var(--fast);
}
.side a:hover { background: var(--bg-surface-elevated); color: var(--text-primary); text-decoration: none; }
.side a.on {
  background: var(--bg-surface-elevated);
  color: var(--text-primary); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--primary);
}
.side a .b {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink);
  border-radius: var(--radius-pill); font-size: 11px; font-weight: 700;
}
.side .side-foot {
  margin-top: auto; padding: 14px 12px 0;
  border-top: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 8px;
  font-size: 12.5px; color: var(--text-muted);
}
.side .side-foot a { padding: 0; font-size: 12.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topline {
  position: sticky; top: 0; z-index: 30;
  background: var(--glass); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px var(--shell);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.topline h1 { font-size: 20px; }
.body { padding: clamp(16px, 2.4vw, 28px) var(--shell) 64px; display: flex; flex-direction: column; gap: var(--gap); }

/* ——— мелочи ——— */

.kpi b { display: block; font-family: var(--font-mono); font-size: clamp(22px, 2.6vw, 30px);
         font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.kpi span { display: block; margin-top: 6px; font-size: 12.5px; color: var(--text-secondary); }
.kpi .delta { font-size: 12px; font-weight: 650; }
.kpi .delta.up { color: var(--primary); }
.kpi .delta.down { color: var(--danger); }

.key {
  display: inline-block;
  font-family: var(--font-mono); font-size: 13.5px; letter-spacing: .06em;
  padding: 5px 11px; border-radius: 8px;
  background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle);
}

.log { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.log .l { display: flex; gap: 10px; align-items: baseline; }
.log .l time { flex: 0 0 auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }

.bub { max-width: 76%; padding: 11px 14px; font-size: 14px;
       background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle);
       border-radius: 14px 14px 14px 4px; }
.bub.me { align-self: flex-end; background: var(--primary-soft); border-color: var(--border-active);
          border-radius: 14px 14px 4px 14px; }

.flash { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14px;
         border: 1px solid; margin: 0 0 var(--gap); }
.flash.ok   { background: var(--primary-soft); border-color: var(--border-active); color: var(--primary); }
.flash.warn { background: var(--warn-soft);    border-color: rgba(245,158,11,.4);  color: var(--warn); }
.flash.err  { background: var(--danger-soft);  border-color: rgba(239,68,68,.4);   color: var(--danger); }

.drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 22px; text-align: center; cursor: pointer;
  background: var(--bg-sunken);
  transition: border-color var(--fast), background var(--fast);
}
.drop:hover, .drop.over { border-color: var(--border-active); background: var(--primary-soft); }

.marquee { overflow: hidden; border-block: 1px solid var(--border-subtle); background: var(--bg-surface); padding: 12px 0; }
.marquee .track { display: flex; gap: 44px; width: max-content; white-space: nowrap;
                  font-size: 13px; color: var(--text-muted); animation: marquee 36s linear infinite; }
.marquee .track span { display: flex; gap: 44px; }
.marquee:hover .track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* фоновая сетка первого экрана */
.grid-bg { position: relative; isolation: isolate; overflow: hidden; }
.grid-bg::before {
  content: ""; position: absolute; inset: -40% -10% auto; height: 150%;
  z-index: -2;
  background-image: linear-gradient(var(--border-subtle) 1px, transparent 1px),
                    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(70% 55% at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(70% 55% at 50% 30%, #000 20%, transparent 75%);
}
.grid-bg::after {
  content: ""; position: absolute; z-index: -1;
  inset: -30% 10% auto -10%; height: 70%;
  background: radial-gradient(42rem 26rem at 20% 20%, var(--primary-soft), transparent 70%),
              radial-gradient(34rem 22rem at 80% 10%, var(--accent-soft), transparent 72%);
  filter: blur(10px);
}

/* появление по прокрутке */
[data-reveal] { opacity: 0; transform: translateY(16px);
                transition: opacity var(--slow) var(--ease), transform var(--slow) var(--ease); }
[data-reveal].seen { opacity: 1; transform: none; }
[data-reveal][data-d="1"] { transition-delay: 70ms; }
[data-reveal][data-d="2"] { transition-delay: 140ms; }
[data-reveal][data-d="3"] { transition-delay: 210ms; }

/* ============================================================
   АДАПТИВ
   ============================================================ */

@media (max-width: 1100px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento.cols-3, .bento.cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3, .span-4, .span-6 { grid-column: span 2; }
}

/* ——— Узкая панель админки и кабинета ———
   На широком экране её нет: там слева колонка. На узком колонка прячется и
   выезжает по кнопке — иначе полтора десятка разделов занимают пол-экрана
   прежде, чем человек увидит хоть что-то по делу. */
.abar { display: none; }

@media (max-width: 980px) {
  .shell { grid-template-columns: minmax(0, 1fr); }

  .abar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 60;
    min-height: 52px; padding: 8px 12px;
    background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-subtle);
  }
  .abar-menu {
    flex: 0 0 auto; display: grid; place-items: center;
    width: 36px; height: 36px; padding: 0;
    border: 1px solid var(--border-subtle); border-radius: 9px;
    background: var(--bg-surface-elevated); color: var(--text-primary); cursor: pointer;
  }
  .abar-menu[aria-expanded="true"] { border-color: var(--border-active); color: var(--primary); }
  .abar-title {
    flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 600;
    letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .abar-logo { flex: 0 0 auto; display: flex; align-items: center; }
  .abar-logo svg { height: 20px; width: auto; }

  /* Колонка превращается в выезжающий список. */
  .side {
    position: fixed; inset: 52px 0 auto; z-index: 55;
    height: auto; max-height: calc(100vh - 52px); overflow-y: auto;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px 12px 14px;
    border-right: 0; border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface); box-shadow: var(--shadow-pop);
    display: none;
  }
  .side.open { display: flex; }
  .side .brand { display: none; }
  .side a { padding: 11px 13px; font-size: 14.5px; }
  .side .side-foot { display: block; margin-top: 10px; padding-top: 12px;
                     border-top: 1px solid var(--border-subtle); }
  .side .side-foot a { padding: 9px 13px; }

  /* Заголовок страницы уже есть в полосе — второй раз его не показываем. */
  .topline h1 { display: none; }
  .topline { min-height: 0; padding-top: 10px; padding-bottom: 10px; }
}

@media (max-width: 760px) {
  :root { --pad-card: 18px; --gap: 12px; }
  .bento, .bento.cols-3, .bento.cols-6 { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3, .span-4, .span-6 { grid-column: span 1; }
  .tall-2, .tall-3 { grid-row: span 1; }

  .burger { display: inline-grid; }
  .navpill {
    position: fixed; inset: 68px 12px auto; z-index: 70;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px; border-radius: var(--radius);
    background: var(--bg-surface);
    box-shadow: var(--shadow-pop);
    display: none;
  }
  .navpill.open { display: flex; }
  .navpill a { padding: 12px 14px; font-size: 15px; }
  .topbar .wrap { min-height: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .bento-card::before, .bento-card::after { display: none; }
}

@media print {
  .topbar, .side, .topline, .devbar, .marquee { display: none; }
  body { background: #fff; color: #000; }
  .bento-card { break-inside: avoid; border-color: #ccc; }
}

/* ============================================================
   СОВМЕСТИМОСТЬ
   Экраны кабинета и админки написаны под прежние имена классов.
   Переписывать полсотни шаблонов ради переименования — работа без
   пользы, поэтому старые имена просто ведут на новые токены.
   ============================================================ */

.card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  transition: border-color var(--base) var(--ease), box-shadow var(--base) var(--ease), transform var(--base) var(--ease);
}
.card.pad { padding: var(--pad-card); }
.card.lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); border-color: var(--border-strong); }

.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.two.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sep { height: 1px; background: var(--border-subtle); margin: 20px 0; }

.btn.a { background: var(--primary); border-color: var(--primary); color: var(--primary-ink);
         box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 0 20px var(--primary-glow); }
.btn.a:hover { background: color-mix(in oklab, var(--primary) 88%, #fff); border-color: color-mix(in oklab, var(--primary) 88%, #fff); }
.btn.g { background: var(--bg-surface); }
.btn.q { background: none; border-color: transparent; color: var(--primary); padding-inline: 10px; }
.btn.q:hover { background: var(--primary-soft); transform: none; }
.btn.s { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--radius-pill);
       font-size: 11.5px; font-weight: 600; background: var(--bg-surface-elevated);
       border: 1px solid var(--border-subtle); color: var(--text-secondary); white-space: nowrap; }
.tag.ok   { background: var(--primary-soft); border-color: var(--border-active); color: var(--primary); }
.tag.acc  { background: var(--accent-soft); border-color: rgba(59,130,246,.4); color: var(--accent); }
.tag.warn { background: var(--warn-soft); border-color: rgba(245,158,11,.4); color: var(--warn); }
.tag.bad  { background: var(--danger-soft); border-color: rgba(239,68,68,.4); color: var(--danger); }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; padding: 11px 14px; font-size: 10.5px; font-weight: 650; letter-spacing: .1em;
             text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
table.t td { padding: 13px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
table.t tbody tr { transition: background var(--fast); }
table.t tbody tr:hover td { background: var(--bg-surface-elevated); }
table.t tbody tr:last-child td { border-bottom: 0; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: var(--radius-pill);
        font-size: 13.5px; border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-secondary); }
.pill:hover { border-color: var(--border-strong); color: var(--text-primary); text-decoration: none; }
.pill.on { background: var(--primary-soft); border-color: var(--border-active); color: var(--primary); font-weight: 650; }
.pill b { background: var(--primary); color: var(--primary-ink); border-radius: var(--radius-pill); padding: 0 6px; font-size: 11px; }

.kpi { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi .card { padding: 16px 18px; }

.mods { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.mod .t b, .mod .t span { overflow-wrap: anywhere; }
.mod { display: flex; gap: 13px; align-items: flex-start; padding: 13px 15px; cursor: pointer;
       background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
       transition: border-color var(--fast), background var(--fast); }
.mod:hover { border-color: var(--border-active); }
.mod.on { border-color: var(--border-active); background: var(--primary-soft); }
.mod.inc { background: var(--bg-surface-elevated); cursor: default; }
.mod input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--primary); }
.mod .t { flex: 1 1 auto; min-width: 0; }
.mod .t b { display: block; font-size: 14.5px; }
.mod .t span { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.mod .p { flex: 0 0 auto; font-family: var(--font-mono); font-weight: 650; font-size: 14px; white-space: nowrap; }
.mod .p .free { color: var(--primary); font-family: var(--font-sans); font-size: 12.5px; }

.bill { position: sticky; top: 88px; }
.bill .line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 5px 0; }
.bill .sum { display: flex; justify-content: space-between; align-items: baseline;
             border-top: 1px solid var(--border-subtle); margin-top: 10px; padding-top: 12px; }
.bill .sum b { font-family: var(--font-mono); font-size: 25px; letter-spacing: -.03em; }

.payline { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: none;
           align-items: center; gap: 14px; padding: 11px var(--shell);
           background: var(--glass); backdrop-filter: blur(14px); border-top: 1px solid var(--border-subtle); }
.payline b { font-family: var(--font-mono); font-size: 19px; }

.steps { counter-reset: s; display: grid; gap: var(--gap); }
.step { counter-increment: s; position: relative; padding-left: 56px; }
.step::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 38px; height: 38px;
                display: grid; place-items: center; border-radius: 11px;
                background: var(--primary-soft); border: 1px solid var(--border-active);
                color: var(--primary); font-family: var(--font-mono); font-weight: 700; font-size: 16px; }
.step h3 { font-size: 17px; }
.step p { margin-top: 5px; font-size: 14px; color: var(--text-secondary); }

.foot { background: var(--bg-surface); border-top: 1px solid var(--border-subtle);
        padding-block: clamp(32px, 5vw, 56px) 20px; color: var(--text-secondary); }
.foot .cols { display: grid; gap: clamp(18px, 3vw, 34px); grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr)); }
.foot .list { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; font-size: 14px; }
.foot .list a { color: var(--text-secondary); }
.foot .list a:hover { color: var(--text-primary); }
.foot .base { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
              margin-top: clamp(22px, 3vw, 36px); padding-top: 18px;
              border-top: 1px solid var(--border-subtle); font-size: 12.5px; color: var(--text-muted); }

.chrow { display: block; padding: 11px 16px; border-bottom: 1px solid var(--border-subtle); color: inherit; }
.chrow:hover { background: var(--bg-surface-elevated); text-decoration: none; }
.chrow.on { background: var(--primary-soft); box-shadow: inset 2px 0 0 var(--primary); }

.hero { position: relative; }
.nums { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.num b { display: block; font-family: var(--font-mono); font-size: clamp(26px, 4vw, 40px);
         font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.num span { display: block; margin-top: 7px; font-size: 13px; color: var(--text-secondary); }

@media (max-width: 1040px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
                             .foot .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px)  { .two, .two.even, .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
                             .bill { position: static; } .payline { display: flex; }
                             body.haspay { padding-bottom: 76px; } }
@media (max-width: 560px)  { .g4 { grid-template-columns: minmax(0, 1fr); } .foot .cols { grid-template-columns: minmax(0, 1fr); } }

/* ===================================================================
   Единые поля и защита от вылезания
   -------------------------------------------------------------------
   Раньше поле выглядело одинаково, только если ему не забыли проставить
   class="inp". Забывали. Поэтому правила ниже цепляются к самому элементу
   внутри формы или карточки: вид один и тот же, помнит о нём автор или нет.
   =================================================================== */

.card input:not([type]), .card input[type="text"], .card input[type="email"],
.card input[type="url"], .card input[type="tel"], .card input[type="search"],
.card input[type="number"], .card input[type="password"], .card input[type="date"],
.card input[type="time"], .card input[type="datetime-local"],
.card select, .card textarea,
form input:not([type]), form input[type="text"], form input[type="email"],
form input[type="url"], form input[type="tel"], form input[type="search"],
form input[type="number"], form input[type="password"], form input[type="date"],
form input[type="time"], form input[type="datetime-local"],
form select, form textarea {
  width: 100%;
  max-width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 11px 14px;
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}

.card textarea, form textarea { resize: vertical; min-height: 92px; line-height: 1.6; }

.card input:focus, .card select:focus, .card textarea:focus,
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Флажки и переключатели остаются собой: ширина во всю строку им не нужна. */
.card input[type="checkbox"], .card input[type="radio"],
form input[type="checkbox"], form input[type="radio"] {
  width: auto; max-width: none; padding: 0;
  inline-size: 17px; block-size: 17px;
  accent-color: var(--primary); cursor: pointer; flex: 0 0 auto;
}

/* Выбор файла: системная кнопка внутри поля выглядит иначе, поэтому
   отступы чуть меньше — иначе поле получается выше остальных. */
.card input[type="file"], form input[type="file"] {
  width: 100%; max-width: 100%;
  font: inherit; font-size: 14px;
  padding: 9px 12px;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
}
.card input[type="file"]::file-selector-button,
form input[type="file"]::file-selector-button {
  font: inherit; font-size: 13px; margin-right: 12px;
  padding: 7px 13px; border-radius: 8px; cursor: pointer;
  color: var(--text-primary); background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

/* Одинаковый шаг между полями — где бы они ни стояли. */
label.f, .card label:not(.row):not(.sw) { display: block; margin-bottom: var(--gap, 14px); }
label.f:last-child, .card label:last-child { margin-bottom: 0; }
label.f > span, .card label > span:first-child {
  display: block; font-size: 13px; font-weight: 550;
  margin-bottom: 6px; color: var(--text-primary);
}
label.f small, .card label small {
  display: block; font-size: 12px; line-height: 1.45;
  margin-top: 6px; color: var(--text-muted);
}
/* Подпись рядом с флажком — не блок: иначе текст уезжает под квадратик. */
.card label.row > span, label.row > span:first-child { display: inline; margin-bottom: 0; }

/* Сетка полей: на узком экране всегда одна колонка. */
.grid2 { display: grid; gap: var(--gap, 14px); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 720px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

/* ——— Ничего не вылезает за края ——— */
img, svg, video, canvas, iframe { max-width: 100%; height: auto; }
pre { max-width: 100%; overflow-x: auto; }
code, .key { overflow-wrap: anywhere; }
.card, .bento-card { min-width: 0; overflow-wrap: break-word; }
.row { min-width: 0; }
/* Текстовым блокам в строке разрешаем сжиматься — иначе длинный абзац
   распирает строку. А кнопкам, бейджам и значкам нельзя: сжатая кнопка
   обрезает собственную надпись. Раньше правило было общим для всех детей,
   и «Отметить проверенными» теряло хвост. */
.row > * { min-width: 0; }
.row > :is(.btn, .tag, .chip, .badge, .pill, button, .iconbtn, .cartbtn, input[type="checkbox"], input[type="radio"]),
.row > form:has(> :is(.btn, button)):not(:has(input[type="text"], input:not([type]), textarea, select)),
.row > .right:has(> :is(.btn, form)) {
  flex-shrink: 0; min-width: auto;
}

/* Таблицы шире экрана прокручиваются, а не рвут вёрстку. */
.scroll { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll > table { min-width: max-content; }

/* Кнопки в ряд переносятся, а длинная надпись не растягивает карточку. */
.bar, .row.wrap { flex-wrap: wrap; }
.btn { max-width: 100%; overflow-wrap: anywhere; }

@media (max-width: 560px) {
  /* На узком экране кнопка в строку одна — так в неё попадают пальцем. */
  .card form .bar .btn, .card .bar > .btn { flex: 1 1 auto; justify-content: center; }
}

/* Печать: прокрутка на бумаге не нужна, таблицы должны уместиться целиком. */
@media print {
  .scroll { overflow: visible !important; }
  .scroll > table { min-width: 0 !important; }
}

/* ===================================================================
   Облик, который задаёт админ
   -------------------------------------------------------------------
   Шрифт, размер текста, форма кнопок и курсор приходят переменными из
   настроек (App\Core\Look). Здесь только то, как эти переменные работают.
   =================================================================== */

/* Масштаб текста. Меняем через em на body, а не через font-size на html:
   так все clamp() и rem в вёрстке остаются целыми, а текст действительно
   становится мельче или крупнее целиком, вместе с отступами внутри кнопок. */
body { font-size: calc(15px * var(--look-scale, 1)); }

h1 { font-size: calc(clamp(32px, 5.4vw, 60px) * var(--look-scale, 1)); }
h2 { font-size: calc(clamp(24px, 3.4vw, 38px) * var(--look-scale, 1)); }
h3 { font-size: calc(clamp(17px, 1.9vw, 21px) * var(--look-scale, 1)); }

/* Montserrat заметно шире Inter в заглавных, поэтому разрядка чуть другая:
   с прежней буквы в заголовках наезжают друг на друга. */
h1, h2, h3, h4 { letter-spacing: -.022em; }

/* Курсор. Задаём только там, где он осмыслен: в полях ввода нужен текстовый
   курсор, иначе человек не поймёт, что туда можно печатать. */
:root { --look-cursor: auto; --look-cursor-hand: pointer; }
body { cursor: var(--look-cursor); }
a, button, [role="button"], summary, label, .btn, .chip, [data-ripple] { cursor: var(--look-cursor-hand); }
input, textarea, select, [contenteditable] { cursor: auto; }
input[type="checkbox"], input[type="radio"], input[type="range"] { cursor: var(--look-cursor-hand); }

/* ——— Овальные рамки у кнопок и значков ———
   Одна форма на весь сайт: когда часть элементов скруглена сильнее, а часть
   слабее, страница выглядит собранной из кусков. */
.btn, .chip, .tag, .pill { border-radius: var(--radius-pill); }

/* Кнопка-иконка: ровный круг, а не прямоугольник со скруглением.
   Размер один и тот же, чтобы ряд кнопок стоял по линии. */
.btn-icon, .icon-btn, button.icon {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; padding: 0;
  border-radius: 999px;
  flex: 0 0 auto;
}
.btn-icon.sm, .icon-btn.sm { width: 32px; height: 32px; }
.btn-icon svg, .icon-btn svg { width: 17px; height: 17px; }

/* Ряды кнопок: одинаковый шаг и выравнивание по центру, чтобы иконки и
   подписи стояли на одной линии, а не плясали по высоте. */
.bar, .row.wrap, .btns {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.bar > *, .btns > * { margin: 0; }

/* Подвал карточки: цена слева, кнопки справа, одинаковый отступ сверху. */
.bento-card .foot, .card .foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

/* Цена без собственного фона: она читается размером и начертанием,
   а плашка вокруг неё спорит с кнопкой рядом. */
.price { background: none; padding: 0; border: 0; }

@media (max-width: 420px) {
  /* На узком экране цена и кнопки в столбик: иначе «Выбрать» наезжает на цену. */
  .bento-card .foot, .card .foot { flex-direction: column; align-items: stretch; }
  .bento-card .foot .row, .card .foot .row { justify-content: stretch; }
  .bento-card .foot .btn, .card .foot .btn { flex: 1 1 auto; justify-content: center; }
}

/* ——— Панель демо ———
   Три группы в ряд: устройства, примерка бренда, покупка. На узком экране
   они встают столбиком — иначе «Купить» уезжает под кнопку скрытия панели. */
.demo-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.demo-bar > * { min-width: 0; }
.demo-buy { flex: 0 0 auto; }

@media (max-width: 760px) {
  .demo-bar { flex-direction: column; align-items: stretch; }
  .demo-buy { justify-content: stretch; }
  .demo-buy .btn { flex: 1 1 auto; justify-content: center; }
}

/* ——— Экран «Оформление сайта» ——— */
.cursor-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.cursor-opt {
  display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 10px 16px 10px 12px; cursor: pointer;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
  background: var(--bg-surface-elevated); font-size: 14px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.cursor-opt input { position: absolute; opacity: 0; pointer-events: none; }
.cursor-opt:has(input:checked) { border-color: var(--border-active); box-shadow: 0 0 0 3px var(--primary-soft); }
.cursor-prev {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 999px; background: var(--bg-page); border: 1px solid var(--border-subtle);
}

.fx-list { display: grid; gap: 2px; }
.fx-row {
  display: grid; gap: 10px 18px; align-items: center;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  padding: 12px 0; border-top: 1px solid var(--border-subtle);
}
.fx-row:first-child { border-top: 0; }
@media (max-width: 760px) { .fx-row { grid-template-columns: minmax(0, 1fr); } }

.tpl-pick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tpl-opt {
  display: flex; gap: 10px; align-items: flex-start; margin: 0;
  padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
}
.tpl-opt:has(input:checked) { border-color: var(--border-active); }
.tpl-opt input { margin-top: 3px; }

/* Сегменты-вкладки ссылками: тот же вид, что у кнопок-сегментов. */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px;
       border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
       background: var(--bg-surface); }
.seg > a, .seg > button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--radius-pill); border: 0;
  font-size: 13.5px; font-weight: 550; color: var(--text-secondary);
  background: transparent; text-decoration: none;
}
.seg > [aria-pressed="true"] { color: var(--text-primary); background: var(--bg-surface-elevated);
                               box-shadow: inset 0 0 0 1px var(--border-active); }

/* ===================================================================
   Кнопки «контуром»
   -------------------------------------------------------------------
   Овальная рамка, без заливки: кнопка не спорит с ценой и картинкой
   рядом, а глаз всё равно находит её по цвету рамки. Включается
   настройкой «Кнопки» в оформлении сайта (data-btn на <body>).
   =================================================================== */
[data-btn="outline"] .btn {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  box-shadow: none;
}
[data-btn="outline"] .btn:hover {
  background: color-mix(in srgb, var(--text-primary) 5%, transparent);
  border-color: var(--text-secondary);
}
[data-btn="outline"] .btn-primary, [data-btn="outline"] .btn.a {
  background: transparent;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: none;
}
[data-btn="outline"] .btn-primary:hover, [data-btn="outline"] .btn.a:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 0 18px var(--primary-glow);
}
[data-btn="outline"] .btn-ghost { border-color: var(--border-subtle); }
[data-btn="outline"] .btn-quiet { border-color: transparent; }

/* Значки в рамке: ровный круг одного размера, иконка точно по центру. */
.btn.btn-icon { padding: 0; gap: 0; width: 38px; height: 38px; border-radius: 999px; }
.btn.btn-icon.sm { width: 34px; height: 34px; }
.btn.btn-icon .sr { position: absolute; }

/* Бургер в шапке — тоже круг в рамке. Когда он показывается, решает
   исходное правило выше; здесь только форма. */
.burger {
  place-items: center; width: 38px; height: 38px; padding: 0;
  margin-left: auto;
  border: 1.5px solid var(--border-strong); border-radius: 999px;
  background: transparent; color: var(--text-primary);
}

/* Шапка: логотип, меню и кнопки на одной оси, одинаковые зазоры. */
.site-head .wrap, header.top .wrap { display: flex; align-items: center; gap: 16px; }
/* Только выравнивание: показывать ли меню, решают правила выше — на телефоне
   оно скрыто до нажатия кнопки. Здесь когда-то стояло display:flex, и меню
   на телефоне открывалось само, закрывая первый экран. */
.navpill { align-items: center; gap: 4px; }
.navpill a { padding: 8px 14px; border-radius: var(--radius-pill); }


/* ===================================================================
   Узкий экран: всё в одну колонку, кнопки переносят надпись
   =================================================================== */

/* Сетки на 2–4 колонки: на телефоне одна. minmax(0, …) не даёт колонке
   раздуться шире экрана из-за длинного слова или поля ввода. */
.g2, .g3, .g4 { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } }

@media (max-width: 560px) {
  /* Длинная кнопка в узкой колонке переносит надпись, а не вылезает. */
  .btn { white-space: normal; text-align: center; line-height: 1.25; }
  .card.pad, .card .pad { padding: 16px; }
  .bento-card { padding: 16px; }
  body { font-size: calc(13.5px * var(--look-scale, 1)); }
  table.t { font-size: 13px; }
  table.t th, table.t td { padding: 9px 10px; }
}

/* Двухколоночные раскладки, заданные прямо в разметке (style="grid-template-
   columns: minmax(0,1fr) 420px"), на узком экране отдавали всё место одной
   колонке, а другую сжимали в ноль — карточка становилась шириной 34 точки.
   Резиновые сетки с auto-fit/auto-fill подстраиваются сами, их не трогаем. */
@media (max-width: 860px) {
  .grid[style*="grid-template-columns"]:not([style*="auto-fit"]):not([style*="auto-fill"]),
  div[style*="grid-template-columns"]:not([style*="auto-fit"]):not([style*="auto-fill"]) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  /* То же для элементов, которым в разметке дали место во второй колонке. */
  [style*="grid-column:2"], [style*="grid-column: 2"] { grid-column: auto !important; }
}

/* Логотип берёт цвет текста страницы — виден в обеих темах. */
.brand { color: var(--text-primary); }

/* Шапка сайта на телефоне: логотип, меню, тема и одна кнопка входа.
   «Выбрать шаблон» ведёт туда же, куда пункт «Шаблоны» в меню, поэтому на
   узком экране прячется — иначе она вылезала за край на 64 точки. */
@media (max-width: 560px) {
  .topbar .wrap > .row.right { gap: 6px !important; }
  .topbar .wrap > .row.right .btn-primary { display: none; }
  .topbar .wrap > .row.right .btn:not(.btn-icon) { padding: 7px 12px; }
  .brand svg { height: 26px; width: auto; }
}

/* Поле внутри «поисковой пилюли» — без своей рамки и фона: рамку рисует сама
   пилюля. Общее правило для полей в формах давало здесь рамку внутри рамки. */
form.search input, .search input, .searchbar input {
  border: 0 !important; background: transparent !important; box-shadow: none !important;
  padding-left: 0; padding-right: 0;
}

/* Кнопка меню на телефоне — справа, рядом с темой и входом, а не посередине. */
@media (max-width: 860px) {
  .topbar .wrap > .row.right { margin-left: 0; }
  .topbar .burger { order: 5; margin-left: 6px; }
  .topbar .wrap > .row.right { margin-left: auto; order: 4; }
}

/* Фильтры каталога на телефоне: каждая группа — одна лента, листается
   пальцем вбок. Раньше чипы рассыпались на четыре строки и отодвигали
   сами шаблоны за первый экран. */
@media (max-width: 560px) {
  .filters {
    display: flex; flex-wrap: nowrap; gap: 6px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin-inline: calc(var(--shell, 16px) * -1); padding-inline: var(--shell, 16px);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters .f-btn { flex: 0 0 auto; white-space: nowrap; padding: 7px 13px; font-size: 13px; }
  .row.wrap-row:has(> .filters) { flex-direction: column; align-items: stretch; gap: 8px !important; }
}

@media (max-width: 560px) {
  .search { padding: 2px 6px 2px 16px; min-height: 46px; }
  .search input { font-size: 14px; padding-top: 10px; padding-bottom: 10px; }
}

/* ===================================================================
   Телефон: плотнее. Меньше кегль и отступы, поля ниже, заголовки скромнее —
   чтобы в строку и на экран помещалось больше.
   =================================================================== */
@media (max-width: 560px) {
  h1 { font-size: clamp(24px, 7.2vw, 30px); line-height: 1.12; }
  h2 { font-size: 18px !important; }
  h3 { font-size: 15.5px !important; }
  .lead { font-size: 13.5px; line-height: 1.55; }
  .card.pad, .bento-card { padding: 14px; }
  .inp, select.inp, textarea.inp { padding: 8px 11px; font-size: 13px; min-height: 36px; }
  textarea.inp { min-height: 0; }
  label.f > span { font-size: 12px; }
  .grid.g2, .grid.g3, .grid.g4 { gap: 10px !important; }
  .btn { padding: 8px 13px; font-size: 13px; }
  .btn.s { padding: 6px 11px; font-size: 12.5px; }
  .muted, .dim, p.muted { font-size: 12.5px !important; }
  table.t td, table.t th { padding: 8px 9px; font-size: 12.5px; }
}
@media (max-width: 560px) {
  /* То же для полей в карточках и формах: у них своё, более точное правило. */
  :is(.card, form) :is(input:not([type]), input[type="text"], input[type="email"], input[type="url"], input[type="tel"],
    input[type="search"], input[type="number"], input[type="password"], input[type="date"], input[type="time"],
    input[type="datetime-local"], select, textarea) {
    padding: 8px 11px; font-size: 13px;
  }
}
.abar-logo { color: var(--text-primary); }

/* ===================================================================
   КОМПАКТНЫЙ ИНТЕРФЕЙС
   -------------------------------------------------------------------
   Плотнее строки и меньше воздуха между ними. Цены — обычным шрифтом
   с цифрами одной ширины: моноширинный давал «7  900  ₴» с дырами.
   =================================================================== */
body { line-height: 1.45; }
p, .lead, .muted { line-height: 1.5; }
h1, h2, h3, h4 { line-height: 1.15; }

.price, .mod .p, .bill .sum b, .payline b, .kpi b, .num b, .scorebar .s b {
  font-family: inherit; font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.price { font-size: clamp(17px, 1.8vw, 20px); font-weight: 750; white-space: nowrap; }
.price s { font-size: 12.5px; margin-left: 6px; }

/* Карточка шаблона: цена и кнопки — одна строка, без переносов. */
.tpl-body { padding: 14px 16px 16px; gap: 8px; }
.tpl-body .foot { flex-wrap: nowrap; flex-direction: row !important; align-items: center !important; padding-top: 10px; border-top: 1px solid var(--border-subtle); }
.tpl-body .foot .price { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tpl-body .foot .right { flex: 0 0 auto; }
.tpl-body .foot .btn { white-space: nowrap; }

/* На сенсорном экране :hover «залипает» после касания: подсветка карточки
   оставалась там, куда ткнули, и низ выглядел чёрной плашкой. */
@media (hover: none) {
  .bento-card::before, .bento-card::after, [data-spot]::before { opacity: 0 !important; }
  .bento-card:hover .tpl-shot img { transform: none; }
}

/* Шапка на телефоне: логотип, тема и меню. Вход, админка и выход — в меню. */
.nav-mob { display: none; }
@media (max-width: 760px) {
  .topbar .hide-m { display: none !important; }
  .navpill .nav-mob { display: contents; }
  .navpill .nav-mob a { border-top: 1px solid var(--border-subtle); border-radius: 0; }
  .navpill .nav-mob a:first-child { margin-top: 6px; }
  .navpill .nav-mob .nav-cta { background: var(--primary); color: #fff; border-radius: var(--radius-pill); border-top: 0; margin-top: 8px; text-align: center; }
  .navpill a { padding: 10px 12px; font-size: 14px; }
  .topbar .wrap { gap: 8px; min-height: 56px; }
  .topbar .burger { order: 6; margin-left: 0; }
  .topbar .wrap > .row.right { margin-left: auto; order: 5; }
}

/* Кнопка «наверх» не садится на липкую панель покупки. */
[data-sticky-buy] { gap: 10px; flex-wrap: nowrap; }
[data-sticky-buy] .btn { white-space: nowrap; }

/* Подвал: группы в рамках, на телефоне — раскрывающиеся списки. */
.foot .fgroup { border: 1px solid var(--border-subtle); border-radius: 14px; padding: 12px 14px; background: var(--bg-surface-elevated); }
.foot .fgroup > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.foot .fgroup > summary::-webkit-details-marker { display: none; }
.foot .fgroup > summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform .2s; margin-right: 3px; }
.foot .fgroup[open] > summary::after { transform: rotate(-135deg); }
.foot .list { gap: 6px; margin-top: 10px; font-size: 13.5px; }

@media (max-width: 560px) {
  body { font-size: 13px; }
  .sec { padding-top: 26px; padding-bottom: 26px; }
  .wrap { padding-left: 14px; padding-right: 14px; }
  .foot .cols { gap: 8px; }
  .foot .cols > div:first-child { margin-bottom: 8px; }
  .foot .fgroup { padding: 10px 12px; }
  .foot .list { margin-top: 8px; font-size: 13px; }
  .foot .base { font-size: 11.5px; gap: 4px; }
  .chip { padding: 4px 9px; font-size: 11.5px; }
  .tpl-body h3 { font-size: 16px !important; }
  .scorebar .s { padding: 3px 7px; font-size: 10.5px; }
  [data-top] { right: 12px; bottom: 12px; width: 38px; height: 38px; }
  [data-sticky-buy] { padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); }
}
/* Нижняя полоса «Итого / Оформить» на странице шаблона: когда она видна,
   кнопка «наверх» поднимается над ней, а странице добавлен нижний отступ. */
@media (max-width: 860px) {
  body:has(.payline) main { padding-bottom: 72px; }
  .payline { padding: 8px 14px calc(8px + env(safe-area-inset-bottom, 0px)); gap: 10px; align-items: center; }
  .payline .btn { white-space: nowrap; padding: 10px 18px; }
  .payline b { font-size: 18px; }
}
.bento-card.tpl-card { padding: 0; }

/* Короткие классы админки (общие с админкой шаблонов): у каждого — тот же
   вид, что у полного имени. Без них «Сохранить» в режиме «кнопки контуром»
   получалась тёмным текстом на тёмном фоне. */
.btn.s { padding: 6px 12px; font-size: 12.5px; min-height: 32px; }
.btn.q { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn.q:hover { color: var(--text-primary); background: var(--bg-surface-elevated); }
.btn.wide { width: 100%; justify-content: center; }
.hint { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.copy { cursor: pointer; color: var(--primary); font-size: 12.5px; }
.note { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-subtle); background: var(--bg-surface-elevated); font-size: 13px; }
.note.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }

/* ===================================================================
   Состав шаблона: что в цене, что продаётся, что скрыто
   =================================================================== */
.sostav-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.sostav-sum b { margin-left: 4px; }
.sgrp { margin-top: 10px; border: 1px solid var(--border-subtle); border-radius: 14px; overflow: hidden; }
.sgrp > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--bg-surface-elevated); font-weight: 650; font-size: 13.5px; }
.sgrp > summary::-webkit-details-marker { display: none; }
.sgrp > summary > span:first-child::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--text-muted); transition: transform .2s; }
.sgrp[open] > summary > span:first-child::before { transform: rotate(90deg); }
.sgrp-all { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.sgrp-all button { border: 1px solid var(--border-subtle); background: transparent; color: var(--text-secondary);
  border-radius: 999px; padding: 3px 9px; font: inherit; font-size: 11px; font-weight: 500; cursor: pointer; }
.sgrp-all button:hover { color: var(--text-primary); border-color: var(--border-strong); }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) auto 104px; gap: 10px; align-items: center;
  padding: 8px 12px; border-top: 1px solid var(--border-subtle); }
.sname { min-width: 0; }
.sname b { display: block; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.sname .mono { display: block; font-size: 10.5px; color: var(--text-muted); }
.seg3 { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; padding: 2px; gap: 2px; }
.seg3 label { position: relative; cursor: pointer; }
.seg3 input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg3 span { display: block; padding: 4px 10px; border-radius: 999px; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.seg3 input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 1px; }
.seg3 .s-on input:checked + span { background: var(--primary); color: var(--primary-ink, #04120c); font-weight: 650; }
.seg3 .s-sale input:checked + span { background: var(--accent, #3B82F6); color: #fff; font-weight: 650; }
.seg3 .s-off input:checked + span { background: var(--bg-surface-elevated); color: var(--text-primary); font-weight: 650; box-shadow: inset 0 0 0 1px var(--border-strong); }
.sprice { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.sprice .inp { width: 0; flex: 1 1 auto; }
.sprice .inp { padding: 6px 8px !important; font-size: 12.5px !important; text-align: right; min-height: 0; }
.sprice span { color: var(--text-muted); font-size: 12px; }
.sostav-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg-surface) 92%, transparent); backdrop-filter: blur(10px); }
@media (max-width: 640px) {
  .srow { grid-template-columns: minmax(0, 1fr) 96px; }
  .srow .seg3 { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .srow .sprice { grid-row: 1; grid-column: 2; }
  .sgrp > summary { flex-wrap: wrap; }
  .sostav-bar { flex-direction: column; align-items: stretch; }
}

/* ===================================================================
   Админка: плотнее и понятнее
   =================================================================== */
.side a { padding: 7px 12px; font-size: 13.5px; }
.side .sgroup { margin-top: 6px; }
.side .sgroup > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px 4px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 650; }
.side .sgroup > summary::-webkit-details-marker { display: none; }
.side .sgroup > summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform .2s; }
.side .sgroup:not([open]) > summary::after { transform: rotate(-45deg); }
.card .row > h3:first-child, .card > .row > h3, .bento-card .row > h3 { margin: 0; padding: 0; }
label.f { gap: 4px; }
label.f > span { font-size: 12.5px; }
.card .grid, .card .g2, .card .g3 { row-gap: 12px; }
.card .hint, .card .muted { margin-top: 4px; }

/* Телефон: карточки по высоте содержимого, без пустого низа. */
@media (max-width: 760px) { .bento { grid-auto-rows: auto; } }
/* Метка поверх снимка — на плотной подложке, чтобы её не перебивала картинка. */
.tpl-shot .over .chip { background: color-mix(in srgb, var(--bg-surface) 88%, transparent); backdrop-filter: blur(6px); }

/* Админка на телефоне: одна полоса сверху. Тема и «на сайт» — значками в ней,
   вторая строка с теми же кнопками больше не нужна и не заезжает под первую. */
.abar-ico { display: none; }
@media (max-width: 860px) {
  .abar { gap: 8px; }
  .abar-logo { display: none !important; }
  .abar-ico { display: inline-grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 0;
    border: 1.5px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--text-primary); cursor: pointer; }
  .abar-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main > .topline { display: none; }
}

/* Панель демо: на компьютере всё в одну строку, «примерочная» раскрыта.
   На телефоне — одна строка: шаблон, «Примерить», «Купить», закрыть. */
/* Атрибут hidden сильнее любого display у класса: «Показать панель»
   с display:inline-flex от .btn была видна, когда панель открыта. */
[hidden] { display: none !important; }

.demo-bar .try { display: contents; }
.demo-bar .try > summary { display: none; }
.show-m { display: none; }
@media (max-width: 760px) {
  .demo-bar { gap: 8px !important; padding: 8px 10px !important; flex-direction: row !important; flex-wrap: nowrap !important;
    align-items: center !important; justify-content: flex-start !important; height: auto !important; min-height: 0 !important; }
  .demo-bar .brand { flex: 0 0 auto; }
  .demo-bar .dev-seg { display: none; }
  .demo-bar .brand span { display: none; }
  .demo-bar .try { display: block; position: relative; }
  .demo-bar .try > summary { display: inline-flex; list-style: none; }
  .demo-bar .try > summary::-webkit-details-marker { display: none; }
  .demo-bar .try:not([open]) .try-body { display: none !important; }
  .demo-bar .try { position: static; }
  .demo-bar .try[open] .try-body { position: fixed; left: 10px; right: 10px; top: 58px; z-index: 70; width: auto;
    padding: 12px; border-radius: 14px; background: var(--bg-surface); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-pop); }
  .demo-bar .try-body .inp { width: 100% !important; }
  .demo-bar .demo-buy { margin-left: auto; flex-wrap: nowrap; }
  .demo-bar .demo-buy .btn { white-space: nowrap; }
  .hide-m { display: none; }
  .show-m { display: inline; }
}
.srow.absent .sname b { color: var(--text-muted); }
.srow .warn-t { color: var(--warn); font-family: inherit; }
.seg3 input:disabled + span { opacity: .35; cursor: not-allowed; }

/* ===================================================================
   ПЛОТНЫЙ РЕЖИМ (последний блок — главный)
   -------------------------------------------------------------------
   Меньше кегль, межстрочное и отступы: на экран влезает больше.
   =================================================================== */
/* Телефон: шапка админки и кабинета — по высоте содержимого. Сетка .shell
   растягивала первую строку до сотен пикселей на коротких страницах. */
@media (max-width: 980px) {
  .shell { grid-template-rows: auto 1fr; align-content: start; }
  .abar { min-height: 0; padding: 6px 10px; height: auto; }
}

body { font-size: 13.5px; line-height: 1.38; }
p, .lead, .muted, li { line-height: 1.42; }
.lead { font-size: 14.5px; }
h1 { line-height: 1.1; } h2, h3, h4 { line-height: 1.15; }
.micro { font-size: 10px; letter-spacing: .12em; }
.btn { padding: 8px 14px; font-size: 13px; min-height: 0; }
.btn-sm, .btn.s { padding: 6px 11px; font-size: 12px; }
.inp, select.inp, textarea.inp { padding: 7px 10px; font-size: 13px; }
label.f { gap: 3px; } label.f > span { font-size: 12px; }
.card.pad { padding: 14px 16px; }
.chip, .state, .tag { padding: 3px 9px; font-size: 11.5px; }
table td, table th { padding: 7px 9px; font-size: 12.5px; }
.side a { padding: 6px 10px; font-size: 13px; }
.body { padding-top: 14px; padding-bottom: 20px; gap: 12px; }

@media (max-width: 560px) {
  body { font-size: 12.5px; line-height: 1.33; }
  p, .lead, .muted, li { line-height: 1.38; }
  .lead { font-size: 13px; }
  h1 { font-size: clamp(20px, 6vw, 24px) !important; }
  h2 { font-size: 16px !important; }
  h3 { font-size: 14px !important; }
  .btn { padding: 7px 12px; font-size: 12.5px; }
  .btn-sm, .btn.s { padding: 5px 10px; font-size: 11.5px; }
  .inp, select.inp, textarea.inp,
  :is(.card, form) :is(input:not([type]), input[type="text"], input[type="email"], input[type="url"], input[type="tel"],
    input[type="search"], input[type="number"], input[type="password"], input[type="date"], input[type="time"],
    input[type="datetime-local"], select, textarea) { padding: 6px 9px; font-size: 12.5px; }
  .card.pad, .bento-card, .card { padding: 11px 12px; }
  .bento-card.tpl-card { padding: 0; }
  .sec { padding-top: 18px; padding-bottom: 18px; }
  .body { padding: 10px 10px 18px; gap: 10px; }
  .chip, .state, .tag { padding: 2px 8px; font-size: 10.5px; }
  table td, table th { padding: 6px 7px; font-size: 11.5px; }
  .micro { font-size: 9.5px; }
  .abar { padding: 5px 8px; gap: 6px; }
  .abar-title { font-size: 14px; }
  .abar-menu, .abar-ico { flex-basis: 32px; width: 32px; height: 32px; }
  .wrap { padding-left: 10px; padding-right: 10px; }

  /* Состав шаблона: строка = название и цена, под ними узкий переключатель. */
  .srow { padding: 6px 9px; gap: 4px 8px; grid-template-columns: minmax(0, 1fr) 78px; }
  .sname b { font-size: 12.5px; }
  .sname .mono { font-size: 9.5px; }
  .seg3 span { padding: 3px 8px; font-size: 11px; }
  .sprice .inp { padding: 4px 6px !important; font-size: 11.5px !important; }
  .sgrp > summary { padding: 7px 9px; font-size: 12.5px; }
  .sgrp-all button { padding: 2px 7px; font-size: 10px; }
  .sostav-bar { padding: 7px 9px; gap: 6px; }
  .sostav-sum .state { font-size: 10.5px; }
}

/* «.row.wrap» — строка с переносом, а не контейнер страницы: без его отступов.
   Из-за них заголовки и кнопки карточек сдвигались вправо. */
.row.wrap { flex-wrap: wrap; padding-left: 0 !important; padding-right: 0 !important; max-width: none; margin-left: 0; margin-right: 0; }
/* Переключатель состава — по высоте кнопок, а не строки сетки. */
.seg3 { align-self: center; height: auto; }
.seg3 label { display: block; margin: 0; line-height: 1.1; }
.sprice { white-space: nowrap; }
.sprice .inp { min-width: 0; }
.kvs { display: grid; gap: 4px; font-size: 12.5px; }
.kvs > div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.kvs > div > span:first-child { color: var(--text-muted); min-width: 64px; }
.view-seg button { padding: 6px 12px; font-size: 12.5px; }
@media (max-width: 760px) { .demo-bar .view-seg { flex: 0 0 auto; } .demo-bar .view-seg button { padding: 5px 9px; font-size: 12px; } }

/* ===================================================================
   ПЛОТНЕЕ ВЕЗДЕ: мельче кегль, меньше межстрочный интервал и отступы.
   Больше строк на экране — особенно на телефоне.
   =================================================================== */
html { font-size: 14px; }
body { line-height: 1.38; }
p, .lead, .muted, .hint { line-height: 1.42; }
h1 { line-height: 1.08; } h2, h3, h4 { line-height: 1.12; }
.card.pad, .bento-card { padding: 14px 16px; }
.btn { padding: 8px 14px; font-size: 13px; }
.btn.s, .btn-sm { padding: 5px 11px; font-size: 12px; min-height: 30px; }
.inp, select.inp, textarea.inp { padding: 7px 10px; font-size: 13px; }
table.t td, table.t th, .tbl td, .tbl th { padding: 7px 9px; }
.side a { padding: 6px 12px; font-size: 13px; }
.chip, .state, .tag { padding: 3px 9px; font-size: 11.5px; }
button.copy { background: none; border: 1px solid var(--border-subtle); color: var(--primary); border-radius: 999px; padding: 1px 8px; font: inherit; font-size: 11px; cursor: pointer; }

@media (max-width: 560px) {
  html { font-size: 13px; }
  body { font-size: 12.5px; line-height: 1.34; }
  h1 { font-size: clamp(21px, 6.4vw, 26px); }
  h2 { font-size: 16.5px !important; }
  h3 { font-size: 14.5px !important; }
  .lead { font-size: 13px; }
  .muted, .dim, .hint, p.muted { font-size: 12px !important; }
  .sec { padding-top: 20px; padding-bottom: 20px; }
  .card.pad, .bento-card { padding: 11px 12px; border-radius: 14px; }
  .body { padding: 10px !important; gap: 10px !important; }
  .grid, .g2, .g3, .g4 { gap: 8px !important; }
  .btn { padding: 7px 12px; font-size: 12.5px; }
  .btn.s, .btn-sm { padding: 4px 10px; font-size: 11.5px; min-height: 28px; }
  :is(.card, form) :is(input:not([type]), input[type="text"], input[type="email"], input[type="url"], input[type="tel"],
    input[type="search"], input[type="number"], input[type="password"], input[type="date"], input[type="time"],
    input[type="datetime-local"], select, textarea) { padding: 6px 9px; font-size: 12.5px; }
  label.f > span, .micro { font-size: 11px; }
  table.t td, table.t th, .tbl td, .tbl th { padding: 6px 7px; font-size: 12px; }
  .abar { min-height: 46px; padding-top: 4px; padding-bottom: 4px; }
  .abar-ico, .abar-menu { width: 32px !important; height: 32px !important; flex-basis: 32px !important; }
  .abar-title { font-size: 14px; }
  .srow { padding: 6px 10px; gap: 6px; }
  .sname b { font-size: 12.5px; }
  .seg3 span { padding: 3px 8px; font-size: 11px; }
  .sgrp > summary { padding: 8px 10px; font-size: 12.5px; }
}
/* Поле с подписью: подпись вплотную к полю, между полями — только зазор сетки. */
label.f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 0; }
label.f > .hint, label.f > .muted { margin-top: 0; }
.grid > label.f, .g2 > label.f, .g3 > label.f { margin: 0; }
form > label.f + label.f, .card > label.f + label.f { margin-top: 10px; }
@media (max-width: 760px) {
  .demo-bar .brand { display: none; }
  .demo-bar { gap: 6px !important; }
  .demo-bar .try > summary, .demo-bar .demo-buy .btn { padding: 5px 10px; font-size: 12px; min-height: 30px; }
  .demo-bar .demo-buy { gap: 6px !important; }
  .demo-bar #hideBar { width: 30px; padding: 0; justify-content: center; }
}

/* ===================================================================
   Переключатели вместо галочек и ровные группы настроек.
   label.tg / label.chk: поле-переключатель слева, подпись справа, по одному
   в строку — без «разброса» галочек по строке вперемешку с полями.
   =================================================================== */
label.tg, label.chk { display: flex; align-items: center; gap: 10px; min-height: 30px; cursor: pointer; font-size: 13px; color: var(--text-primary); }
label.tg > input[type="checkbox"], label.chk > input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: 0 0 34px; width: 34px; height: 20px; margin: 0; border-radius: 999px;
  background: var(--bg-sunken, #222); border: 1px solid var(--border-strong); position: relative; cursor: pointer; transition: background .18s, border-color .18s; }
label.tg > input[type="checkbox"]::after, label.chk > input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 999px; background: var(--text-secondary); transition: transform .18s, background .18s; }
label.tg > input:checked, label.chk > input:checked { background: var(--primary); border-color: var(--primary); }
label.tg > input:checked::after, label.chk > input:checked::after { transform: translateX(14px); background: #fff; }
label.tg > input:focus-visible, label.chk > input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 22px; }
.set-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.set-title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 650; margin-bottom: 2px; }
/* галочки, которые стоят в ряд с полями, — каждая на своей строке */
.row.wrap > label.chk { flex: 1 1 100%; }

/* Админка: правка живого примера модуля. */
.mdemo { margin-top: 16px; }
.mdemo-g { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; margin-top: 14px; align-items: start; }
.mdemo-tabs { display: flex; gap: 4px; }
.mdemo-tabs button { border: 1px solid var(--border-subtle); background: none; color: var(--text-muted); border-radius: 8px; padding: 6px 11px; font: 600 12px/1 inherit; cursor: pointer; }
.mdemo-tabs button.on { color: var(--text-primary); border-color: var(--accent, #10b981); }
.mdemo-code { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; tab-size: 2; min-height: 260px; }
.mdemo-stage { aspect-ratio: 16 / 10; border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; background: #0f1115; display: flex; justify-content: center; }
.mdemo-stage iframe { width: 100%; height: 100%; border: 0; transition: width .25s; }
@media (max-width: 1100px) { .mdemo-g { grid-template-columns: 1fr; } }

/* Сайт: каталог модулей — карточки с живым примером. */
.mchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.mchips button { border: 1px solid var(--border-subtle); background: var(--bg-surface); color: var(--text-primary); border-radius: var(--radius-pill); padding: 8px 14px; font: 600 13px/1 var(--font-sans); cursor: pointer; transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease); }
.mchips button:hover { border-color: var(--border-strong); }
.mchips button span { color: var(--text-muted); font-weight: 500; margin-left: 4px; }
.mchips button.on { background: var(--primary-soft); border-color: var(--border-active); color: var(--primary); }
.mgroup { margin-bottom: 40px; } .mgroup[hidden] { display: none; }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card.mcard { overflow: hidden; display: flex; flex-direction: column; padding: 0; }
.mprev { aspect-ratio: 16 / 10; background: #0f1115; border-bottom: 1px solid var(--border-subtle); }
.mprev iframe, .mstage iframe { width: 100%; height: 100%; border: 0; display: block; }
.mbody { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 14px 16px 16px; }
.mbody h3 { font-size: 16px; margin: 0; } .mbody h3 a { color: inherit; text-decoration: none; }
.mbody h3 a:hover { color: var(--primary); }
.mbody p { font-size: 13.5px; line-height: 1.45; margin: 0; color: var(--text-secondary); }
.mmore { font-size: 13px; font-weight: 600; margin-top: auto; padding-top: 6px; color: var(--primary); text-decoration: none; }
.mone { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 32px; margin-top: 16px; align-items: start; }
.card.mstage { aspect-ratio: 16 / 10; overflow: hidden; padding: 0; background: #0f1115; }
.mpts { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.mpts li { padding-left: 26px; position: relative; font-size: 14.5px; color: var(--text-secondary); }
.mpts li::before { content: "✓"; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.card.mcode { margin-top: 14px; overflow: hidden; padding: 0; }
.mtabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--border-subtle); align-items: center; }
.mtabs button { border: 0; background: none; color: var(--text-muted); padding: 7px 12px; border-radius: var(--radius-sm); font: 600 13px/1 var(--font-sans); cursor: pointer; }
.mtabs button.on { background: var(--primary-soft); color: var(--primary); } .mtabs .right { margin-left: auto; }
.mcode pre { margin: 0; padding: 14px 16px; max-height: 440px; overflow: auto; font: 12.5px/1.6 var(--font-mono); white-space: pre-wrap; word-break: break-word; color: var(--text-primary); }
@media (max-width: 860px) { .mone { grid-template-columns: 1fr; } }
/* Пример в карточке рисуется в ширину ~600px и уменьшается вдвое — как скриншот, но живой. */
.mprev { position: relative; overflow: hidden; }
.mprev iframe { position: absolute; top: 0; left: 0; width: 180%; height: 180%; transform: scale(.5556); transform-origin: 0 0; }
.mprev iframe { width: 140%; height: 140%; transform: scale(.7143); }
.mcode pre code { background: none; border: 0; padding: 0; display: block; font: inherit; color: inherit; }
.mprev iframe { max-width: none; }
/* Админка шаблона: плитки схем цветов. */
.swrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.swrow span { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border-strong); cursor: pointer; pointer-events: auto; }
.swrow span.on { outline: 2px solid var(--primary); outline-offset: 2px; }
label.tg.sm { font-size: 12px; gap: 6px; margin: 2px 0; white-space: nowrap; }
.modvis { display: grid; gap: 2px; }

/* Размер интерфейса админки: A− / A+ меняют всё пропорционально — текст, отступы, строки. */
body { zoom: var(--admz, 1); }
.zoomctl { display: inline-flex; gap: 2px; }
.zoomctl button { font-weight: 700; letter-spacing: -.02em; min-width: 34px; }

/* Редактор оболочки шаблона. */
.shx { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.shx-form { display: grid; gap: 14px; }
.shx-view { position: sticky; top: 76px; }
.sh-ai { padding: 12px; border-radius: 14px; background: var(--primary-soft); border: 1px solid var(--border-active); }
.sh-sec { border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.sh-sec > summary { cursor: pointer; font-weight: 700; font-size: 15px; margin-bottom: 10px; list-style: none; display: flex; justify-content: space-between; }
.sh-sec > summary::after { content: "▾"; color: var(--text-muted); } .sh-sec:not([open]) > summary::after { content: "▸"; }
.sh-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 10px; }
.sh-colors[hidden] { display: none; }
.shc { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; row-gap: 1px; align-items: center; padding: 7px 9px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface-elevated); }
.shc input[type=color] { grid-row: 1 / 3; width: 30px; height: 30px; padding: 0; border: 1px solid var(--border-strong); border-radius: 8px; background: none; cursor: pointer; }
.shc-t b { font-size: 12.5px; } .shc-n { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-bar { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; bottom: 0; padding: 10px 0 2px; background: var(--bg-surface); }
.sh-mock { --bg: #F5F2EB; --paper: #fff; --ink: #14110C; --ink2: #4F4942; --line: #E0D9CA; --act: #2B5741; --sale: #C2410C; --warm: #E2A827;
  margin-top: 8px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border-subtle); background: var(--bg); color: var(--ink);
  font-family: var(--f-text, system-ui); transition: background .2s, color .2s; }
.mk-h { display: flex; gap: 14px; align-items: center; padding: 12px 14px; background: var(--paper); border-bottom: 1px solid var(--line); font-size: 13px; }
.mk-h b { font-family: var(--f-display, inherit); font-size: 17px; margin-right: auto; } .mk-h span { color: var(--ink2); }
.mk-h i { width: 26px; height: 26px; border-radius: 50%; background: var(--act); }
.mk-hero { padding: 26px 16px; display: grid; gap: 8px; justify-items: start; background: linear-gradient(135deg, color-mix(in srgb, var(--act) 18%, var(--bg)), var(--bg)); }
.mk-hero h2 { margin: 0; font-family: var(--f-display, inherit); font-size: 26px; line-height: 1.15; color: var(--ink); }
.mk-hero p { margin: 0; color: var(--ink2); font-size: 13.5px; }
.mk-btn { background: var(--act); color: var(--paper); padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.mk-promo { background: var(--ink); color: var(--bg); padding: 7px 14px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px; }
.mk-card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 4px; font-size: 12.5px; }
.mk-ph { aspect-ratio: 4 / 3; border-radius: 7px; background: color-mix(in srgb, var(--warm) 25%, var(--line)); }
.mk-price { font-weight: 700; } .mk-price s { color: var(--ink2); font-weight: 400; } .mk-card:nth-child(2) .mk-price { color: var(--sale); }
.sh-stand { margin-top: 8px; height: 620px; border: 1px solid var(--border-subtle); border-radius: 14px; overflow: hidden; display: flex; justify-content: center; background: #000; }
.sh-stand iframe { width: 100%; height: 100%; border: 0; transition: width .25s; background: #fff; }
@media (max-width: 1100px) { .shx { grid-template-columns: 1fr; } .shx-view { position: static; } }
.shx label.shc { display: grid !important; }

/* Редактор элемента библиотеки. */
.ced { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 18px; align-items: start; }
.ced-form { display: grid; gap: 12px; }
.ced-view { position: sticky; top: 76px; }
.ced-stage { margin-top: 8px; height: min(70vh, 620px); border: 1px solid var(--border-subtle); border-radius: 14px; overflow: hidden; background: #0f1115; display: flex; justify-content: center; }
.ced-stage iframe { width: 100%; height: 100%; border: 0; transition: width .25s; }
@media (max-width: 1100px) { .ced { grid-template-columns: 1fr; } .ced-view { position: static; } }
.mcard[hidden], .mgroup[hidden] { display: none !important; }
.gtbl { display: grid; gap: 8px; }
.grow { display: grid; grid-template-columns: 44px minmax(0, 2fr) minmax(0, 1fr) 90px 90px auto; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--border-subtle); border-radius: 12px; }
.grow .gshort { grid-column: 2 / -1; }
.mk-ph { display: grid; place-items: center; font-size: 26px; }
@media (max-width: 700px) { .grow { grid-template-columns: 44px 1fr 1fr; } .grow .gshort { grid-column: 1 / -1; } }
.ced .mdemo-code { font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace !important; white-space: pre; overflow: auto; }
/* Карточка модуля в админке. */
.modcard { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.modcard > aside { position: sticky; top: 76px; }
.modcard .mdemo { margin-top: 0; }
@media (max-width: 1100px) { .modcard { grid-template-columns: 1fr; } .modcard > aside { position: static; } }

/* Сворачиваемые блоки админки loolm.com. */
.fold-h { cursor: pointer; position: relative; padding-right: 30px; user-select: none; }
.fold-h::after { content: ""; position: absolute; right: 6px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); transition: transform .2s; }
.card.folded > .fold-h::after { transform: rotate(-45deg); margin-top: -3px; }
.card.folded > :not(.fold-h):not(input[type=hidden]) { display: none !important; }
.card.folded { padding-bottom: 14px; }
.fold-h:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 8px; }
/* Редакторы меню и главной. */
.mrows { display: grid; gap: 8px; }
.mrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-surface-elevated); }
.mrow .inp { flex: 1 1 160px; min-width: 0; }
.mrow .drag { color: var(--text-muted); letter-spacing: -2px; }
.mbtn { display: inline-flex; gap: 2px; margin-left: auto; }

/* Режим правки сайта (только админ). */
.lm-editbar { position: fixed; left: 14px; bottom: 14px; z-index: 9999; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; max-width: calc(100% - 28px);
  padding: 8px 10px; border-radius: 14px; background: #0b0d12f2; color: #e9edf5; border: 1px solid #2a3140; box-shadow: 0 14px 40px -12px #000; font: 13px/1.3 var(--font-sans); }
.lm-editbar b { color: #34d399; } .lm-editbar span { color: #9aa3b5; } .lm-editbar a { color: #93c5fd; }
.lm-editbar button { border: 0; border-radius: 999px; padding: 7px 12px; background: #10b981; color: #04120c; font: 700 12.5px var(--font-sans); cursor: pointer; }
.lm-editable { outline: 1px dashed #10b98166; outline-offset: 2px; cursor: text !important; border-radius: 3px; }
.lm-editable:hover { outline-color: #10b981; background: #10b98112; }
.lm-editable:focus { outline: 2px solid #10b981; background: #10b9811f; }
.lm-saving { opacity: .6; } .lm-saved { outline: 2px solid #22c55e !important; } .lm-err { outline: 2px solid #ef4444 !important; }
.demo-bar .btn, .demo-bar summary { white-space: nowrap; } @media (max-width: 420px) { .demo-bar { gap: 6px; } .demo-bar .seg button { padding-inline: 9px; } }
@media (max-width: 440px) { .hide-xs { display: none !important; } }
.pb-lang{display:inline-flex;gap:2px;border:1px solid var(--border-subtle);border-radius:99px;padding:2px}.pb-lang a{padding:4px 9px;border-radius:99px;font-size:12px;font-weight:600;color:var(--text-secondary);text-decoration:none;text-transform:uppercase}.pb-lang a.on{background:var(--primary-soft);color:var(--text-primary)}

/* Миниатюры страниц — блочные, обрезаются по своему краю (fit.js подгоняет масштаб). */
.pbd-prev, .kit-prev, .kt-prev, .ns-prev, .kb-prev, .pgx-prev, [data-fit] { display: block; position: relative; overflow: hidden; }
.ns-kit { display: flex !important; flex-direction: column; }

/* Нажатие и наведение повторяют форму кнопки: без прямоугольной подсветки касания. */
a, button, label, summary, [role="button"], .btn, .pill, .tag, .chip { -webkit-tap-highlight-color: transparent; }
.btn, .pill, .chip, .seg button, .navpill a { outline-offset: 2px; }
.btn:focus-visible, .pill:focus-visible, .chip:focus-visible, .seg button:focus-visible, .navpill a:focus-visible { outline: 2px solid var(--primary); }
.btn:active, .pill:active, .chip:active { filter: brightness(.94); transform: translateY(0); }
.btn::-moz-focus-inner { border: 0; }

/* Стрелка сворачивания блока — на строке заголовка, справа, не поверх текста. */
.fold-h { padding-right: 34px !important; }
.fold-h::after { top: .9em !important; margin-top: -5px !important; right: 8px !important; }

/* Подменю в шапке сайта: на компьютере — по наведению и фокусу, на телефоне — по стрелке. */
.nav-dd { position: relative; display: inline-flex; align-items: center; }
.nav-dd > a { padding-right: 4px !important; }
.nav-dd-t { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 4px; border: 0; border-radius: 999px; background: none; color: inherit; cursor: pointer; transition: transform .2s, background .2s; }
.nav-dd-t:hover { background: var(--bg-surface-elevated); }
.nav-dd-m { position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; max-height: 70vh; overflow: auto; display: grid; gap: 2px; padding: 6px; border: 1px solid var(--border-subtle); border-radius: 16px; background: var(--bg-surface); box-shadow: 0 18px 50px rgba(0,0,0,.18); z-index: 80; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .16s, transform .16s, visibility .16s; }
.nav-dd-m::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.nav-dd-m a { display: block; padding: 8px 12px !important; border-radius: 10px; white-space: nowrap; }
.nav-dd-sub { display: flex; width: 100%; } .nav-dd-sub > a { flex: 1; } .nav-dd-sub > .nav-dd-m { top: -6px; left: calc(100% + 4px); }
@media (hover: hover) and (min-width: 761px) {
  .nav-dd:hover > .nav-dd-m, .nav-dd:focus-within > .nav-dd-m { opacity: 1; visibility: visible; transform: none; }
  .nav-dd:hover > .nav-dd-t { transform: rotate(180deg); }
}
.nav-dd.open > .nav-dd-m { opacity: 1; visibility: visible; transform: none; }
.nav-dd.open > .nav-dd-t { transform: rotate(180deg); }
@media (max-width: 760px) {
  .navpill.open { max-height: calc(100vh - 90px); overflow: auto; }
  .navpill > a, .nav-dd > a, .nav-dd-m a { text-align: left; justify-content: flex-start; }
  .nav-dd { display: grid; grid-template-columns: 1fr auto; width: 100%; }
  .nav-dd-t { width: 36px; height: 36px; }
  .nav-dd-m, .nav-dd-sub > .nav-dd-m { position: static; grid-column: 1 / -1; min-width: 0; max-height: none; box-shadow: none; border: 0; padding: 0 0 0 14px; background: none; display: none; opacity: 1; visibility: visible; transform: none; }
  .nav-dd.open > .nav-dd-m { display: grid; }
}
