/* tsp — интерфейс. Без сборки: переменные для тем, системный шрифт, адаптив до ширины телефона.
   Модули static/css склеиваются по порядку имён в один app.css (web/assets.go): каскад — как в
   одном файле, новое правило — в модуль своей темы, переопределение — в модуле после него. */

:root {
  color-scheme: light;
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --surface-3: #e7e6e2;
  --border: #e2e1dc;
  --border-strong: #cfcdc6;
  --text: #17171a;
  --muted: #6b6a66;
  --accent: #2a78d6;
  --accent-hover: #1f66bd;
  --accent-soft: #e6f0fb;
  --accent-ink: #ffffff;
  --on-status: #ffffff; /* текст на заливке --ok/--warn */
  --ok: #1b7f4b;
  --ok-soft: #e3f4ea;
  --warn: #9a6100;
  --warn-soft: #fbf0d9;
  --err: #c0362c;
  --err-soft: #fbe6e3;
  --chart: #2a78d6;
  --chart-area: rgba(42, 120, 214, .12);
  --chart-2: #e08a1e;
  --chart-3: #8a63c9;
  --chart-4: #c94f7c;
  --grid: #e2e1dc;
  --shadow: 0 1px 2px rgba(20, 20, 18, .05), 0 2px 8px rgba(20, 20, 18, .04);
  --toast-shadow: 0 8px 24px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .08);
  --radius: 12px;
  --radius-sm: 8px;
  --pill: 999px; /* пилюля: скругление «до конца» у чипов, бейджей, переключателей */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121212;
    --surface: #1b1b1a;
    --surface-2: #232322;
    --surface-3: #2d2d2b;
    --border: #2f2f2d;
    --border-strong: #42423f;
    --text: #f0efec;
    --muted: #a3a29b;
    --accent: #3987e5;
    --accent-hover: #5b9de9;
    --accent-soft: #1a2c44;
    --accent-ink: #ffffff;
    --on-status: #ffffff; /* текст на заливке --ok/--warn */
    --ok: #4cc283;
    --ok-soft: #173325;
    --warn: #e2a63b;
    --warn-soft: #3a2c12;
    --err: #ef7469;
    --err-soft: #3d1c19;
    --chart: #3987e5;
    --chart-area: rgba(57, 135, 229, .18);
    --chart-2: #f0a140;
    --chart-3: #a585e0;
    --chart-4: #e27fa5;
    --grid: #33332f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --toast-shadow: 0 8px 28px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
h3.sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.2em 0 .6em; }
p { margin: 0 0 .8em; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.err-text { color: var(--err); }
.warn-text { color: var(--warn); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


/* ---------- Каркас ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.logo { width: 22px; height: 22px; color: var(--accent); }
.spacer { flex: 1; }
.admin-name { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30vw; }
.admin-name:hover, .admin-name.active { color: var(--text); text-decoration: none; }
/* Профиль значком — только на узком, где имя в шапке не помещается (40-adaptive.css). */
.topbar .profile-link { display: none; }
.topbar .profile-link.active { background: var(--accent-soft); color: var(--accent); }
.role-chip { display: inline-block; font-size: .72rem; padding: 1px 7px; border-radius: var(--pill); background: var(--surface-2); color: var(--muted); font-weight: 500; vertical-align: middle; }
form.inline { display: inline; margin: 0; }
.platform-nav { display: flex; align-items: center; gap: 2px; }
/* Подписи ссылок платформы — только когда шапка их вмещает (класс ставит скрипт, 10-ui.js):
   место зависит от названия пространства и имени, порогом ширины окна не угадать. */
.platform-nav .platform-link span { display: none; }
.topbar.nav-labels .platform-nav .platform-link span { display: inline; }
.platform-menu { display: none; }
.platform-menu > summary.active { background: var(--accent-soft); color: var(--accent); }
.menu .platform-link { display: flex; justify-content: flex-start; gap: 10px; min-height: 0; padding: 8px 10px; border: 0; font-size: .95rem; font-weight: 500; }
.menu .platform-link span { display: inline; }
.menu .platform-link.active { background: var(--accent-soft); color: var(--accent); }

.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.shell.no-nav { grid-template-columns: minmax(0, 1fr); }
.sidenav {
  position: sticky; top: 56px; align-self: start; height: calc(100vh - 56px);
  display: flex; flex-direction: column; gap: 2px; padding: 16px 10px;
  border-right: 1px solid var(--border); background: var(--surface); overflow-y: auto;
}
.navlink {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--radius-sm); color: var(--text); font-weight: 500;
}
.navlink:hover { background: var(--surface-2); text-decoration: none; }
.navlink.active { background: var(--accent-soft); color: var(--accent); }
.icon { width: 18px; height: 18px; flex: none; }
.nav-sep { height: 1px; background: var(--border); margin: 8px 6px; }
.main { padding: 24px 28px 64px; max-width: 1280px; width: 100%; }

/* ---------- Шапки страниц ---------- */
.page-head { margin-bottom: 20px; }
.page-head p { max-width: 70ch; }
.page-head.row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.crumbs { margin-bottom: 8px; font-size: .9rem; }
.crumbs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- Карточки ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 20px; min-width: 0;
}
.card.narrow { max-width: 560px; }
.ws-note { max-width: 560px; }
.card-head, .limit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.link-more { font-size: .88rem; white-space: nowrap; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.cols > .card { margin-bottom: 0; }

/* ---------- Кнопки и формы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 6px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger, .menu-item.danger { color: var(--err); }
.btn.danger:not(.ghost) { border-color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { min-height: 30px; padding: 3px 10px; font-size: .88rem; }
.btn.big { min-height: 48px; padding: 10px 22px; font-size: 1.05rem; }
.btn .icon { width: 16px; height: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row form { margin: 0; }
.push-right { margin-left: auto; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }

label { display: block; font-weight: 550; font-size: .92rem; }
label > input, label > select, label > textarea { display: block; margin-top: 5px; }
.check > input { display: inline-block; margin: 0; flex: none; }
.inline-field > input, .inline-field > select { display: inline-block; }
.label { font-weight: 550; font-size: .92rem; margin-bottom: 6px; }
label .muted, label .hint { font-weight: 400; }
.hint { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; font-weight: 400; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 10px; min-height: 36px; width: 100%; min-width: 0;
}
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); margin: 0; }
input[type=file] { padding: 6px; background: var(--surface-2); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled { opacity: .75; }
legend { font-weight: 550; font-size: .92rem; padding: 0; margin-bottom: 6px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > form { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 14px; }
.check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
.check.top { align-items: flex-start; }
.radios { display: flex; flex-direction: column; gap: 6px; }
.radios .check { display: block; }
.radios .check > input { margin-right: 8px; vertical-align: -1px; }
.pad-top { padding-top: 26px; }
.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border-strong); }
.code-input { font-size: 1.4rem; letter-spacing: .3em; font-family: var(--mono); max-width: 220px; }

/* ---------- Сообщения ---------- */
/* Тосты — итог действия поверх страницы, ничего не сдвигают: справа сверху под шапкой, на
   телефоне — во всю ширину. z-index 25: над полосой разделов (20), под шапкой с её меню (30) и
   под меню, шторками и капчей (60); пока открыто окно #modal, стопка живёт в нём (app.js). Пустая
   стопка нулевой высоты и пропускает клики. */
#flash-area {
  position: fixed; inset: 68px 16px auto auto; z-index: 25; width: min(400px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
body.bare #flash-area { top: 16px; }
.toast {
  position: relative; overflow: hidden; pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 40px 12px 14px;
  border: 1px solid; border-radius: var(--radius-sm); color: var(--text); box-shadow: var(--toast-shadow);
  animation: toast-in .18s ease-out;
}
.toast > .icon { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.toast-text { flex: 1; min-width: 0; max-height: 40vh; overflow-y: auto; overflow-wrap: anywhere; line-height: 1.45; }
.toast-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-weight: 600; }
.toast-close {
  position: absolute; top: 8px; right: 8px; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  background: none; border: 0; border-radius: var(--radius-sm); font-size: 1.25rem; line-height: 1; cursor: pointer; color: var(--muted);
  outline-offset: -2px;
}
.toast-close:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.toast-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.toast-ok > .icon { color: var(--ok); }
.toast-error { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.toast-error > .icon { color: var(--err); }
.toast-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.toast-info > .icon { color: var(--accent); }
.toast-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.toast-warn > .icon { color: var(--warn); }
/* Таймер успеха: полоска тает за --toast-ms (app.js — по длине текста); наведение, фокус и
   вкладка в фоне его останавливают; конец анимации убирает тост. */
.toast-timer {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px; transform-origin: left;
  background: color-mix(in srgb, var(--ok) 55%, transparent);
  --toast-ms: 6s; animation: toast-timer var(--toast-ms) linear forwards;
}
.toast:hover .toast-timer, .toast:focus-within .toast-timer, html.tab-away .toast-timer { animation-play-state: paused; }
.toast.out { opacity: 0; transform: translateX(16px); transition: opacity .18s, transform .18s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-timer { to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast.out { transition: none; }
}
@media print { #flash-area { display: none; } }
.alert > span { min-width: 0; overflow-wrap: anywhere; }
.alert {
  display: flex; align-items: flex-start; gap: 10px; justify-content: space-between;
  padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid;
  transition: opacity .4s;
}
.alert.fade { opacity: 0; }
.alert-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.alert-error { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.alert-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.alert-close { background: none; border: 0; font-size: 1.2rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 2px; }

/* ---------- Значки ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--pill);
  font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted);
}
.badge.on, .ps-sent, .js-done, .as-active { background: var(--ok-soft); color: var(--ok); }
.ps-planned, .ps-sending, .js-queued, .js-running { background: var(--accent-soft); color: var(--accent); }
.ps-scheduled { background: var(--accent-soft); color: var(--accent); }
.ps-failed, .js-failed { background: var(--err-soft); color: var(--err); }
.as-needs_login, .as-revoked, .ps-unknown, .badge.paused { background: var(--warn-soft); color: var(--warn); }
.ps-cancelled, .as-disabled, .badge.off { background: var(--surface-2); color: var(--muted); }
.score-chip {
  display: inline-block; font-family: var(--mono); font-size: .8rem; font-weight: 600;
  padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent);
}
.chip {
  display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 10px; border-radius: var(--pill);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: .84rem; cursor: pointer;
}
.chip:hover { background: var(--surface-2); }
.count { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: var(--pill); background: var(--surface-3); color: var(--muted); font-size: .76rem; font-weight: 600; text-align: center; }

.spinner {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------- Выпадающие меню ---------- */
details.dropdown { position: relative; }
details.dropdown > summary { list-style: none; cursor: pointer; }
details.dropdown > summary::-webkit-details-marker { display: none; }
details.dropdown .menu {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 240px; max-width: min(360px, 90vw);
  max-height: 60vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .14); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
details.dropdown.right .menu { left: auto; right: 0; }
.menu a, .menu-item {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--text);
  background: none; border: 0; font: inherit; cursor: pointer;
}
.menu a:hover, .menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu a[aria-current] { background: var(--accent-soft); color: var(--accent); }
.menu a small { color: var(--muted); }
.menu .menu-foot { border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 6px 6px; color: var(--accent); }
.menu form { margin: 0; }
.menu-form { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 4px 0; }
.small-label { font-size: .8rem; color: var(--muted); }

.ws-switch > summary {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); max-width: 42vw;
}
.ws-switch > summary:hover { background: var(--surface-2); }
.ws-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-switch > summary::after { content: "▾"; color: var(--muted); font-size: .8em; }


/* ---------- Обзор ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 14px; margin-bottom: 20px; }
.tile {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; color: var(--text); box-shadow: var(--shadow);
}
.tile:hover { text-decoration: none; border-color: var(--border-strong); }
.tile-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tile-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile-of { font-size: 1.1rem; color: var(--muted); font-weight: 500; }
.tile-sub { font-size: .84rem; color: var(--muted); }
.tile-warn { border-color: var(--warn); }
.tile-err { border-color: var(--err); }
.onboarding .steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.step { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.step-mark { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-strong); font-weight: 700; font-size: .85rem; }
.step.done .step-mark { background: var(--ok); color: var(--on-status); border-color: var(--ok); }
.step.done a { color: var(--muted); }
.quick { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Пустые состояния ---------- */
.empty { text-align: center; padding: 40px 20px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); margin-bottom: 20px; }
.empty.slim { padding: 28px 20px; }
.empty-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }
.empty-icon .icon { width: 26px; height: 26px; }
.empty p { color: var(--muted); max-width: 52ch; margin: 0 auto 14px; }

/* ---------- Фильтры и лента ---------- */
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-row .grow { flex: 1 1 220px; width: auto; }
/* Длинные подписи вариантов (цели с платформой) не раздвигают фильтр шире экрана. */
.inline-field { display: flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 500; font-size: .88rem; color: var(--muted); white-space: nowrap; max-width: 100%; min-width: 0; }
.inline-field input, .inline-field select { width: auto; min-height: 32px; padding: 4px 8px; color: var(--text); margin-top: 0; }
.inline-field input[size] { width: 7.5em; }
.inline-field input[type="number"] { width: 5.5em; }
.inline-field input[type="checkbox"] { min-height: 0; }
.filters-more > summary { display: none; }
.inline-field select { min-width: 0; max-width: 100%; flex: 0 1 auto; text-overflow: ellipsis; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg label { display: flex; font-weight: 500; font-size: .88rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { padding: 6px 12px; cursor: pointer; border-left: 1px solid var(--border); }
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.checklist { display: flex; flex-direction: column; gap: 2px; }
.checklist .check { padding: 6px 8px; border-radius: 6px; }
.checklist .check:hover { background: var(--surface-2); }
.checklist.inline { flex-direction: row; flex-wrap: wrap; gap: 4px 14px; }
.checklist.inline .check { padding: 2px 0; }
.dropdown.multi > summary .count { background: var(--accent); color: var(--accent-ink); }

.results { transition: opacity .15s; }
.results.htmx-request { opacity: .5; }
.results-head { margin-bottom: 10px; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 16px; }
/* Лента «как в Telegram»: пузыри разной высоты — колонками, без дыр сетки. */
.post-grid.tg { display: block; columns: 360px; column-gap: 16px; }
.post-card.tg { break-inside: avoid; margin: 0 0 16px; padding: 10px 12px; gap: 6px; }
.post-card.tg .tg-bubble { margin: 0; }
.post-card.tg .tg-bubble .post-rich { max-height: 360px; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 300px, transparent); mask-image: linear-gradient(#000 300px, transparent); }
.post-card.tg .post-head { align-items: center; }
.post-badges { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; flex: none; }
.post-card.tg .post-ch { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-panel-head .alert-close { margin-left: auto; }
.post-card.tg .pub-badge { position: static; }
.post-card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); min-width: 0;
}
.post-card:hover { border-color: var(--border-strong); }
img.real.broken { visibility: hidden; }
.pub-badge {
  position: absolute; top: 8px; padding: 2px 8px; border-radius: var(--pill); font-size: .74rem; font-weight: 600;
  background: rgba(0, 0, 0, .58); color: #fff; backdrop-filter: blur(4px);
}
.pub-badge { right: 8px; }
.pub-badge.ps-sent { background: var(--ok); color: var(--on-status); }
.pub-badge.ps-planned, .pub-badge.ps-scheduled, .pub-badge.ps-sending { background: var(--accent); color: var(--accent-ink); }
.pub-badge.ps-unknown { background: var(--warn); color: var(--on-status); }
.post-head { display: flex; justify-content: space-between; gap: 8px; font-size: .84rem; }
.post-ch, .job-ch { font-weight: 600; display: flex; align-items: center; gap: 6px; min-width: 0; }
/* Имя канала, которое обрезается, — в .ch-name, метка платформы рядом не обрезается. */
.ch-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-ch .badge, .job-ch .badge { flex: none; }
.post-ch.big { font-size: 1.05rem; }
.post-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .84rem; color: var(--muted); }
.post-foot .score-chip { margin-left: auto; }
.metric { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.micon { width: 14px; height: 14px; opacity: .7; }

.pagination { display: flex; gap: 4px; justify-content: center; margin: 22px 0 4px; flex-wrap: wrap; }
.pagination .page, .pagination .gap { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-sm); padding: 0 8px; }
.pagination .page { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.pagination .page:hover { background: var(--surface-2); text-decoration: none; }
.pagination .current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Карточка поста ---------- */
.post-detail, .rule-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.post-full-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.post-rich { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1rem; line-height: 1.6; }
.post-rich.small { font-size: .9rem; line-height: 1.5; }
.post-rich blockquote { margin: .4em 0; padding: .2em 0 .2em 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 6px 6px 0; }
.post-rich pre { background: var(--surface-2); padding: 10px 12px; border-radius: 6px; overflow-x: auto; white-space: pre; margin: .4em 0; }
.post-rich code { background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.post-rich pre code { background: none; padding: 0; }
.post-rich .hashtag { color: var(--accent); }
.post-rich .link-off { text-decoration: underline dotted; }
.spoiler { background: var(--text); color: transparent; border-radius: 3px; cursor: pointer; transition: color .2s, background .2s; }
.spoiler.revealed, .spoiler:focus { background: var(--surface-3); color: inherit; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.metric-big { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-big.accent { color: var(--accent); font-family: var(--mono); }
.reactions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.reactions li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; }
.r-emoji { font-size: 1.1rem; text-align: center; }
.r-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.r-bar span { display: block; height: 100%; background: var(--chart); border-radius: 4px; }
.r-count { font-variant-numeric: tabular-nums; font-size: .88rem; color: var(--muted); }
.when-at { display: none; padding-left: 12px; border-left: 2px solid var(--accent-soft); }
#publish-form:has(input[name=when][value=at]:checked) .when-at,
#publish-box:has(input[name=when][value=at]:checked) .when-at { display: flex; }
.caption-box { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.caption-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.caption-box .post-rich { max-height: 260px; overflow-y: auto; }
.caption-foot { margin-top: 6px; }
#publish-result:empty { display: none; }

/* ---------- Графики ---------- */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 16px 20px; }
.charts-stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px 28px; }
.chart { margin: 0; min-width: 0; }
.chart figcaption { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.chart-title { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.chart-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-delta { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .grid.dashed { stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart.wide .axis { font-size: 12px; }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart-area); stroke: none; }
.chart .bar { fill: var(--chart); }
.chart .bar-2 { fill: var(--chart-2); }
.chart .bar-3 { fill: var(--chart-3); }
.chart .bar-4 { fill: var(--chart-4); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.chart-legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: var(--chart); }
.chart-legend .swatch.bar-2 { background: var(--chart-2); }
.chart-legend .swatch.bar-3 { background: var(--chart-3); }
.chart-legend .swatch.bar-4 { background: var(--chart-4); }
.chart .dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; stroke: none; cursor: crosshair; }
.chart .hit:hover { fill: var(--chart-area); }
.chart-empty { padding: 20px 0; }

/* ---------- Таблицы ---------- */
.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td .badge { margin: 0 4px 4px 0; }
.actions-col { text-align: right; width: 1%; white-space: nowrap; }
.actions-col .btn-row { justify-content: flex-end; flex-wrap: nowrap; }
tr.is-off td:not(.actions-col) { opacity: .6; }


/* ---------- Списки задач и публикаций ---------- */
.job-list, .pub-list, .mini-list, .slots, .plan, .seen-chats, .note-list { list-style: none; margin: 0; padding: 0; }
.job { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.job:last-child { border-bottom: 0; }
.job-progress { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.job-msg { grid-column: 2 / 4; color: var(--muted); font-size: .84rem; }
.job-msg:empty { display: none; }
.job time { grid-column: 3; grid-row: 1; font-size: .82rem; }
.job .job-progress { grid-column: 2; justify-self: start; }
.job:has(.job-ch) .job-progress { grid-column: auto; }
.job:has(.job-ch) time { grid-column: 4; }
.job:has(.job-ch) { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.job:has(.job-ch) .job-msg { grid-column: 2 / 5; }

.pub-row, .post-mini { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.pub-row:last-child, .post-mini:last-child { border-bottom: 0; }
.mini-thumb { flex: none; width: 56px; height: 56px; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ph { color: var(--muted); font-size: 1.3rem; }
.mini-body { flex: 1; min-width: 0; }
.mini-text { display: block; color: var(--text); font-size: .92rem; overflow-wrap: anywhere; }
.mini-text a { color: var(--text); }
.mini-meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; margin-top: 3px; }
/* Действие строкой в мета-строке («не удалять»): вид ссылки, поле нажатия — под палец. */
.keep-form { display: inline; }
.link-btn { background: none; border: 0; padding: 6px 4px; margin: -6px -4px; font: inherit; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
@media (pointer: coarse) { .link-btn { display: inline-flex; align-items: center; min-height: 36px; margin-block: 0; } }
.pub-pick { flex: none; width: 18px; margin-top: 4px; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.bulk-bar .bulk-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
details.dropdown.bulk-retext .menu { width: min(360px, calc(100vw - 32px)); max-width: none; }
.pub-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pub-row .tg-bubble, .pub-cap .tg-bubble { max-width: 460px; }
.tg-note { margin: 2px 0 0; }
.ai-status { display: flex; align-items: center; gap: 6px; color: var(--accent); margin: 0; }

/* Медиа поста «как в Telegram»: мозаика альбома (раскладка t.me), видео, длительность. */
.tgm { position: relative; width: calc(100% + 20px); margin: -8px -10px 8px; background: var(--surface-2); }
.tgm-i { position: absolute; overflow: hidden; }
.tgm-i img, .tgm-i video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tgm-dur { position: absolute; left: 6px; top: 6px; padding: 1px 6px; border-radius: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; pointer-events: none; }
.tgm-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 28px; text-shadow: 0 1px 6px rgba(0,0,0,.6); pointer-events: none; }
.tgm-one { margin: -8px -10px 8px; position: relative; min-height: 120px; }
.tgm-one img { width: 100%; max-height: 520px; object-fit: cover; display: block; }

/* Капча входа VK: модалка поверх шага визарда (без JS — работает и при PRG-перерисовке). */
.captcha-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
/* margin:auto центрирует бокс, когда места хватает, и позволяет доскроллить к верху, когда нет
   (клавиатура на узком экране) — flex-центрирование само обрезало бы верх без прокрутки. */
.captcha-box { width: 100%; max-width: 360px; margin: auto; }
.captcha-box h2 { margin-top: 0; }
.captcha-retry { margin: 0 0 8px; color: var(--err); font-size: .9rem; }
.captcha-steps { margin: 0 0 10px; padding-left: 1.2em; }
.captcha-steps li { margin: 4px 0; }
.captcha-steps code { overflow-wrap: anywhere; }
/* Кнопка-закладка: её перетаскивают на панель закладок, поэтому она выглядит как ярлык, а не
   обычная кнопка (клик по ней на странице tsp только подсказывает перетащить). */
.bookmarklet { display: inline-block; padding: 7px 12px; border: 1px dashed var(--border); border-radius: 6px;
  background: var(--surface-2); color: var(--text); font-weight: 600; text-decoration: none; cursor: grab; }
.bookmarklet:active { cursor: grabbing; }
.captcha-manual { margin: 8px 0 0; }
.captcha-manual summary { cursor: pointer; color: var(--muted); }
/* Строка «ждём ответ»: видимый знак, что окно слушает ответ капчи, а не зависло. */
.captcha-wait { margin: 10px 0 0; font-style: italic; }
.captcha-img { display: block; margin: 10px 0 12px; max-width: 100%; border: 1px solid var(--border); border-radius: 6px; background: #fff; }

/* Модальное окно (правка строки очереди). */
dialog.modal { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0; width: min(640px, calc(100vw - 32px));
  background: var(--surface); color: inherit; box-shadow: 0 16px 48px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(0,0,0,.4); }
#modal-body { padding: 16px; }
#modal-err:empty { display: none; }
.tg-draft { opacity: .55; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
/* Длинный значок-причина (строка очереди ждёт) — переносится, а не раздвигает строку на телефоне. */
.badge.wrap { white-space: normal; max-width: 100%; }
.badge.err { color: var(--err); }
.tg-bubble[data-href] { cursor: pointer; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-head h3 { margin: 0; }

/* Панель «нейросеть обрабатывает». */
.ai-panel { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; background: var(--surface); }
.ai-panel-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-panel p { margin: 6px 0 0; }
.progress { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: 8px; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.pub-edit-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.pub-edit-form textarea, .pub-edit-form input, .pub-edit-form select { width: 100%; }
.pub-edit-form .row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pub-cap .tg-bubble .post-rich { max-height: 420px; overflow: auto; }
.pub-src { margin-top: 6px; }
.pub-side { display: flex; align-items: center; gap: 6px; flex: none; }

/* ---------- Правила ---------- */
.rule-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 16px; }
.rule-card { margin: 0; display: flex; flex-direction: column; gap: 10px; }
/* Выключенное: блёкнут фраза и слоты; имя, бейдж и «Включить» — в полную яркость (их ищут глазами). */
.rule-card.is-off .rule-sentence, .rule-card.is-off .rule-next { opacity: .7; }
.rule-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.rule-head h3 { margin: 0 0 2px; font-size: 1.08rem; }
.rule-card footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
/* Карточка списка: правило фразой (как «Итог» формы), одна плашка состояния и «ещё N» свёрнутым. */
.rule-card .rule-sentence { font-size: .95rem; line-height: 1.6; }
.rule-card .rule-sentence a { font-weight: 500; }
.rule-card .rule-targets { overflow-wrap: anywhere; }
.rule-card > .alert, .rule-card > .prep-row, .rule-card > p.small { margin: 0; }
.rule-more > summary { cursor: pointer; color: var(--muted); font-size: .88rem; }
.rule-more > summary:hover { color: var(--text); }
.rule-more[open] { display: flex; flex-direction: column; gap: 8px; }
.rule-more > :not(summary) { margin: 0; }
.rule-next { margin: 0; overflow-wrap: anywhere; }
.alert-more { margin-top: 4px; font-size: .88rem; }
.alert-more > summary { cursor: pointer; font-weight: 600; }
.alert-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.alert-body p { margin: 0; }
.menu-item:has(.menu-note) { flex-direction: column; align-items: flex-start; gap: 0; }
.menu-note { display: block; color: var(--muted); font-size: .8rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
code.cron { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
/* scroll-margin-top: «Предпросмотр» с панели не прячет карточку под шапку. */
.rule-preview-card { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; scroll-margin-top: 120px; }
.rule-preview-card .card-head h2 { margin: 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Форма из секций (правило) ---------- */
.rule-form > fieldset { gap: 16px; }
.form-section { margin: 0; display: flex; flex-direction: column; gap: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.section-head h2 { margin: 0 0 2px; }
.section-desc { margin: 0; color: var(--muted); font-size: .85rem; font-weight: 400; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
/* Расписание: поле и готовые строки слева, расшифровка справа; на узком — расшифровка сразу под полем. */
.schedule { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-areas: "input describe" "extras describe"; gap: 16px 20px; align-items: start; }
.schedule .sched-input { grid-area: input; }
.schedule .sched-extras { grid-area: extras; }
.schedule .cron-describe { grid-area: describe; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.schedule .cron-describe > :last-child { margin-bottom: 0; }
.checklist.pills { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.checklist.pills .check { min-width: 0; overflow-wrap: anywhere; padding: 5px 12px; border: 1px solid var(--border-strong); border-radius: var(--pill); font-size: .88rem; }
.checklist.pills .check:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
/* Причина ухода (кабинет «Тариф»): необязательный выбор; строка «другое» — только при «Другое». */
.leave-reason { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.leave-reason legend { padding: 0; margin-bottom: 8px; }
.leave-reason legend .muted { font-weight: 400; }
.leave-reason:not(:has(input[value=other]:checked)) .leave-text { display: none; }
.leave-off > summary { list-style: none; }
.leave-off > summary::-webkit-details-marker { display: none; }
.leave-off .on-open, .leave-off[open] .on-closed { display: none; }
.leave-off[open] .on-open { display: inline; }
.leave-off[open] { flex-basis: 100%; }
.leave-form { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.leave-form p { margin: 0; }
/* Оформление правила — строка на каждую цель: название с платформой, рядом выбор. */
.rule-decor, .keep-list { display: flex; flex-direction: column; gap: 8px; }
.rule-decor-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 4px 12px; align-items: center; }
.rule-decor-name { overflow-wrap: anywhere; }
@media (max-width: 600px) { .rule-decor-row { grid-template-columns: minmax(0, 1fr); } }
/* Число и единица в одном поле фильтра («не моложе 12 часов»). */
/* В узкой колонке единица уходит под число, а не сжимает его. */
.with-unit { display: flex; flex-wrap: wrap; gap: 6px; }
.with-unit input { flex: 1 1 4.5em; min-width: 4.5em; }
.with-unit select { flex: 1 0 auto; width: auto; }
/* «Выравнивание источников» правила: таблица источник · множитель · просмотров от · окно (не моложе,
   не старше), предложения
   подбора у полей, карточка выводов над таблицей. Узкая ФОРМА (а не экран: на ноутбуке её сужает
   колонка предпросмотра) — строка-карточка: контейнерный запрос по .tune-box. */
.tune-box { container-type: inline-size; }
.tune-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tune-head .hint { margin: 0; max-width: 62ch; }
.tune-head .btn { flex: none; }
.tune-table { display: flex; flex-direction: column; margin: 10px 0 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tune-row { display: grid; grid-template-columns: minmax(0, 1fr) 9.5rem 11rem 7.5rem 7.5rem; gap: 12px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); }
.tune-row:first-child { border-top: 0; }
.tune-row[hidden] { display: none; }
.tune-th { color: var(--muted); font-size: .85em; padding-top: 6px; padding-bottom: 6px; background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tune-name { min-width: 0; overflow-wrap: anywhere; }
.tune-subs { white-space: nowrap; }
.tune-cell > label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; }
.tune-cell input { width: 6.5em; flex: none; }
.tune-age input { width: 5em; }
.tune-label { display: none; }
.tune-suggest { color: var(--accent); font-size: .9em; white-space: nowrap; }
.tune-suggest.applied { color: var(--ok); }
.tune-suggest.applied::before { content: "✓ "; }
.rule-tune.no-weights .tune-w { display: none; }
.rule-tune.no-weights .tune-row { grid-template-columns: minmax(0, 1fr) 11rem 7.5rem 7.5rem; }
/* «Вечнозелёное»: у источника нет своего «не старше» — период общий; тексты — свои у режима */
.rule-tune.evergreen .tune-max, .rule-tune.evergreen .only-fresh, .rule-tune:not(.evergreen) .only-ever { display: none; }
.rule-tune.evergreen .tune-row { grid-template-columns: minmax(0, 1fr) 9.5rem 11rem 7.5rem; }
.rule-tune.evergreen.no-weights .tune-row { grid-template-columns: minmax(0, 1fr) 11rem 7.5rem; }
.tune-result { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface); border-radius: var(--radius-sm); padding: 10px 14px; margin-top: 10px; }
.tune-context { margin: 0 0 6px; color: var(--muted); font-size: .9em; }
.tune-notes { margin: 0 0 8px; padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; }
.tune-result .btn-row { margin: 0; }
.tune-share { margin: 0 0 10px; }
.tune-share p { margin: 0 0 6px; }
.tune-share-table th, .tune-share-table td { padding: 6px 8px; }
.tune-share-table td:first-child { overflow-wrap: anywhere; }
@container (max-width: 900px) {
  .tune-head { flex-direction: column; align-items: stretch; }
  .tune-th { display: none; }
  .tune-table { border-top: 0; }
  /* строка-карточка: имя, под ним поля в один ряд (у формы рядом с предпросмотром — 4 по ~120 px) */
  .tune-row, .tune-row:first-child { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 12px; align-items: start; border-top: 1px solid var(--border); }
  .rule-tune.no-weights .tune-row, .rule-tune.evergreen .tune-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rule-tune.evergreen.no-weights .tune-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tune-name { grid-column: 1 / -1; }
  .tune-cell > label { flex-direction: column; align-items: stretch; gap: 2px; }
  .tune-cell input { width: 100%; }
  .tune-label { display: block; color: var(--muted); font-size: .85em; }
  .tune-suggest { white-space: normal; }
}
@container (max-width: 480px) {
  /* телефон: поля по два в ряд; без множителя порог — во всю ширину, окно — вторым рядом */
  .tune-row, .tune-row:first-child, .rule-tune.no-weights .tune-row, .rule-tune.evergreen .tune-row,
  .rule-tune.evergreen.no-weights .tune-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rule-tune.no-weights:not(.evergreen) .tune-cell:not(.tune-w, .tune-age) { grid-column: 1 / -1; }
}
.score-chip.weighted { font-weight: 400; }
.score-chip.weighted b { font-weight: 700; }
/* Выключатель: чекбокс выглядит тумблером, подпись рядом. */
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 36px; height: 20px; border-radius: var(--pill); background: var(--muted); transition: background .15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Варианты карточками: радио + название + пояснение. */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-weight: 400; cursor: pointer; }
.choice:hover { background: var(--surface-2); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice > input { margin-top: 3px; flex: none; }
.choice-title { display: block; font-weight: 600; }
.choice-desc { display: block; margin-top: 2px; font-size: .82rem; color: var(--muted); }
.choice-desc.warn-text { color: var(--warn); }
.choice.disabled { cursor: default; }
.choice.disabled:hover { background: none; }
.choice.disabled .choice-title, .choice.disabled > input { opacity: .6; }
/* Подготовка проверки «по смыслу» (векторы): карточка правила, блок предпросмотра, строка списка
   правил, доска суперадмина. Ждём память целей (правило не публикует) — тон предупреждения. */
.prep { border-left: 3px solid var(--accent); }
.prep.is-wait { border-left-color: var(--warn); }
.prep.is-done { border-left-color: var(--ok); }
.prep.is-done p { margin: 0; }
.prep-head { display: flex; align-items: flex-start; gap: 8px; }
.prep-head .spinner { flex: none; margin-top: .3em; }
.prep-head h2 { margin: 0; font-size: 1rem; }
.prep.is-wait .prep-head .spinner { color: var(--warn); }
.prep-head + p { margin: 6px 0 0; }
.prep-bars { display: grid; gap: 10px; margin: 12px 0 8px; }
.prep-bar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; font-size: .875rem; }
.prep-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.prep-bar .progress { margin-top: 4px; }
.prep-bar.is-done .progress span { background: var(--ok); }
.prep-bar.is-done .prep-count { color: var(--ok); }
.prep-inline { border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; background: var(--surface); }
.prep-inline p { margin: 6px 0 0; }
.prep-inline .prep-title { margin: 0; font-weight: 600; }
.prep-row { margin: 4px 0 8px; }
.prep-unchecked { margin: 4px 0 0; }
.prep-table .progress { margin-top: 4px; min-width: 80px; }
.prep-cell.is-done .progress span { background: var(--ok); }
.prep-more { margin-top: 12px; }
.prep-more > summary { cursor: pointer; color: var(--muted); font-size: .875rem; }
.prep-notice a { white-space: nowrap; }
.prep-table .prep-rule td:first-child { padding-left: 24px; }

/* Повторы: окно проверки под вариантами, отсечённые правилом и повторы поста. */
.dedup-days { max-width: 320px; margin-top: 10px; }
#rule-dedup:has(input[value="off"]:checked) .dedup-days { opacity: .5; }
.dedup-strict { display: grid; gap: 6px; margin-top: 12px; }
#rule-dedup:not(:has(input[name="dedup"][value="semantic"]:checked)) .dedup-strict { display: none; }
.dedup-nocredits { margin-top: 12px; }
#rule-dedup:not(:has(input[name="dedup"][value="semantic"]:checked)) :is(.dedup-nocredits, #dedup-cost-note) { display: none; }
.dedup-strict-title { font-weight: 600; font-size: .92rem; }
.dedup-strict-list { margin: 0; padding-left: 18px; }
#rule-dedup:not(:has(input[name="dedup_strict"][value="max"]:checked)) .dedup-max-warn { display: none; }
.dedup-max-warn { margin: 0; }
.rule-dups .h-quiet { font-size: 1rem; font-weight: 500; margin: 0; }
.rule-dups { margin-top: 16px; }
/* Карточка отсечения (партиал dup_item — «Повторы» и правило): что не ушло ≈ что уже есть в цели;
   цвет вида — как у слоя графика (--k). */
.dk-semantic { --k: var(--chart); }
.dk-src { --k: var(--chart-2); }
.dk-media { --k: var(--chart-3); }
.dk-gray { --k: var(--muted); }
.dup-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 12px; }
.dup-item { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); overflow-wrap: anywhere; scroll-margin-top: 72px; }
.dup-item:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dup-item.is-allowed { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: color-mix(in srgb, var(--ok-soft) 45%, var(--surface)); }
.dup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.dup-when { margin-left: auto; color: var(--muted); font-size: .8rem; }
.dup-kind { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: var(--pill); font-size: .76rem; font-weight: 600; background: color-mix(in srgb, var(--k) 14%, transparent); white-space: nowrap; }
.dup-kind::before, .dup-dot { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--k); }
.dup-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; }
.dup-side { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.dup-was { background: none; border: 1px dashed var(--border-strong); }
.dup-vs { align-self: center; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 700; }
.dup-where { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0; font-weight: 600; }
.dup-cap { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin-bottom: 2px; font-size: .74rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.dup-tgt { display: inline-flex; align-items: center; gap: 4px; }
.dup-tgt:not(:last-child)::after { content: ","; margin-left: -4px; }
.dup-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; margin: 0; color: var(--text); font-size: .92rem; line-height: 1.45; }
a.dup-text:hover { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.dup-src { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; font-size: .84rem; font-weight: 500; }
.dup-match + .dup-match { padding-top: 12px; border-top: 1px solid var(--border); }
.dup-edge { margin: 6px 0 0; font-size: .8rem; color: var(--warn); }
.dup-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 12px; }
.dup-foot p { flex: 1 1 240px; margin: 0; }
.callout { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.callout p { margin: 0; }
.disclosure > summary { cursor: pointer; color: var(--accent); font-size: .9rem; font-weight: 500; }
.disclosure[open] > summary { margin-bottom: 10px; }
.disclosure-card > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.disclosure-card > summary::-webkit-details-marker { display: none; }
.disclosure-card > summary .h2 { font-size: 1.1rem; font-weight: 650; letter-spacing: -.01em; }
.disclosure-card > summary .h2::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); transition: transform .15s; }
.disclosure-card[open] > summary .h2::before { transform: rotate(90deg); }
.disclosure-card:not([open]) { gap: 0; }
/* Липкая панель действий формы: «Сохранить» всегда под рукой. */
.form-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 16px; padding: 12px 0; background: var(--bg); border-top: 1px solid var(--border);
}
html:has(.form-actions) { scroll-padding-bottom: 80px; } /* поле в фокусе не прячется под панель */
.only-narrow { display: none; }
fieldset:disabled .switch, fieldset:disabled .choice, fieldset:disabled .check { cursor: default; }
.cron-lines { margin: 0 0 4px; padding-left: 1.4em; font-size: .9rem; }
.cron-lines.single { list-style: none; padding-left: 0; }
.cron-lines code.cron { white-space: normal; overflow-wrap: anywhere; }
textarea.flash, input.flash { box-shadow: 0 0 0 3px var(--accent-soft); transition: box-shadow .3s; }
.cron-lines li { padding: 3px 0; }
.cron-lines li > span { margin-left: 6px; }
.cron-lines .err-text { overflow-wrap: anywhere; }
.cron-gen .row-input, .cron-ai .row-input { display: flex; gap: 8px; }
.cron-gen .row-input input, .cron-ai .row-input input { flex: 1; min-width: 0; }
.cron-gen .results { margin-top: 8px; }
/* «Что вырезать»: подбор нейросетью и примеры выреза на постах источников. */
.cut-field .row-input { display: flex; gap: 8px; }
.cut-field .row-input input { flex: 1; min-width: 0; }
.cut-field input.mono { width: 100%; }
.cut-examples { margin: 6px 0 0; padding-left: 18px; overflow-wrap: anywhere; }
.cut-examples li { margin-bottom: 6px; }
.cut-examples del { color: var(--err); }
.cut-examples .cut-after { white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.plan-item { padding: 8px 0 2px; border-top: 1px dashed var(--border); }
.plan-item .post-mini { padding: 6px 0 8px; }
.slots li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.slot-time { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Очередь ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tab { padding: 9px 12px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab.active .count { background: var(--accent-soft); color: var(--accent); }

/* ---------- Аккаунты, участники, workspace ---------- */
.acc-grid, .ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; margin-bottom: 20px; }
.ws-grid { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.acc-card { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.acc-head { display: flex; gap: 12px; align-items: center; }
.acc-id { flex: 1; min-width: 0; }
.acc-card footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.ws-card { color: var(--text); margin: 0; }
.ws-card:hover { text-decoration: none; border-color: var(--accent); }
.ws-card-name { font-weight: 650; font-size: 1.05rem; }
.wizard { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 16px; counter-reset: w; flex-wrap: wrap; }
.wizard li { counter-increment: w; padding: 6px 12px; border-radius: var(--pill); background: var(--surface-2); color: var(--muted); font-size: .88rem; font-weight: 550; }
.wizard li::before { content: counter(w) ". "; }
.wizard li.current { background: var(--accent); color: var(--accent-ink); }
.wizard li.done { background: var(--ok-soft); color: var(--ok); }

/* ---------- Вход и ошибки ---------- */
body.bare { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.bare-main { width: 100%; max-width: 440px; }
.login-links { margin: 16px 0 0; text-align: center; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.bare-main:has(.legal-doc) { max-width: 760px; }
.legal-doc { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); line-height: 1.55; }
.legal-doc h2 { font-size: 1.05rem; margin: 20px 0 6px; }
.legal-doc p { margin: 0 0 8px; }
.terms + .check, .new-price .check { align-items: flex-start; }
.login-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; margin-bottom: 18px; }
.login-brand .logo { width: 28px; height: 28px; }
.login-bot { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.login-bot .btn { width: 100%; }
.login-code input[name=code] { font-size: 1.4rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.waiting { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 22px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
/* «Войти через Google / VK ID»: нейтральная кнопка со знаком провайдера (правила оформления Google). */
.oauth-btn { width: 100%; margin-top: 18px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.divider + .oauth-btn { margin-top: 0; }
.oauth-btn + .oauth-btn { margin-top: 10px; }
.oauth-btn + p { margin-top: 12px; }
.login-mark, .btn .login-mark { width: 18px; height: 18px; flex: none; }
.login-way h2 { display: flex; align-items: center; gap: 8px; }
.login-legal { margin-top: 18px; text-align: center; }
.legal-foot { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--border); text-align: center; }
@media (pointer: coarse) { .legal-foot a { display: inline-block; padding: 8px 4px; } }
.error-page { text-align: center; padding: 48px 16px; }
.error-code { font-size: 4rem; font-weight: 800; color: var(--surface-3); line-height: 1; margin-bottom: 8px; letter-spacing: -.04em; }
.bare .error-page { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }

/* «Повторы»: сводка с долями видов рядом с графиком, правила строками. */
.dup-overview { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 16px; margin-bottom: 20px; }
.dup-overview > .card { margin-bottom: 0; }
.dup-total { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.dup-total .tile-value { margin: 0; font-size: 2.6rem; line-height: 1; color: var(--accent); }
.dup-total-unit { color: var(--muted); font-weight: 500; }
.dup-total-sub { margin: 6px 0 0; }
.dup-bar { display: flex; gap: 2px; height: 8px; margin: 18px 0 12px; border-radius: var(--pill); overflow: hidden; background: var(--surface-2); }
.dup-bar > span { min-width: 4px; background: var(--k); }
.dup-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dup-legend li { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.dup-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.dup-legend .is-zero { color: var(--muted); }
.dup-legend .is-zero b { font-weight: 500; }
.dup-legend .is-zero .dup-dot { opacity: .4; }
.dup-note { margin: 14px 0 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--ok-soft); color: var(--ok); }
.dup-chart .chart-legend { margin-top: 8px; }
.dup-chart > p { margin: 8px 0 0; }
.dup-rules { list-style: none; margin: 0 0 12px; padding: 0; }
.dup-rule { display: grid; grid-template-columns: minmax(0, 1.2fr) 110px minmax(0, 1.4fr); gap: 8px 20px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.dup-rule:first-child { padding-top: 4px; }
.dup-rule:last-child { border-bottom: 0; }
.dup-rule-name { display: grid; gap: 2px; min-width: 0; }
.dup-rule-name a { font-weight: 600; }
.dup-rule-num { display: grid; justify-items: end; text-align: right; }
.dup-rule-num b { font-size: 1.3rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dup-rule-pass { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.dup-pass { padding: 3px 10px; border-radius: var(--pill); background: var(--accent-soft); color: var(--accent); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.dup-pass:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.dup-jump { margin-top: 14px; }
#dup-list { scroll-margin-top: 110px; }
.dup-rules-hint { margin: 0; }
.dup-list-head { margin-bottom: 12px; flex-wrap: wrap; }
.dup-list-head h2 { margin: 0; }
.dup-empty { text-align: center; padding: 36px 20px; }
.dup-empty p { max-width: 60ch; margin-inline: auto; }
.dup-empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; margin-bottom: 12px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.dup-empty-icon.ok { background: var(--ok-soft); color: var(--ok); }
.dup-empty-icon.off { background: var(--surface-2); color: var(--muted); }
.dup-empty-icon .icon { width: 28px; height: 28px; }
.dedup-strict .seg { justify-self: start; }
.dedup-strict-how summary { cursor: pointer; }
.tile-quiet { opacity: .75; }
.dups-filter { margin-bottom: 16px; }
.empty-card h2 { margin-top: 0; }
/* Темы (TOPICS.md): библиотека, черновики разбора мысли, честные числа уровней, бейджи вердикта. */
.topic-list { display: grid; gap: 12px; }
.topic-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.topic-head h2 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.topic-thought, .topic-note { margin: 4px 0 0; overflow-wrap: anywhere; }
.topic-head .topic-note { flex-basis: 100%; }
.topic-levels { margin: 6px 0; padding-left: 18px; }
.topic-levels li { margin: 2px 0; }
.topic-state.is-ready { background: var(--ok-soft); color: var(--ok); }
.topic-state.is-failed { background: var(--warn-soft); color: var(--warn); }
.topic-draft { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: grid; gap: 10px; min-width: 0; }
.topic-draft legend { padding: 0 4px; }
.topic-draft-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.topic-draft-lists textarea { width: 100%; }
.topic-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.topic-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; }
.topic-badge { white-space: normal; max-width: 100%; }
.topic-badge.is-on { background: var(--ok-soft); color: var(--ok); }
.topic-badge.is-maybe, .topic-badge.is-none { background: var(--warn-soft); color: var(--warn); }
#topics { scroll-margin-top: 120px; } /* после метки страница возвращается сюда: заголовок не под шапкой и на телефоне */
.topic-verdicts { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.topic-verdicts li { min-width: 0; overflow-wrap: anywhere; }
.topic-verdicts .row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.topic-label-note { margin: 6px 0 0; }
.topic-label-note .badge { white-space: normal; max-width: 100%; margin-right: 4px; }
.rule-topics .topic-except { margin-top: 10px; }
.rule-topics legend .muted { font-weight: 400; }
.rule-topics .check:has(input:disabled) { opacity: .5; }
.rule-topics [data-topic-group] .seg { margin-top: 8px; }
[data-topic-group]:not(:has(input[type=checkbox]:checked)) :is(.seg, .topic-level-list) { display: none; }
.topic-level-list { margin: 6px 0; padding-left: 18px; }

/* ---------- Форма правила шагами ---------- */
/* Полоса шагов: номер — счётчиком, необязательные — пунктиром, текущий — заливкой, точка —
   несохранённые изменения шага. На телефоне — полоса с прокруткой вбок. */
.rule-steps ol { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: step; }
.rule-steps li { counter-increment: step; flex: none; position: relative; } /* .sr-only внутри не раздвигает страницу */
.rule-steps a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 12px 4px 5px;
  border: 1px solid var(--border-strong); border-radius: var(--pill); background: var(--surface);
  color: var(--text); text-decoration: none; font-size: .88rem; white-space: nowrap;
}
.rule-steps a::before {
  content: counter(step); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 700;
}
.rule-steps a:hover { border-color: var(--accent); }
.rule-steps li.opt a { border-style: dashed; }
.rule-steps a[aria-current] { background: var(--accent-soft); border: 1px solid var(--accent); font-weight: 600; }
.rule-steps a[aria-current]::before { background: var(--accent); color: var(--accent-ink); }
.rule-step-mark { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.rule-step, .rule-steps { scroll-margin-top: 84px; }
.rule-step h2:focus { outline: none; }
/* Итог: правило фразой (значения — ссылки на шаги) и строка на шаг. */
.rule-sentence { margin: 0; font-size: 1rem; line-height: 1.75; max-width: 70ch; overflow-wrap: anywhere; }
.rule-sentence a { color: var(--text); font-weight: 600; text-decoration: underline dotted var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.rule-sentence a:hover { color: var(--accent); }
.rule-sum { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.rule-sum-row {
  display: grid; grid-template-columns: 8rem minmax(0, 1fr) auto; grid-template-areas: "t v a"; gap: 2px 12px;
  align-items: baseline; padding: 8px 8px 8px 12px; border-top: 1px solid var(--border);
}
.rule-sum-row dt { grid-area: t; }
.rule-sum-row dd { grid-area: v; }
.rule-sum-row dd.rule-sum-act { grid-area: a; }
.rule-sum-row:first-child { border-top: 0; }
.rule-sum-row dt { color: var(--muted); font-size: .88rem; }
.rule-sum-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: .92rem; }
.rule-sum-row:not(.is-changed) .rule-sum-changed { display: none; }
.rule-sum-row.is-changed dt::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--warn); vertical-align: 1px; }
/* Рецепты шага «Что брать»: карточки-кнопки, выбранный — заливкой. */
.recipes { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.recipes legend { padding: 0; margin-bottom: 8px; }
.recipe-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 8px; }
.recipe {
  display: block; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.recipe:hover { border-color: var(--accent); }
.recipe[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
/* Расписание словами — главный способ задать cron. */
.cron-ai { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.cron-ai > label { font-weight: 600; }
.cron-ai .presets .chip { background: var(--surface); }
/* «Тема в деле»: плитки, списки «не пустила / пустила», полоска сходства с порогом посередине. */
.topic-work { scroll-margin-top: 72px; }
.topic-work-head { flex-wrap: wrap; gap: 8px 12px; }
.topic-work-head h2 { margin: 0; }
.topic-tiles { margin: 12px 0 16px; }
.topic-tiles .tile-sub { overflow-wrap: anywhere; }
.topic-items { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 12px; }
.topic-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); overflow-wrap: anywhere; min-width: 0; scroll-margin-top: 72px; }
.topic-item:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topic-item.is-edge { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
.topic-item.is-fixed { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: color-mix(in srgb, var(--ok-soft) 45%, var(--surface)); }
.topic-item-rule, .topic-week, .topic-decided { margin: 0; }
.topic-item .badge { white-space: normal; max-width: 100%; }
.topic-item .dup-src { margin-bottom: 0; }
.topic-gauge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.topic-gauge { position: relative; flex: 1 1 100%; height: 8px; border-radius: 4px; background: var(--border); }
.topic-gauge-bar { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--muted); }
.topic-gauge-bar.is-over { background: var(--accent); }
.topic-gauge-tau { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); }
.topic-decided { margin-top: 4px; }
.dup-topic-list { margin: 8px 0 0; padding-left: 18px; }
.dup-topic-list li { margin: 4px 0; overflow-wrap: anywhere; }
.pub-topic-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

/* Водяной знак в оформлении: сетка положений 3×3 (клетка — под палец), подписи ползунков,
   образец фото со знаком в предпросмотре. */
.wm-grid { display: grid; grid-template-columns: repeat(3, 44px); gap: 6px; }
.wm-cell { position: relative; width: 44px; height: 44px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.wm-cell > input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.wm-cell::after { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--muted); }
.wm-cell:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.wm-cell:has(input:checked)::after { background: var(--accent); width: 18px; height: 18px; }
.wm-cell:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.wm-out { font-weight: 600; margin-left: 4px; }
.wm-text-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.wm-text-row > label:first-child { flex: 1 1 200px; }
.wm-color input { width: 56px; height: 44px; padding: 2px; }
.tg-bubble .wm-sample { display: block; width: 100%; height: auto; border-radius: var(--radius-sm); margin-bottom: 8px; }
#tpl-preview.htmx-request .wm-sample { opacity: .5; transition: opacity .2s; }
.wm-file { display: flex; gap: 12px; align-items: flex-start; }
.wm-file > label { flex: 1; min-width: 0; }
.wm-thumb { flex: none; width: 80px; height: 80px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
input[type=range] { border: 0; background: none; padding: 0; min-height: 32px; accent-color: var(--accent); }

/* «Цели»: список строками (аватар, имя, кто публикует, состояние, оформление, действия) и панель
   «Новая цель» — плитки платформ и мастер шагами (сделано ✓ / сейчас / впереди). */
.target-list { list-style: none; margin: 0 0 20px; padding: 0; overflow: visible; container-type: inline-size; }
.target-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px 14px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--border); }
.target-row:first-child { border-top: 0; }
.target-row.is-stopped .avatar { background: var(--warn-soft); color: var(--warn); }
.target-main { min-width: 0; display: grid; gap: 2px; }
.target-name { overflow-wrap: anywhere; }
.target-state { justify-self: start; }
.badge.stop { background: var(--err-soft); color: var(--err); }
.target-ctl { display: flex; align-items: center; gap: 6px 10px; }
.target-tpl { display: flex; align-items: center; gap: 6px; }
.tpl-label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.tpl-label select { color: var(--text); }
.target-tpl select { max-width: 190px; }
.target-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.target-actions form { margin: 0; }
.target-main .trial-cta { margin: 4px 0 0; }
.trial-note > summary { cursor: pointer; list-style: none; }
.trial-note > summary::-webkit-details-marker { display: none; }
.trial-note > summary .link { color: var(--accent); white-space: nowrap; }
.trial-note[open] > summary .link { display: none; }
.trial-note > p { margin-top: 8px; }
.trial-note { background: var(--accent-soft); border-color: transparent; margin-bottom: 16px; }
.add-target { margin-bottom: 20px; }
.add-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.add-head h2 { margin: 0; }
.plat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; margin: 6px 0 4px; }
.plat-tile { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--text); background: var(--surface); }
.plat-tile:hover { background: var(--surface-2); text-decoration: none; }
.plat-tile.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.add-flow { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--border); }
.add-flow > .muted.small:first-of-type { margin-top: 10px; }
.wiz { list-style: none; margin: 8px 0 0; padding: 0; }
.wiz-step { display: flex; gap: 12px; padding: 12px 0; }
.wiz-step + .wiz-step { border-top: 1px dashed var(--border); }
.wiz-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: .85rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-strong); }
.wiz-step.now .wiz-n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.wiz-step.done .wiz-n { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.wiz-step.next .wiz-body > b { color: var(--muted); font-weight: 550; }
.wiz-body { flex: 1; min-width: 0; display: grid; gap: 6px; align-content: start; }
.wiz-body > * { margin: 0; }
.wiz-body > b { line-height: 26px; }
.wiz-done { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.wiz-done form { margin: 0; }
.wiz-more > summary { cursor: pointer; }
.wiz-more p { margin: 6px 0 0; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.add-row > input:not([type=hidden]) { flex: 1 1 220px; min-width: 0; }
.add-row > .code-input { flex: 0 1 220px; }
.wait-note { display: flex; align-items: center; gap: 8px; }
@container (max-width: 860px) {
  .target-row { grid-template-columns: auto minmax(0, 1fr) auto; padding: 14px; }
  .target-ctl { grid-column: 2 / -1; flex-wrap: wrap; }
  .target-actions { justify-content: flex-start; }
}
@container (max-width: 420px) {
  .target-row { grid-template-columns: auto minmax(0, 1fr); }
  .target-row > .avatar { align-self: start; }
  .target-row > .target-state { grid-column: 2; }
  .target-ctl { grid-column: 1 / -1; }
  .target-tpl { flex: 1 1 100%; }
  .target-tpl form, .tpl-label { flex: 1; display: flex; }
  .target-tpl select { max-width: none; flex: 1; }
}

/* ---------- Адаптив ---------- */
@media (max-width: 1080px) {
  .post-detail, .rule-layout { grid-template-columns: minmax(0, 1fr); }
  .schedule { grid-template-columns: minmax(0, 1fr); grid-template-areas: "input" "describe" "extras"; }
  .only-narrow { display: inline-flex; }
  .rule-preview-card { max-height: none; position: static; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav {
    position: sticky; top: 56px; z-index: 20; height: auto; flex-direction: row; overflow-x: auto;
    padding: 6px 10px; border-right: 0; border-bottom: 1px solid var(--border); scrollbar-width: none;
  }
  .sidenav::-webkit-scrollbar { display: none; }
  .navlink { flex: none; padding: 6px 10px; font-size: .9rem; }
  .navlink .icon { display: none; }
  .nav-sep { width: 1px; height: auto; margin: 4px 2px; }
  .main { padding: 16px 16px 48px; }
  .admin-name { display: none; }
  .topbar .profile-link { display: inline-flex; flex: none; }
  .topbar { gap: 8px; padding: 0 12px; }
  .platform-nav { display: none; }
  .platform-menu { display: block; flex: none; }
  .cols, .rule-list, .acc-grid, .dup-overview { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 1.35rem; }
  #flash-area { inset: 64px 8px auto 8px; width: auto; }
}
@media (max-width: 640px) {
  .dup-rule { grid-template-columns: minmax(0, 1fr) auto; }
  .dup-rule-pass { grid-column: 1 / -1; }
  .dup-pair { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .dup-vs { justify-self: center; width: 26px; height: 26px; }
  .dup-item { padding: 12px; }
  .dup-text { -webkit-line-clamp: 5; line-clamp: 5; }
  .dup-foot { justify-content: stretch; }
  .dup-foot form, .dup-foot .btn { width: 100%; }
  .dup-chart .chart-legend, .dup-chart > p { display: none; } /* виды — легендой сводки */
  .table thead { display: none; }
  .table, .table tbody, .table td { display: block; width: 100%; }
  .table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 0; border-bottom: 1px solid var(--border); padding: 10px 0; }
  .table td:first-child, .table td.actions-col { grid-column: 1 / -1; }
  .table td { border: 0; padding: 4px 14px; text-align: left; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .table .num { text-align: left; }
  .actions-col { width: 100%; text-align: left; }
  .actions-col .btn-row { justify-content: flex-start; flex-wrap: wrap; }
  .post-grid { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-value { font-size: 1.5rem; }
  .pub-row { flex-wrap: wrap; }
  /* Статус и меню ⋯ — над постом, а не под ним: отменить, не пролистывая длинный пузырь. */
  .pub-side { order: -1; width: 100%; justify-content: space-between; }
  .ws-switch > summary { max-width: 52vw; }
  .ws-switch .role-chip { display: none; }
  .seg { width: 100%; }
  .seg label { flex: 1; }
  .seg span { display: flex; flex: 1; align-items: center; justify-content: center; text-align: center; padding: 6px 4px; }
  /* Пять уровней строгости в ряд не помещаются — два ряда (3 + 2); линии между кнопками — зазор
     на цвете рамки: у первой кнопки второго ряда своей левой рамки нет. */
  .dedup-strict .seg { flex-wrap: wrap; gap: 1px; background: var(--border); }
  .dedup-strict .seg label { flex: 1 1 30%; }
  .dedup-strict .seg span { border-left: 0; background: var(--surface); min-height: 44px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-actions .btn.ghost { display: none; } /* назад — «← Правила» вверху; панель в одну строку */
  .login-card, .legal-doc { padding: 20px; }
  /* Выпадающие меню на телефоне — шторкой снизу во всю ширину (у края экрана меню уезжало за
     него); меню шапки — сразу под ней. Закрывает клик мимо (app.js). */
  /* Длинная подпись кнопки переносится, а не раздвигает карточку («Вернуть правила чистки…»). */
  .btn { white-space: normal; text-align: center; max-width: 100%; }
  /* Поля ввода — 16px: при меньшем шрифте iOS Safari приближает страницу на фокусе. */
  input, select, textarea { font-size: 16px; }
  input.mono, textarea.mono { font-size: 16px; } /* .mono (.9em) иначе сильнее правила выше */
  .platform-menu > summary span { display: none; }
  .crumbs-row .btn { flex: none; }
  dialog.modal { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  #modal-body { padding: 14px; }
  /* Фильтры (посты, траты, платежи, «Расход кредитов»): сетка в две колонки, подпись над
     полем; поиск, период-переключатель, галочки и меню — во всю ширину. */
  .filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 10px; }
  .filter-row > * { min-width: 0; margin: 0; }
  .filter-row > .inline-field { flex-direction: column; align-items: stretch; gap: 3px; white-space: normal; font-size: .8rem; }
  .filter-row > .inline-field > input, .filter-row > .inline-field > select { width: 100%; }
  .filter-row > .grow, .filter-row > .seg, .filter-row > .check, .filter-row > .dropdown,
  .filter-row > input:not([type=checkbox]):not([type=radio]), .filter-row > .inline-field:has(select[name=target]),
  .filter-row > .inline-field:has(select[name=period]), .filter-row > .inline-field:has(select[name=sort]),
  .filter-row > .inline-field:has(select[name=ws]) { grid-column: 1 / -1; }
  .filters-more > summary { display: inline-flex; list-style: none; }
  .filters-more > summary::-webkit-details-marker { display: none; }
  .filters-more[open] > summary { margin-bottom: 10px; }
  .filter-row > .dropdown > summary { width: 100%; }
  details.dropdown .menu {
    position: fixed; z-index: 60; left: 8px; right: 8px; top: auto; bottom: 8px;
    width: auto; min-width: 0; max-width: none; max-height: 70vh; max-height: 70dvh; overflow: auto;
    overscroll-behavior: contain; padding: 8px;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, .22);
  }
  details.dropdown.right .menu, details.dropdown.bulk-retext .menu { left: 8px; right: 8px; width: auto; }
  /* Подложка: касание мимо шторки закрывает её (попадает в summary), а не жмёт то, что под ней. */
  details.dropdown[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 59; background: rgba(0, 0, 0, .3); cursor: default; }
  /* В шторке с полями (текст выбранных) клавиатура телефона снизу закрыла бы поле — шторка сверху. */
  details.dropdown.bulk-retext .menu { top: 60px; bottom: auto; }
  .topbar details.dropdown .menu, .topbar details.dropdown.right .menu { left: 8px; right: 8px; top: 60px; bottom: auto; box-shadow: 0 8px 32px rgba(0, 0, 0, .22); }
  .menu a, .menu-item { padding: 10px 12px; }
  .bulk-bar .bulk-actions { margin-left: 0; }
}

/* Сенсорный экран: кнопки и поля — под палец (≥ 40px), мелкие ссылки-кнопки — не меньше 36px. */
@media (pointer: coarse) {
  .rule-more > summary, .alert-more > summary, .pub-src > summary { min-height: 40px; display: flex; align-items: center; }
  .rule-card details.dropdown > summary { min-width: 44px; min-height: 40px; }
  .btn { min-height: 40px; }
  .btn.small { min-height: 36px; }
  input:not([type=checkbox]):not([type=radio]), select { min-height: 40px; }
  .navlink { min-height: 40px; }
  .toast-close { top: 4px; right: 4px; width: 40px; height: 40px; }
  .toast { padding-right: 48px; }
  .check { min-height: 32px; }
  input.pub-pick, .pub-pick { width: 22px; height: 22px; margin-top: 0; }
  .menu a, .menu-item { min-height: 40px; display: flex; align-items: center; gap: 6px; }
}

/* Нейрочистка: что вырезано (предпросмотр подписи). */
.ai-removed { margin: 6px 0 0; padding-left: 0; list-style: none; display: grid; gap: 4px; }
.ai-removed .badge { margin-right: 4px; }
/* Индикатор запроса htmx (встроенные стили htmx выключены в htmx-config). */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }


/* Форма правила шагами на телефоне: шаги — полосой с прокруткой вбок, строка «Итога» — подпись и
   кнопка сверху, значение под ними; шапка раздела с переключателем переносится, а не вылезает за
   край; панель шагов — в одну строку: «Далее» без названия шага, «Предпросмотр» — только на
   «Итоге» (на шагах предпросмотр и так под формой). */
@media (max-width: 640px) {
  .rule-steps ol { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
  .rule-steps ol::-webkit-scrollbar { display: none; }
  .rule-sum-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "t a" "v v"; }
  .section-head { flex-wrap: wrap; }
  .rule-form .step-next-title { display: none; }
  .rule-form.is-steps:not([data-step="done"]) .form-actions .only-narrow { display: none; }
}
/* Примеры пожеланий к расписанию — главный путь: под палец. */
@media (pointer: coarse) { .cron-ai .chip { min-height: 40px; } }

/* ---------- Оформление: пузырь сообщения и URL-кнопки (как в Telegram) ---------- */
.tg-bubble { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; margin: 6px 0; overflow: hidden; }
.tg-bubble .post-rich { max-height: 260px; overflow-y: auto; }
.tg-kb { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.tg-kb-row { display: flex; gap: 4px; }
.tg-kb-btn { flex: 1 1 0; min-width: 0; text-align: center; padding: 6px 8px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent); font-size: .875rem; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-kb-btn:hover { background: var(--accent); color: var(--accent-ink); }
.decor-edit-box summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.decor-edit-box textarea { width: 100%; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form select { max-width: 14rem; }

/* Фильтр очереди по цели. */
.queue-filter { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.queue-filter .small-label { margin: 0; }
.queue-filter select { width: auto; max-width: 100%; }

/* ---------- Медиа в пузыре: видео, GIF, файлы ---------- */
.tgm-v { cursor: pointer; }
.tgm-v.playing .tgm-play, .tgm-v.playing .tgm-dur { display: none; }
.tgm-i video[controls] { object-fit: contain; }
.tgf { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.tgf-row { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; min-width: 0; }
a.tgf-row:hover .tgf-name { text-decoration: underline; }
.tgf-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: 18px; }
.tgf-body { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.tgf-name { font-weight: 600; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tgf audio { width: 100%; height: 32px; }
button.tg-kb-btn { border: 0; font: inherit; font-size: .875rem; cursor: pointer; }
.tg-kb-btn.copied { background: var(--ok-soft); color: var(--ok); }

/* ---------- Создание поста ---------- */
.draft-thumb { position: relative; flex: none; width: 72px; height: 72px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center; color: var(--muted); text-decoration: none; }
.draft-thumb img, .draft-thumb video, .dm-thumb img, .dm-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.draft-thumb .tgm-play { font-size: 20px; }
.draft-title { color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.draft-title:hover { color: var(--accent); }
/* Редактор своего поста — как форма оформления: секции слева, справа липкая колонка
   предпросмотра и публикации (своя прокрутка); на узком — под формой. */
.compose-layout { grid-template-areas: "main side" "pubs side"; }
.compose-main { grid-area: main; min-width: 0; gap: 16px; }
.compose-pubs { grid-area: pubs; min-width: 0; }
.compose-main > .card, .compose-side > .card { margin: 0; }
.compose-side { gap: 16px; grid-area: side; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; min-width: 0; }
.compose-side .rule-preview-card { position: static; max-height: none; overflow: visible; }
.section-foot { border-top: 1px solid var(--border); padding-top: 12px; }
.draft-card .acc-head { align-items: flex-start; }
.draft-card .draft-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.compose-side .tg-bubble .post-rich { max-height: none; }
.preview-tabs { margin-bottom: 10px; }
.caps-hints { margin: 4px 0; padding-left: 1.2em; }
.caps-hints li { margin: 2px 0; }
.preview-tabs .tab { background: none; border-top: 0; border-left: 0; border-right: 0; font: inherit; font-weight: 550; cursor: pointer; }
.tab-warn { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--warn); color: var(--on-status); font-size: .7rem; font-weight: 700; }
.tab-warn.block { background: var(--err); }
@media (prefers-color-scheme: dark) { .tab-warn { color: #1a1a1a; } }
.pf-max .tg-bubble { border-radius: 14px; } /* пузырь MAX круглее, как в template.html */
.pf-max .tg-kb-btn { border-radius: 10px; }
.compose textarea { width: 100%; }
.md-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: -6px; }
.md-toolbar .btn { padding: 3px 8px; }
.sub-checks { display: flex; flex-wrap: wrap; gap: 4px 16px; padding-left: 24px; }
.draft-media { display: flex; flex-direction: column; gap: 10px; }
.dm-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.dm-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dm-thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.dm-thumb .tgm-play { font-size: 18px; }
.dm-ico { font-size: 28px; }
.dm-name { font-size: .8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-actions { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.dm-actions select { font-size: .8rem; padding: 3px 6px; }
.dm-actions .btn-row { gap: 4px; }
.dm-actions .btn { padding: 2px 8px; }
.dm-drop { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 18px 12px; cursor: pointer; color: var(--muted); font-weight: 400; }
.dm-drop:hover, .dm-drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dm-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dm-progress:empty { display: none; }
@media (max-width: 1080px) {
  .compose-layout { grid-template-areas: "main" "side" "pubs"; }
  .compose-side { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 640px) {
  .dm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .draft-thumb { width: 56px; height: 56px; }
}
.md-help summary { cursor: pointer; color: var(--accent); }
.radios .check.off { color: var(--muted); }
.radios:has(input[name=link_preview]:not(:checked)) .sub-checks { opacity: .5; pointer-events: none; }
.dm-item.odd { border-color: var(--err); box-shadow: 0 0 0 1px var(--err) inset; }
.dm-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.tgm-i:has(video[data-gif]) { cursor: default; }
.tg-media-spoiler { position: relative; }
.tg-media-spoiler .tgm, .tg-media-spoiler .tgm-one { filter: blur(14px) saturate(.6); }
.tg-spoiler-label { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); padding: 4px 10px; border-radius: 12px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px; pointer-events: none; white-space: nowrap; }
.tg-link-card { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--accent);
  border-radius: 4px; background: var(--accent-soft); }
.tg-link-card.large { padding-bottom: 40px; }
.tg-link-host { font-weight: 600; font-size: .875rem; color: var(--accent); overflow-wrap: anywhere; }

/* Платформа, где канал не найти по нику (MAX): шаги привязки и каналы с ботом. */
.seen-chats li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.seen-chats .err-text { flex-basis: 100%; }
.seen-chats .strong { overflow-wrap: anywhere; }
.btn.wrap { white-space: normal; text-align: center; }

/* Оформление: у каждой платформы своё (вкладки, памятка различий, пузырь платформы). */
.platform-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.platform-rules { flex: 1 1 320px; min-width: 0; }
.platform-rules > summary { cursor: pointer; color: var(--muted); font-size: .9rem; font-weight: 550; padding: 6px 0; }
.platform-rules > summary:hover { color: var(--text); }
.platform-rules-list { margin: 4px 0 0; padding-left: 18px; color: var(--muted); display: grid; gap: 2px; }
.callout.small { font-size: .85rem; margin-bottom: 8px; }
.max-bubble { border-radius: 14px; }
.max-bubble .tg-kb-btn { border-radius: 10px; }
/* Предпросмотр правила: первый пост в каждой его цели. */
.rule-look + .rule-look { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.rule-look-head { margin: 0 0 6px; font-weight: 550; }

/* Тарифы: лимиты полосками, выбор «что оставить», карточки тарифов, траты */
.table-title { padding: 18px 20px 0; margin: 0 0 8px; }
.pad { padding: 0 20px 18px; }
.limit-bars { display: flex; flex-direction: column; gap: 16px; margin-bottom: 12px; }
.limit-num { font-variant-numeric: tabular-nums; }
.limit-row p { margin: 6px 0 0; }
.progress.full span { background: var(--warn); }
.keep-list .check { flex-wrap: wrap; }
ul.plain { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 4px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 16px; margin-bottom: 20px; }
.plan-grid .card { margin: 0; }
.plan-card h3 { margin-top: 0; }
.pair { display: flex; gap: 8px; }
.pair input { min-width: 0; }
.cost-row { margin-bottom: 8px; }
.cost-row input:not([size]) { min-width: 0; flex: 1 1 160px; }
.add-cost { margin-top: 12px; }
.add-cost input:not([size]) { flex: 1 1 160px; min-width: 0; }
@media (max-width: 520px) { .plan-grid { grid-template-columns: 1fr; } }
tr.is-current td { background: var(--ok-soft); }

/* Кредиты в кабинете «Тариф и кредиты» */
.credit-balance { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.big-num { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.grant-list { list-style: none; padding: 0; margin: 10px 0 6px; display: grid; gap: 6px; }
.grant-list li { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.grant-name { flex: 1 1 180px; font-weight: 600; }
.grant-left { font-variant-numeric: tabular-nums; }
.credit-totals { margin: 10px 0; }
.usage-anomaly, .usage-anomaly td { background: var(--warn-soft); }
@media (min-width: 900px) {
  .usage-table td, .usage-table th { white-space: nowrap; }
  .usage-table .wrap { white-space: normal; }
}
.sort-link { color: inherit; text-decoration: none; }
.sort-link.on { text-decoration: underline; }


/* ---------- Оплата (кабинет и «Платежи и возвраты») ---------- */
.pad-top-s { padding-top: 12px; }
.narrow-card { max-width: 640px; }
.big-sum { font-size: 1.4rem; }
.terms { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .9rem; }
.terms p { margin: 0 0 6px; }
.terms p:last-child { margin: 0; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(128px, 100%), 1fr)); gap: 10px; margin: 10px 0 16px; }
.pack-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.pack-num { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 10px; }
.pack-card.is-current { border-color: var(--ok); }
#packs { margin-top: 18px; }
.num-input { width: 4.5rem; }
.issue-list li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.issue-list li:last-child { border-bottom: 0; }
.row-overdue td { background: var(--err-soft); }
.timeline li { padding: 3px 0; }
.refund-notes li { padding: 2px 0; }
.table-wrap { overflow-x: auto; }

/* «Воронка и удержание» (суперадмин): шаги воронки полосами, когорты — заливкой по доле. */
.funnel { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 14px; }
.funnel-step.active .funnel-head b { color: var(--accent); }
.funnel-nums { margin-top: 4px; overflow-wrap: anywhere; }
.funnel-step .progress { margin-top: 6px; }
.loss + .loss { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.loss h3 { margin: 0 0 2px; }
.loss p { margin: 0 0 6px; }
.loss-sum { overflow-wrap: anywhere; }
.loss .mono, .loss-text { overflow-wrap: anywhere; }
.loss-text { margin-top: 2px; color: var(--muted); font-style: italic; }
/* Недели когорты — полосой клеток (шапка — такая же полоса подписей): столбцы совпадают на
   широком экране, на телефоне полоса переносится, подпись недели — в клетке. Заливка — не
   больше 70 %: тёмный текст читается и на полной доле. */
.cohort-strip { display: flex; gap: 2px; }
.cohort-cell { flex: 0 0 52px; padding: 4px 0; border-radius: 4px; text-align: center; font-variant-numeric: tabular-nums; }
.cohort-cell.heat { background: color-mix(in srgb, var(--chart) calc(var(--v) * 0.7), transparent); }
.cohort-cell.partial { font-style: italic; }
.cohort-cell.cohort-empty { display: none; }
.cohort-k { display: none; font-size: .68rem; opacity: .75; }
@media (max-width: 640px) {
  .cohort-table td.cohort-weeks { grid-column: 1 / -1; }
  .cohort-strip { flex-wrap: wrap; }
  .cohort-cell { flex-basis: 46px; font-size: .8rem; }
  .cohort-k { display: block; }
}
@media (pointer: coarse) {
  .funnel-nums a { display: inline-block; padding-block: 8px; }
  .leave-reason .checklist.pills .check, #rule-targets .check, #rule-topics .check { padding-block: 10px; }
}
.loss-jump { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 12px; }
@media (pointer: coarse) { .loss-jump a { display: inline-block; padding-block: 8px; } }
/* Заметки панели: день у сводки и метки у недели когорт и месяца денег — ссылками на заметку в
   списке (в ячейке — одной строкой с обрезкой, полностью — в title и в списке); новая или
   выбранная заметка подсвечена (:target); якоря — ниже липкой шапки. */
.note-line { margin: -4px 0 16px; overflow-wrap: anywhere; }
.note-mark { font-weight: 600; }
.note-cell { display: block; max-width: 24ch; margin-top: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.note-form { margin-bottom: 12px; }
.note-form .grow > input { flex: 1; min-width: 0; }
.note-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 8px;
  margin: 0 -8px; border-top: 1px solid var(--border); border-radius: 6px; }
.note-list li:target { background: var(--ok-soft); }
.note-list form { margin: 0; flex: none; }
.note-body { min-width: 0; overflow-wrap: anywhere; }
.note-day { font-weight: 600; }
#notes, .note-list li, #note-text { scroll-margin-top: 72px; }
@media (pointer: coarse) { .note-line a { display: inline-block; padding-block: 8px; } }
@media (max-width: 640px) { .note-form > * { grid-column: 1 / -1; } .note-cell { max-width: 100%; } }

/* Длинный адрес в инструкции (ключ VK): переносится, а не тянет страницу вбок на телефоне. */
code.url-wrap { overflow-wrap: anywhere; word-break: break-all; }
/* Код владения (tsp-…) — одним куском: перенос посередине путает при наборе. */
code.owner-code { white-space: nowrap; }


/* ---------- Демо-кабинет: баннер «только смотреть» ---------- */
.demo-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.demo-banner p { margin: 0; flex: 1 1 320px; }
/* В шапке демо две кнопки: переключатель пространства сжимается (название — с многоточием),
   кнопки — нет. */
.topbar .ws-switch { min-width: 0; }
.topbar .ws-switch > summary .ws-name { min-width: 0; }
.topbar > .btn { flex: none; }
/* Длинная и короткая подпись одного элемента: на телефоне — короткая. */
.narrow-only { display: none; }
@media (max-width: 640px) { .wide-only { display: none !important; } .narrow-only { display: inline; } }
/* Самый узкий телефон: место переключателю пространства, логотип — без подписи. */
@media (max-width: 360px) { .topbar .brand span { display: none; } }
.demo-banner-tag {
  padding: 2px 8px; border-radius: var(--pill); background: var(--accent); color: var(--accent-ink);
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}

/* ---------- Публичный сайт: лендинг и тарифы ---------- */
body.site { background: var(--surface); }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 50; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); }
.skip-link:focus { top: 12px; }
.site-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.site-wrap.site-narrow { max-width: 780px; }
.site-head {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-head-row { display: flex; align-items: center; gap: 24px; min-height: 60px; }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav a { padding: 6px 10px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 550; white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--text); background: var(--surface-2); text-decoration: none; }
.site-head-cta { display: flex; gap: 8px; margin-left: auto; }
.site-main { min-height: 60vh; }
body.site #flash-area { top: 72px; } /* тосты — под шапкой сайта */

.band { padding: 72px 0; }
.band[id] { scroll-margin-top: 24px; } /* ссылка из шапки «/#…» не прячет заголовок под липкую шапку на телефоне */
.band-tight { padding-top: 8px; }
.band-alt { background: var(--bg); }
.section-title { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem); letter-spacing: -.02em; margin-bottom: .35em; }
.section-lead { color: var(--muted); font-size: 1.08rem; max-width: 640px; margin: 0 0 32px; }
.center { text-align: center; }
.center .section-lead, .center .lead { margin-left: auto; margin-right: auto; }
.center-row { justify-content: center; }
.lead { font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem); color: var(--muted); max-width: 620px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-weight: 650; font-size: .9rem; letter-spacing: .02em; }
.ic-check { width: 18px; height: 18px; flex: none; color: var(--ok); }
.price-cta { width: 100%; }

/* Первый экран: предложение слева, продукт справа. */
.hero { padding: 64px 0 72px; background: radial-gradient(1000px 420px at 85% 0%, var(--accent-soft), transparent 70%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.1rem); line-height: 1.1; letter-spacing: -.03em; margin-bottom: 18px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 18px; }
.hero-trust { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: .92rem; }
.hero-trust li { display: flex; align-items: center; gap: 6px; }

.hero-shot {
  margin: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  box-shadow: 0 24px 60px -24px rgba(20, 40, 80, .28), var(--shadow); overflow: hidden;
}
.shot-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: .85rem; }
.shot-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.shot-bar b { margin-left: 8px; font-weight: 600; color: var(--muted); }
.shot-feed { list-style: none; margin: 0; padding: 8px; }
.shot-post { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border-radius: var(--radius); }
.shot-post + .shot-post { border-top: 1px solid var(--border); border-radius: 0; }
.shot-post.is-top { background: var(--accent-soft); border-radius: var(--radius); }
.shot-ava { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; background: hsl(var(--h) 60% 52%); }
.shot-body b { display: block; font-size: .92rem; }
.shot-body p { margin: 2px 0; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shot-meta { color: var(--muted); font-size: .78rem; }
.shot-score { font: 650 .95rem var(--mono); padding: 4px 8px; border-radius: var(--radius-sm); background: var(--surface-2); }
.is-top .shot-score { background: var(--ok-soft); color: var(--ok); }
.shot-queue { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: .9rem; }
.shot-queue span:nth-child(2) { flex: 1; min-width: 0; }
.shot-cap { padding: 0 16px 12px; }

.clean-demo { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: center; }
.clean-demo figcaption { grid-column: 1 / -1; }
.clean-col { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: .92rem; }
.clean-col p { margin: 0 0 6px; }
.clean-col.is-after { border-color: var(--ok); }
.clean-tag { display: block; margin-bottom: 8px; color: var(--muted); font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.clean-col .cut { text-decoration: line-through; text-decoration-color: var(--err); color: var(--muted); background: var(--err-soft); border-radius: 4px; padding: 0 4px; }
.clean-arrow { font-size: 1.4rem; color: var(--muted); }
.clean-btn { display: block; margin-top: 8px; padding: 6px; border-radius: var(--radius-sm); text-align: center; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .88rem; }

.shot-post.is-dup .shot-body { opacity: .6; }
.shot-post.is-dup .shot-body p { text-decoration: line-through; text-decoration-color: var(--warn); }

/* Повторы новостей: выгоды, пример одной новости из двух каналов, шкала строгости. */
.sdup-wins { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; }
.sdup-wins li { display: flex; gap: 12px; align-items: flex-start; }
.sdup-wins .ic-check { margin-top: 3px; }
.sdup-pair { margin: 0; display: grid; gap: 12px; }
.sdup-ex { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: .95rem; }
.sdup-ex p { margin: 6px 0 10px; }
.sdup-ex.is-cut { border-color: var(--warn); }
.sdup-ex.is-cut p { color: var(--muted); }
.sdup-from { font-weight: 650; font-size: .88rem; }
.sdup-scale-title { margin-top: 40px; }
.sdup-scale { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.sdup-scale li { position: relative; padding: 16px 14px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: grid; gap: 4px; }
.sdup-scale li::before { content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 4px; border-radius: 0 0 4px 4px; background: var(--accent); opacity: calc(.2 + var(--lvl, 0) * .2); }
.sdup-scale li:nth-child(1) { --lvl: 0; } .sdup-scale li:nth-child(2) { --lvl: 1; } .sdup-scale li:nth-child(3) { --lvl: 2; }
.sdup-scale li:nth-child(4) { --lvl: 3; } .sdup-scale li:nth-child(5) { --lvl: 4; }
.sdup-scale li.is-default { border-color: var(--accent); background: var(--accent-soft); }
.sdup-scale span { color: var(--muted); font-size: .88rem; }
.topic-modes { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.topic-modes li { padding: 16px 14px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: grid; gap: 4px; }
.topic-modes span { color: var(--muted); font-size: .88rem; }

.site-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.site-steps li { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.site-steps p, .feature p { margin: 0; color: var(--muted); }
.step-num { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-bottom: 14px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.score-demo { margin: 0; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: grid; gap: 16px; }
.score-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.score-label { font-weight: 600; font-size: .92rem; }
.score-label small { display: block; font-weight: 400; color: var(--muted); }
.score-bar { height: 10px; border-radius: var(--pill); background: var(--surface-3); overflow: hidden; }
.score-bar i { display: block; height: 100%; border-radius: inherit; background: var(--muted); }
.score-row.is-win .score-bar i { background: var(--ok); }
.score-row b { font-family: var(--mono); }
.score-row.is-win b { color: var(--ok); }

.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.feature, .plat-card { padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.feature .icon { width: 28px; height: 28px; padding: 5px; margin-bottom: 12px; border-radius: var(--radius-sm); color: var(--accent); background: var(--accent-soft); box-sizing: content-box; }
.feature h3 { font-size: 1.02rem; }

/* Платформы: карточка на платформу — откуда собираем и куда публикуем. */
.plat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.plat-card h3 { font-size: 1.1rem; }
.plat-card dl { margin: 0; display: grid; gap: 4px; }
.plat-card dt { margin-top: 8px; color: var(--muted); font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.plat-card dd { margin: 0; }
.shot-body .badge, .shot-queue .badge { vertical-align: 1px; }
.nowrap { white-space: nowrap; }

.trust-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; }
.trust-list li { display: flex; gap: 12px; align-items: flex-start; }
.trust-list .ic-check { margin-top: 3px; }
.trust-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.plan-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 12px; margin-bottom: 24px; }
.plan-mini { display: flex; flex-direction: column; gap: 4px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: var(--surface); transition: border-color .12s, transform .12s; }
.plan-mini:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.plan-mini.is-featured { border: 2px solid var(--accent); }
.plan-mini-name { font-weight: 650; }
.plan-mini-price { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.plan-mini-price small { font-size: .85rem; font-weight: 500; color: var(--muted); }

.faq { display: grid; gap: 10px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.faq summary { cursor: pointer; padding: 16px 44px 16px 18px; font-weight: 600; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0; padding: 0 18px 16px; color: var(--muted); }

.cta-band { background: linear-gradient(135deg, var(--accent-soft), var(--bg)); }
.cta-band h2 { font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.2rem); letter-spacing: -.02em; }

.site-foot { border-top: 1px solid var(--border); padding: 32px 0 40px; background: var(--surface); }
.site-foot-row { display: flex; gap: 32px; justify-content: space-between; flex-wrap: wrap; }
.site-foot-brand { max-width: 340px; }
.site-foot-brand p { margin: 8px 0 0; }
.site-foot-nav { display: flex; flex-wrap: wrap; gap: 8px 20px; align-content: flex-start; }
.site-foot-nav a { color: var(--muted); }

/* Тарифы: переключатель месяц/год радиокнопками, карточки, сравнение. */
.pricing-head { padding: 56px 0 24px; }
.pricing-head h1 { font-size: clamp(2rem, 1.4rem + 2vw, 2.8rem); letter-spacing: -.03em; }
.period-toggle { display: flex; width: max-content; max-width: 100%; margin: 0 auto 28px; padding: 4px; gap: 4px; border-radius: var(--pill); background: var(--surface-2); border: 1px solid var(--border); }
.period-toggle label { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: var(--pill); cursor: pointer; font-weight: 600; color: var(--muted); }
#per-month:checked ~ .period-toggle label[for="per-month"],
#per-year:checked ~ .period-toggle label[for="per-year"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
#per-month:focus-visible ~ .period-toggle label[for="per-month"],
#per-year:focus-visible ~ .period-toggle label[for="per-year"] { outline: 2px solid var(--accent); outline-offset: 2px; }
#per-month:checked ~ .price-grid .p-year, #per-year:checked ~ .price-grid .p-month { display: none; }

.price-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; align-items: stretch; margin-bottom: 20px; }
.price-card { position: relative; display: flex; flex-direction: column; gap: 14px; padding: 22px 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); scroll-margin-top: 80px; }
.price-card.is-featured { border: 2px solid var(--accent); box-shadow: 0 18px 40px -22px rgba(42, 120, 214, .5); }
.price-card:target { outline: 3px solid var(--accent-soft); }
.plan-flag { position: absolute; top: -12px; left: 18px; padding: 2px 10px; border-radius: var(--pill); background: var(--accent); color: var(--accent-ink); font-size: .78rem; font-weight: 700; }
.plan-name { font-size: 1.2rem; margin: 0; }
.plan-for { margin: -8px 0 0; min-height: 3em; }
.price-card .btn { white-space: normal; text-align: center; }
.plan-price { min-height: 76px; }
.plan-price > span, .plan-price .p-month, .plan-price .p-year { display: flex; flex-direction: column; }
.plan-price .price { font-size: 1.75rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.plan-price .per { color: var(--muted); font-size: .85rem; }
.plan-price .save { margin-top: 4px; color: var(--ok); font-size: .85rem; font-weight: 600; }
.plan-feats { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: .9rem; }
.plan-feats li { display: flex; gap: 8px; align-items: flex-start; }
.plan-feats .ic-check { width: 16px; height: 16px; margin-top: 3px; }

.compare-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 24px; }
.compare { width: 100%; border-collapse: collapse; min-width: 720px; font-size: .92rem; }
.compare th, .compare td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: center; }
.compare tbody tr:last-child > * { border-bottom: 0; }
.compare th[scope="row"] { text-align: left; font-weight: 550; position: sticky; left: 0; background: var(--surface); }
.compare th small, .gen-table th small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.compare thead th { font-weight: 650; background: var(--surface-2); }
.compare .is-featured { color: var(--accent); }
.compare .ic-check { display: inline-block; vertical-align: middle; }

.site-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; }
.pack-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.pack-n { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.pack-tile .price { margin-top: 8px; font-weight: 650; }

.gen-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.gen-table th, .gen-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: left; }
.gen-table td { text-align: right; font: 700 1.1rem var(--mono); }
.gen-table tr:last-child > * { border-bottom: 0; }

@media (max-width: 1080px) {
  .price-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-feat { display: none; } /* с «Демо», «Войти» и «Начать бесплатно» шапка не помещается */
}
@media (max-width: 860px) {
  .hero-grid, .split { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .site-steps { grid-template-columns: minmax(0, 1fr); }
  .plat-grid { grid-template-columns: minmax(0, 1fr); }
  .sdup-scale, .topic-modes { grid-template-columns: minmax(0, 1fr); }
  .site-how { display: none; }
  .price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trust-list, .trust-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .site-plat { display: none; } /* со «Статьями» шапка не помещается; платформы — на лендинге */
}
@media (max-width: 560px) {
  .site-wrap { padding: 0 16px; }
  .band { padding: 48px 0; }
  .hero { padding: 36px 0 48px; }
  .hero-cta .btn { width: 100%; }
  .site-head-try { display: none; }
  .band.band-tight { padding-top: 8px; }
  .pricing-head { padding-bottom: 16px; }
  .site-head-row { gap: 8px; }
  .site-nav a { padding: 6px 6px; }
  .clean-demo { grid-template-columns: minmax(0, 1fr); }
  .clean-arrow { transform: rotate(90deg); justify-self: center; }
  .feature-grid, .price-grid { grid-template-columns: minmax(0, 1fr); }
  .score-row { grid-template-columns: minmax(0, 1fr) auto; }
  .score-row .score-bar { grid-column: 1 / -1; grid-row: 2; }
  .period-toggle label { padding: 8px 12px; }
  .period-toggle label .badge { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .plan-mini { transition: none; } .plan-mini:hover { transform: none; } }

/* ---------- Статьи сайта (/blog): список и текст статьи ---------- */
.blog-narrow { max-width: 760px; }
.blog-body { max-width: 700px; } /* 65–75 знаков в строке */
.blog-index { padding-bottom: 72px; }
.blog-index h1, .blog-head h1 { font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.5rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 14px; overflow-wrap: anywhere; }
.blog-crumbs { margin: 0 0 18px; color: var(--muted); }
.blog-crumbs a { color: var(--muted); }
.blog-list { list-style: none; margin: 32px 0; padding: 0; display: grid; gap: 14px; }
.blog-list article { position: relative; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.blog-list article:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
/* Карточка нажимается целиком: ссылка заголовка растянута на неё. */
.blog-list h2 a::after, .blog-list h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.blog-list h2, .blog-list h3 { font-size: 1.2rem; line-height: 1.3; margin: 0 0 8px; }
.blog-list p { margin: 0 0 6px; }
.blog-article { padding: 32px 0 72px; }
.blog-head { margin-bottom: 28px; }
.blog-body { font-size: 1.06rem; line-height: 1.65; }
.blog-body > p:first-child { font-size: 1.14rem; }
.blog-body h2 { font-size: clamp(1.3rem, 1.1rem + .7vw, 1.6rem); letter-spacing: -.01em; margin: 2em 0 .5em; scroll-margin-top: 80px; }
.blog-body h3 { font-size: 1.12rem; margin: 1.5em 0 .4em; }
.blog-body ul, .blog-body ol { padding-left: 1.3em; }
.blog-body li { margin: .3em 0; }
.blog-body blockquote { margin: 1.2em 0; padding: 12px 18px; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.blog-body code { overflow-wrap: anywhere; }
/* Таблица прокручивается сама, страница вбок — нет (телефон от 320 px). */
.blog-table { overflow-x: auto; margin: 1.2em 0; border: 1px solid var(--border); border-radius: var(--radius-sm);
  /* Тень у края, пока таблицу есть куда листать (фон «local» уезжает вместе с содержимым). */
  background: linear-gradient(to right, var(--tbl-bg, var(--surface)) 30%, transparent) left / 32px 100% no-repeat local,
    linear-gradient(to left, var(--tbl-bg, var(--surface)) 30%, transparent) right / 32px 100% no-repeat local,
    linear-gradient(to right, color-mix(in srgb, var(--text) 14%, transparent), transparent) left / 12px 100% no-repeat scroll,
    linear-gradient(to left, color-mix(in srgb, var(--text) 14%, transparent), transparent) right / 12px 100% no-repeat scroll;
}
.blog-table table { width: 100%; border-collapse: collapse; font-size: .95rem; line-height: 1.45; }
.blog-table th, .blog-table td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.blog-table th { background: var(--bg); font-weight: 650; }
.blog-table tr:last-child td { border-bottom: 0; }
.blog-toc { margin: 0 0 28px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); font-size: .98rem; }
.blog-toc p { margin: 0 0 6px; font-weight: 650; }
.blog-toc ol { margin: 0; padding-left: 1.3em; }
.blog-note { margin: 1.4em 0; padding: 14px 18px; border-radius: var(--radius); background: var(--accent-soft); }
.blog-note > :last-child { margin-bottom: 0; }
.blog-cta { margin: 48px 0 0; padding: 24px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.blog-cta-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 8px; }
.blog-related { margin-top: 48px; }
.blog-related h2 { font-size: 1.3rem; }
.blog-related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.blog-related li a { font-weight: 650; }
.blog-related li p { margin: 4px 0 0; }
@media (max-width: 640px) {
  .blog-article { padding-top: 20px; }
  .blog-body { font-size: 1rem; }
  .blog-list article, .blog-cta { padding: 16px; }
  /* Узкая колонка таблицы ломает слова по букве: таблица шире экрана и прокручивается сама. */
  .blog-table table { min-width: 520px; }
}

/* ---------- Посадочные страницы продукта (/avtoposting-max и др., реестр productPages) ---------- */
.prod-hero .blog-crumbs { margin-bottom: 14px; }
.prod-hero-wide { max-width: 820px; }
.prod-hero h1 { font-size: clamp(1.8rem, 1.2rem + 2.2vw, 2.8rem); overflow-wrap: anywhere; }
.prod-sub { font-size: 1.12rem; margin: 0 0 .5em; }
.prod-sub:not(:first-child) { margin-top: 1.4em; }
/* Схема «источники → правило → канал» на первом экране. */
.prod-flow { margin: 0; display: grid; gap: 6px; justify-items: stretch; }
.prod-flow-box { padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow, none); }
.prod-flow-box p { margin: 4px 0 0; }
.prod-flow-box.is-target { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); }
.prod-flow-tag { color: var(--muted); font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.prod-flow-arrow { text-align: center; color: var(--muted); font-size: 1.2rem; line-height: 1; }
.prod-flow figcaption { margin-top: 6px; }
/* Ссылки на соседние страницы: строка с переносом. */
.prod-others { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: baseline; margin-top: 20px; }
.prod-others a { padding: 8px 0; } /* под палец: строка ссылок ≥ 36 px */
.cta-band .prod-others { justify-content: center; }
.plat-more { margin: 12px 0 0; }
.plat-more a { display: inline-block; padding: 6px 0; }
/* Сравнение — шесть колонок: на узком таблица прокручивается сама (.blog-table). */
.prod-cmp table { min-width: 880px; }
.prod-cmp tbody th { white-space: normal; min-width: 140px; }
.prod-cmp thead th:nth-child(2), .prod-cmp tbody td:first-of-type { background: var(--accent-soft); }
/* Подписи строк не уезжают при прокрутке вбок — видно, что сравнивается. */
.prod-cmp thead th:first-child, .prod-cmp tbody th { position: sticky; left: 0; z-index: 1; background: var(--surface-2); }
.band-alt .blog-table { --tbl-bg: var(--bg); }
@media (max-width: 560px) { .prod-cmp tbody th { min-width: 108px; } }
.site-foot-prod { flex-basis: 100%; }
.blog-cta-more { margin: 12px 0 0; }
