/* Шрифты у себя, не с Google Fonts: внешний CSS блокировал отрисовку, а поздняя подмена шрифта
   дёргала страницу при каждом переходе (владелец 28.08). Файлы — вариативные woff2 с fonts.gstatic.com,
   лицензия OFL. Кириллица и латиница отдельно, как у Google. */
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(/static/fonts/golos-cyr.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Golos Text"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(/static/fonts/golos-lat.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/static/fonts/unbounded-cyr.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/static/fonts/unbounded-lat.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Переходы между страницами: плавное перекрытие вместо белой вспышки (Chrome 126+, остальные — как раньше) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 120ms ease-out both wbc-fade-out; }
::view-transition-new(root) { animation: 180ms ease-in both wbc-fade-in; }
@keyframes wbc-fade-out { to { opacity: 0; } }
@keyframes wbc-fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }

/* wbchannels.ru — направление «Чистая витрина» (design/SYSTEM.md). Светлая тема, одна. */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #15121c;
  --muted: #6f6b7d;
  --line: #e6e8f0;
  --accent: #6d3df5;
  --accent-hover: #5b2fd8;
  --tint: #eee9ff;
  --ok: #166534;
  --ok-bg: #ecfdf3;
  --err: #991b1b;
  --err-bg: #fef2f2;
  --shadow: 0 1px 2px rgba(20, 16, 40, .04), 0 8px 24px rgba(20, 16, 40, .06);
  --shadow-hover: 0 2px 4px rgba(20, 16, 40, .06), 0 14px 32px rgba(20, 16, 40, .10);
  --display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --text: 'Golos Text', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --r: 12px;
  --r-lg: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.55 var(--text);
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 24px; line-height: 1.2; }
h3 { font-size: 18px; line-height: 1.3; }
p { margin: 0 0 12px; }
code { font-family: ui-monospace, 'JetBrains Mono', Consolas, monospace; font-size: .92em; }
small { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 40px; }
.section { margin-top: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-head p { margin: 0; color: var(--muted); font-size: 14px; }
.icon { width: 20px; height: 20px; flex: none; }

/* ── шапка ── */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; gap: 28px; height: 72px; }
.logo { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--ink); letter-spacing: -.01em; white-space: nowrap; }
.logo span { color: var(--accent); }
.logo:hover { color: var(--ink); }
.nav { display: flex; gap: 22px; align-items: center; font-weight: 500; font-size: 15px; }
.nav a { color: var(--ink); }
.nav a:hover { color: var(--accent); }
.header-right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border-radius: var(--r); background: var(--bg); color: var(--muted); }
.search input { flex: 1; min-width: 200px; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); outline: none; }
.search input::placeholder { color: var(--muted); }
.search button { border: 0; background: transparent; padding: 0; color: var(--muted); cursor: pointer; display: inline-flex; }
.search:focus-within { box-shadow: 0 0 0 2px var(--tint); }

/* ── кнопки ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; font-size: 15px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: #d3d6e3; color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-danger { color: var(--err); }

/* ── герой ── */
.hero { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px; align-items: start; padding: 56px 0 8px; }
.hero h1 { font-size: 52px; line-height: 1.08; margin-bottom: 16px; }
.hero .lead { font-size: 18px; color: var(--muted); margin: 0 0 24px; max-width: 620px; }
.hero-search { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 8px 0 18px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hero-search input { flex: 1; border: 0; background: transparent; font: inherit; font-size: 16px; outline: none; color: var(--ink); }
.hero-search .icon { color: var(--accent); }
.hero-search .btn { height: 40px; }
.hero-note { margin-top: 14px; font-size: 14px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); }
.stat dt { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.stat dd { margin: 0; font-size: 26px; font-weight: 500; line-height: 1.2; }
.stat dd small { font-size: 13px; font-weight: 400; margin-left: 6px; }

/* ── панель-список (топ) ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.panel h2 { font-size: 18px; margin-bottom: 12px; }
.ranked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ranked li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ranked li:first-child { border-top: 0; }
.ranked .rank { width: 20px; color: var(--muted); font-size: 14px; }
.ranked .name { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.ranked .name:hover { color: var(--accent); }
.ranked .val { color: var(--ink); font-size: 15px; }
.panel-foot { margin-top: 12px; font-size: 14px; }

/* ── плитки рубрик ── */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.tile { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px 0 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 500; font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.tile:hover { border-color: #d3d6e3; box-shadow: var(--shadow); color: var(--ink); }
.tile .num { color: var(--muted); font-size: 13px; font-weight: 400; }
.tile .icon { margin-left: auto; color: var(--muted); width: 18px; height: 18px; }
.tile.empty { color: var(--muted); }

/* ── карточки каналов ── */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.card-head { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.card-head:hover { color: var(--ink); }
.card-head:hover .card-title { color: var(--accent); }
.card-title { font-weight: 600; font-size: 17px; line-height: 1.3; }
.card-desc { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 14px; flex-wrap: wrap; margin: 0; font-size: 13px; color: var(--muted); }
.card-meta .up { color: var(--ok); }
.avatar { flex: none; width: 44px; height: 44px; border-radius: 12px; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; letter-spacing: .02em; }
img.avatar { object-fit: cover; background: #e5e7eb; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; border-radius: 9px; }
.avatar.big { width: 88px; height: 88px; font-size: 32px; border-radius: 20px; }
.empty { color: var(--muted); }

/* ── призыв ── */
.cta-box { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 32px; box-shadow: var(--shadow); margin-top: 48px; }
.cta-box h2 { margin-bottom: 8px; }
.cta-box p { margin: 0; color: var(--muted); max-width: 640px; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── страница канала ── */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 20px 0 16px; color: var(--muted); font-size: 14px; }
.crumbs .icon { width: 16px; height: 16px; color: var(--muted); }
.crumbs span:last-child { color: var(--ink); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.channel-head { display: flex; gap: 20px; align-items: center; margin: 8px 0 24px; }
.channel-head > div { flex: 1; min-width: 0; }
.channel-head h1 { font-size: 40px; margin-bottom: 6px; }
.channel-sub { color: var(--muted); margin: 0; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
.facts .stat dd { overflow-wrap: anywhere; }
.facts code { font-size: 14px; font-weight: 400; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tabs a, .tabs span { padding: 12px 0; font-size: 15px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs .active { color: var(--ink); border-color: var(--accent); }
.two-col { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 48px; align-items: start; }
.channel-desc p { max-width: 720px; white-space: pre-line; font-size: 17px; }
.hint { color: var(--muted); font-size: 14px; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.side-card h3 { margin-bottom: 8px; }
.side-card p { color: var(--muted); font-size: 14px; }
.growth { font-size: 14px; color: var(--ok); margin-left: 8px; }
.growth.down { color: var(--err); }

/* ── списки и сортировка ── */
.lead { font-size: 17px; color: var(--muted); max-width: 720px; }
.sort { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.sort b { font-weight: 500; color: var(--ink); }
.pager { display: flex; gap: 12px; margin-top: 24px; }
.intro { max-width: 720px; }

/* ── формы ── */
.form { max-width: 600px; display: flex; flex-direction: column; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow); }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 15px; }
.form label small { font-weight: 400; }
.form input[type=text], .form input[type=search], .form select, .form textarea {
  height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; width: 100%; outline: none;
}
.form textarea { height: auto; padding: 12px 14px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.notice { border-radius: var(--r); padding: 14px 16px; margin: 0 0 16px; max-width: 720px; }
.notice ul { margin: 0; padding-left: 18px; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.err { background: var(--err-bg); color: var(--err); }

/* ── тексты ── */
.prose { max-width: 760px; padding-top: 20px; }
.prose h1 { margin-bottom: 16px; }
.prose h2 { margin: 36px 0 12px; }
.prose h3 { margin: 24px 0 6px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose p { text-wrap: pretty; }

/* ── таблицы админки ── */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 500; background: var(--bg); }
.tbl tr:last-child td { border-bottom: 0; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; }
.row-actions .btn { height: 34px; padding: 0 12px; font-size: 13px; }

/* ── подвал ── */
.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 0 36px; color: var(--muted); font-size: 13px; background: var(--surface); }
/* подвал у низа экрана и на коротких страницах (владелец: «нижний бар подтянут к середине») */
body { display: flex; flex-direction: column; min-height: 100vh; }
main.wrap { flex: 1 0 auto; width: 100%; }
.site-footer { flex: none; }
.disclaimer { max-width: 760px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; margin: 0; }
.home-intro { max-width: 760px; margin-top: 48px; font-size: 15px; line-height: 1.6; }
.home-intro h2 { margin-bottom: 12px; }
.home-intro p { margin: 0 0 10px; }
.feed-h1 { margin: 24px 0 16px; }   /* как h1 на других страницах: там 20px крошек сверху, здесь крошек нет */
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

/* ── адаптив ── */
@media (max-width: 1024px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .nav { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .header-row { height: 60px; gap: 12px; }
  .search input { min-width: 0; width: 100%; }
  .header-right { flex: 1; }
  .search { flex: 1; }
  .hero { padding-top: 28px; }
  .hero h1 { font-size: 32px; }
  .hero .lead { font-size: 16px; }
  .hero-search { height: 52px; }
  .tiles, .grid, .facts { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat dd { font-size: 22px; }
  .channel-head { flex-direction: column; align-items: flex-start; }
  .channel-head h1 { font-size: 28px; }
  .cta-box { grid-template-columns: 1fr; padding: 24px; }
  .form { padding: 20px; }
  h1 { font-size: 30px; }
}

/* ── дополнения под шаблоны ── */
.empty-box { padding: 20px; border: 1px dashed var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--muted); font-size: 15px; }
.cta { margin-top: 24px; color: var(--muted); }
.form-layout { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); margin-top: 8px; }
.form-layout .side-card p { color: var(--ink); font-size: 15px; }
.form-layout .side-card p:last-child { margin-bottom: 0; }
.admin-search { max-width: 480px; margin: 8px 0 24px; }
.admin-search input { min-width: 0; }
h2.section { margin-top: 40px; margin-bottom: 12px; }
.stat dd .growth { margin-left: 10px; }
.stat dd small { display: block; margin: 2px 0 0; font-size: 13px; }
.hero-search .icon { width: 22px; height: 22px; }
.btn .icon { width: 18px; height: 18px; }
.ranked .val { font-size: 15px; }
.channel-head .actions { margin-left: auto; }
.tabs span { cursor: default; }
@media (max-width: 1024px) { .form-layout { grid-template-columns: minmax(0, 1fr); } .channel-head .actions { margin-left: 0; } }

/* ── мобильные уточнения после проверки в 390px ── */
.tabs { overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs span { flex: none; }
@media (max-width: 640px) {
  .header-row { gap: 8px; }
  .header-right { gap: 8px; min-width: 0; }
  .header-row .btn { height: 40px; padding: 0 14px; font-size: 14px; }
  .hide-sm { display: none; }
  .facts code { font-size: 13px; }
}
.history { max-width: 520px; }

/* ── подрубрики чипами ── */
.chips-label { margin: 16px 0 8px; font-size: 14px; color: var(--muted); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 14px; font-weight: 500; }
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip .num { color: var(--muted); font-size: 12px; font-weight: 400; }
.chip.empty { color: var(--muted); }

/* ── каталог с фильтрами и рейтинг-таблица ── */
/* ── каталог с фильтрами (/catalog) ── */
.catalog { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 8px; }
.filters { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 20px; }
.filter-group { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; box-shadow: var(--shadow); }
.filter-title { margin: 6px 12px 6px; font-size: 13px; color: var(--muted); }
.f-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; color: var(--ink); font-size: 15px; font-weight: 500; line-height: 1.3; }
.f-item .num { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 400; }
.f-item:hover { background: var(--bg); color: var(--ink); }
.f-item.sub { padding-left: 28px; font-weight: 400; font-size: 14px; }
.f-item.active { background: var(--tint); color: var(--accent); }
.f-item.active .num { color: var(--accent); }
.catalog-main { min-width: 0; }
.catalog-count { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.catalog-main .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1180px) { .catalog-main .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  /* minmax(0,…): с голым 1fr трек растягивался под nowrap-строку фильтров, и на 390px страница скроллилась вбок */
  .catalog { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .filters { position: static; gap: 10px; min-width: 0; max-width: 100%; }
  .filter-group { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 8px; scrollbar-width: none; }
  .filter-group::-webkit-scrollbar { display: none; }
  .filter-title { display: none; }
  .f-item, .f-item.sub { flex: none; padding: 8px 12px; font-size: 14px; border: 1px solid var(--line); border-radius: 999px; }
  .f-item .num { margin-left: 0; }
  .f-item.active { border-color: var(--accent); }
}

/* ── рейтинг (/top) ── */
.rank-wrap { overflow-x: auto; }
.rank-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); font-size: 15px; }
.rank-table th, .rank-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.rank-table th { font-size: 13px; font-weight: 500; color: var(--muted); background: var(--bg); }
.rank-table tr:last-child td { border-bottom: 0; }
.rank-table tbody tr:hover td { background: var(--bg); }
.rank-n { width: 48px; color: var(--muted); font-size: 16px; }
.rank-num { text-align: right; white-space: nowrap; }
.rank-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; }
.rank-link:hover { color: var(--accent); }
.rank-meta { display: block; margin: 4px 0 0 42px; font-size: 13px; color: var(--muted); }
@media (max-width: 640px) {
  .rank-week, .rank-since { display: none; }
  .rank-table th, .rank-table td { padding: 10px 10px; }
  .rank-meta { margin-left: 0; }
}

/* ── новости в стиле канала ── */
/* ── новости: лента в стиле канала мессенджера ── */
.feed { max-width: 680px; margin: 0 auto; padding-top: 20px; }
.feed-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); margin-bottom: 20px; }
.feed-avatar { background: var(--accent); width: 48px; height: 48px; border-radius: 14px; font-family: var(--display); font-size: 16px; }
.feed-title { font-size: 20px; margin: 0; }
.feed-sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.day { display: flex; justify-content: center; margin: 20px 0 12px; }
.day span { font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 18px 6px; padding: 14px 16px 10px; box-shadow: var(--shadow); margin-bottom: 10px; max-width: 92%; }
.msg-body { font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.msg-body p { margin: 0 0 10px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-meta { display: flex; justify-content: flex-end; margin-top: 4px; }
.msg-time { font-size: 12px; color: var(--muted); }
.msg-time:hover { color: var(--accent); }
.feed-foot { margin-top: 20px; font-size: 14px; }
.form .check { flex-direction: row; align-items: center; gap: 8px; }
.form .check input { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .msg { max-width: 100%; }
}

/* ── регионы и свёрнутые ветки каталога ── */
/* ── свёрнутые ветки в боковой колонке каталога ── */
.f-branch { margin: 0; }
.f-branch > summary { list-style: none; cursor: pointer; }
.f-branch > summary::-webkit-details-marker { display: none; }
.f-branch > summary .f-chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; flex: none; }
.f-branch[open] > summary .f-chev, .f-branch.open > .f-item .f-chev { transform: rotate(90deg); }
.f-branch > .f-item .f-chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; flex: none; margin-left: auto; }
#region-field select { height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; width: 100%; }
@media (max-width: 900px) {
  .f-branch { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; }
  .f-branch > summary { flex: none; }
}

/* ── фильтры рейтинга ── */
.rank-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); margin: 0 0 16px; }
.rank-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 220px; flex: 1; }
.rank-filters select { height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; }
.rank-filters .btn { height: 44px; }
.rank-reset { align-self: center; font-size: 14px; }
.rank-delta { display: block; font-size: 12px; color: var(--muted); }
.rank-delta.up { color: var(--ok); }
.rank-delta.down { color: var(--err); }
.rank-cat { font-size: 14px; }
.rank-cat a { color: var(--muted); }
.rank-cat a:hover { color: var(--accent); }
@media (max-width: 640px) { .rank-cat { display: none; } .rank-filters label { min-width: 0; flex-basis: 100%; } }

/* ── герой главной: поиск и кнопка добавления вместо шапочных ── */
.hero-actions { display: flex; gap: 12px; align-items: stretch; margin: 4px 0 14px; }
.hero-actions .hero-search { flex: 1; min-width: 0; }
.hero-actions .hero-add { height: 56px; padding: 0 24px; flex: none; }
@media (max-width: 640px) {
  .hero-actions { flex-direction: column; }
  .hero-actions .hero-add { height: 48px; }
}

/* лупа — такая же кнопка, как «Добавить канал», только квадратная и справа от поля */
.hero-actions .hero-search { padding: 0 0 0 18px; overflow: hidden; }
.hero-search-go { flex: none; width: 56px; height: 56px; margin: -1px -1px -1px 0; border: 0; border-radius: 0 var(--r) var(--r) 0; background: var(--accent); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.hero-search-go:hover { background: var(--accent-hover); }
.hero-search-go .icon { width: 22px; height: 22px; color: #fff; }
@media (max-width: 640px) { .hero-search-go { width: 52px; height: 52px; } }

/* ── доступность: фокус, skip-link, motion, sr-only ── */
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: var(--r); background: var(--accent); color: #fff; font-weight: 500; transition: top .15s; }
.skip:focus { top: 12px; outline: none; box-shadow: 0 0 0 3px var(--tint); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#main:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
a:focus-visible, .btn:focus-visible, .tile:focus-visible, .chip:focus-visible, .f-item:focus-visible, .card-head:focus-visible, .rank-link:focus-visible, .tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 4px var(--tint); }
.btn-primary:focus-visible, .hero-search-go:focus-visible { outline-color: var(--ink); }
.search:focus-within, .hero-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }
.search input:focus-visible, .hero-search input:focus-visible { outline: none; box-shadow: none; }
.form input:focus-visible, .form select:focus-visible, .form textarea:focus-visible, .rank-filters select:focus-visible, #region-field select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--tint); }
.f-item.active { font-weight: 600; }
.nav a.active { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); padding-bottom: 2px; }
.tbl-wrap { overflow-x: auto; border-radius: var(--r-lg); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .card:hover { transform: none; }
}

/* ── шапка на планшете и телефоне: навигация второй строкой ── */
@media (max-width: 1024px) {
  .header-row { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 12px 16px; }
  .nav { display: flex; order: 3; flex-basis: 100%; gap: 0; margin: 0 -40px; padding: 0 40px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; font-size: 15px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 8px 0 10px; margin-right: 22px; }
  .nav a.active { padding-bottom: 8px; }
  .header-right { margin-left: auto; }
  .site-header { top: 0; }
}
@media (max-width: 640px) {
  .header-row { padding-top: 8px; }
  .nav { margin: 0 -20px; padding: 0 20px; }
  .nav a { padding: 6px 0 9px; margin-right: 18px; }
  .rank-table { font-size: 14px; }
  .rank-n { width: 36px; font-size: 14px; }
  .rank-link { gap: 8px; }
  .rank-table th, .rank-table td { padding: 10px 8px; }
}
@media (max-width: 360px) {
  .wrap { padding: 0 14px; }
  .nav { margin: 0 -14px; padding: 0 14px; }
  .hero h1 { font-size: 28px; }
  h1 { font-size: 26px; }
  .card { padding: 16px; }
  .btn { padding: 0 16px; }
}

.hero > *, .panel, .catalog-main, .side-card { min-width: 0; }
.skip { max-width: calc(100vw - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; left: 12px; }
.card-region { color: var(--muted); }
.card-region:hover { color: var(--accent); }
/* 320px: шапка и каталог не шире экрана */
@media (max-width: 900px) {
  .catalog { grid-template-columns: minmax(0, 1fr); }
  .filters, .filter-group { min-width: 0; max-width: 100%; }
}
@media (max-width: 640px) {
  .logo { flex: none; }
  .header-right { flex: 1 1 0; min-width: 0; }
  .search { flex: 1 1 0; min-width: 0; padding: 0 10px; }
  .search input { flex: 1 1 0; width: 0; min-width: 0; }
  .header-row .btn { flex: none; }
}
@media (max-width: 640px) {
  .catalog-main .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 360px) {
  .header-row { gap: 6px; }
  .header-row .btn { padding: 0 10px; }
  .search { padding: 0 8px; }
}

/* ── полировка: детали, от которых интерфейс ощущается лучше ── */
h1, h2, h3 { text-wrap: balance; }
.lead, .card-desc, .hero-note, .empty-box, .hint { text-wrap: pretty; }
/* отклик на нажатие: прерываемый transition, только нужные свойства */
.btn, .hero-search-go, .tile, .chip, .f-item { transition-property: background-color, border-color, box-shadow, color, transform; transition-duration: .15s; transition-timing-function: cubic-bezier(.2, 0, 0, 1); }
.btn:active, .hero-search-go:active, .chip:active, .tile:active { transform: scale(.96); }
/* минимальная зона нажатия 40px: чипы и иконка поиска в шапке */
.chip { height: 40px; }
.search button { position: relative; width: 40px; height: 40px; margin-right: -10px; justify-content: center; align-items: center; }
/* аватары: тонкая обводка чистым чёрным, чтобы край не растворялся на белом */
.avatar { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
/* внутренние радиусы концентричны внешним (радиус = внешний − отступ) */
.side-card h3, .panel h2 { margin-top: 0; }
.form input[type=text], .form input[type=search], .form select, .form textarea { border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { .btn:active, .hero-search-go:active, .chip:active, .tile:active { transform: none; } }

/* ── карточка канала, вторая редакция: заголовок с метой, две колонки, панель подписчиков ── */
.channel-head { align-items: center; gap: 20px; margin: 8px 0 28px; }
.channel-title { flex: 1; min-width: 0; }
.channel-meta { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 15px; }
.channel-meta a { color: var(--ink); border-bottom: 1px solid var(--line); }
.channel-meta a:hover { color: var(--accent); border-color: var(--accent); }
.channel-body { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 32px; align-items: start; }
.channel-main > * + * { margin-top: 28px; }
.channel-about h2 { margin-bottom: 8px; }
.channel-about p { font-size: 17px; max-width: 680px; white-space: pre-line; text-wrap: pretty; }
.subs-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--shadow); }
.subs-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.subs-panel h2 { font-size: 15px; font-family: var(--text); font-weight: 500; color: var(--muted); letter-spacing: 0; }
.subs-big { font-size: 40px; line-height: 1.1; margin: 4px 0 6px; }
.subs-big .growth { font-size: 15px; margin-left: 10px; }
.subs-note, .subs-hint { color: var(--muted); font-size: 13px; margin: 0; }
.subs-hint { margin-top: 14px; }
.subs-panel .history { margin-top: 16px; max-width: 460px; }
.spark { display: block; flex: none; overflow: visible; }
.spark rect { fill: var(--line); }
.spark rect.last { fill: var(--accent); }
.channel-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 88px; }
.side-card .join { display: block; font-size: 13px; padding: 10px 12px; background: var(--bg); border-radius: 10px; overflow-wrap: anywhere; margin: 8px 0 10px; }
.side-num { font-size: 22px; margin: 4px 0; }
@media (max-width: 1024px) { .channel-body { grid-template-columns: 1fr; } .channel-side { position: static; } }
@media (max-width: 640px) { .channel-head { flex-direction: column; align-items: flex-start; } .subs-big { font-size: 32px; } }
.channel-main .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.channel-head h1 { font-size: 36px; }
@media (max-width: 640px) { .channel-main .grid { grid-template-columns: 1fr; } .channel-head h1 { font-size: 28px; } }

/* ── карточка канала: выравнивание ── */
.channel-head { margin-bottom: 24px; }
.channel-head .actions { flex: none; margin-left: auto; }
.channel-about { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--shadow); }
.channel-about h2, .subs-panel h2 { font-size: 15px; font-family: var(--text); font-weight: 500; color: var(--muted); letter-spacing: 0; margin: 0 0 8px; }
.channel-about p { margin: 0; }
.channel-main > * + * { margin-top: 16px; }
.channel-main .section { margin-top: 32px; }
.channel-side .side-card { padding: 20px 22px; }
.side-card h3 { font-size: 15px; font-family: var(--text); font-weight: 500; color: var(--muted); letter-spacing: 0; margin: 0 0 8px; }
.side-card p { font-size: 14px; }
@media (max-width: 640px) { .channel-head .actions { margin-left: 0; } }

/* ── меньше карточек: карточка канала, фильтры рейтинга, вводный текст формы ── */
.channel-about, .subs-panel, .channel-side .side-card { background: transparent; border: 0; border-radius: 0; box-shadow: none; padding: 0; }
.channel-side .side-card + .side-card { border-top: 1px solid var(--line); padding-top: 16px; }
.channel-side { gap: 16px; }
.channel-main > * + * { margin-top: 28px; }
.subs-panel .history { margin-top: 12px; }
.side-card .join { background: var(--surface); border: 1px solid var(--line); }
.rank-filters { background: transparent; border: 0; box-shadow: none; padding: 0; margin: 0 0 12px; }
.form-layout .side-card, .add-intro { background: transparent; border: 0; box-shadow: none; padding: 0; }

/* ── и на остальных страницах: рамки только там, где есть что обрамлять ── */
.panel { background: transparent; border: 0; box-shadow: none; padding: 0 0 0 24px; border-left: 1px solid var(--line); border-radius: 0; }
.filters { background: transparent; border: 0; box-shadow: none; padding: 0 16px 0 0; border-radius: 0; }
.form { background: transparent; border: 0; box-shadow: none; padding: 0; }
.rank-wrap { background: transparent; border: 0; box-shadow: none; }
@media (max-width: 1024px) { .panel { padding-left: 0; border-left: 0; padding-top: 16px; border-top: 1px solid var(--line); } }

/* ── карточка канала, третья редакция: верхний блок с инфой (как у tgstat), ниже плитки показателей ── */
.ch-card { display: grid; grid-template-columns: 120px minmax(0, 1fr) 240px; gap: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow); margin: 8px 0 20px; }
.avatar.xl { width: 120px; height: 120px; font-size: 40px; border-radius: 28px; }
.ch-info { min-width: 0; }
.ch-info h1 { font-size: 34px; margin: 4px 0 12px; }
.ch-link { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 36px; padding: 0 6px 0 12px; border: 1px solid var(--accent); border-radius: 999px; color: var(--accent); }
.ch-link code { font-size: 13px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-copy { border: 0; background: transparent; color: var(--accent); width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ch-copy:hover { background: var(--tint); }
.ch-copy[data-done] { color: var(--ok); }
.ch-copy .icon { width: 16px; height: 16px; }
.ch-rule { border: 0; border-top: 1px solid var(--line); margin: 18px 0 14px; }
.ch-desc { font-size: 16px; max-width: 640px; margin: 0 0 12px; white-space: pre-line; text-wrap: pretty; }
.ch-links { margin: 0; font-size: 14px; }
.ch-links a { border-bottom: 1px dashed currentColor; }
.ch-links .sep { color: var(--line); margin: 0 4px; }
.ch-aside { display: flex; flex-direction: column; gap: 20px; align-items: flex-end; text-align: right; }
.ch-facts { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ch-facts dt { font-size: 13px; color: var(--muted); }
.ch-facts dd { margin: 0; font-size: 15px; }
.ch-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ch-actions .btn { width: 100%; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; box-shadow: var(--shadow); position: relative; min-height: 150px; }
.metric-wide { grid-column: 1 / -1; }
.metric-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.metric-big { font-size: 34px; line-height: 1.1; margin: 0; }
.metric-name { margin: 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: right; }
.metric-rows { margin: 14px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.metric-rows div { display: flex; gap: 10px; align-items: baseline; }
.metric-rows dt { min-width: 84px; color: var(--ink); }
.metric-rows dt.up { color: var(--ok); }
.metric-rows dt.down { color: var(--err); }
.metric-rows dd { margin: 0; color: var(--muted); }
.metric .spark { position: absolute; right: 22px; bottom: 18px; }
.metric .history { margin-top: 12px; max-width: 520px; }
@media (max-width: 900px) {
  .ch-card { grid-template-columns: 88px minmax(0, 1fr); }
  .avatar.xl { width: 88px; height: 88px; font-size: 30px; border-radius: 20px; }
  .ch-aside { grid-column: 1 / -1; align-items: stretch; text-align: left; }
  .ch-facts { flex-direction: row; flex-wrap: wrap; gap: 16px 24px; }
  .ch-actions { flex-direction: row; }
  .ch-actions .btn { width: auto; flex: 1; }
}
@media (max-width: 640px) {
  .ch-card { padding: 20px; gap: 16px; }
  .ch-info h1 { font-size: 26px; }
  .metrics { grid-template-columns: 1fr; }
  .metric .spark { position: static; margin-top: 12px; }
}

/* ── единый вертикальный ритм: 48 между блоками, 16 между заголовком блока и содержимым ── */
.hero { padding: 48px 0 0; }
.hero .lead { margin-bottom: 20px; }
.hero-actions { margin: 0 0 12px; }
.hero-note { margin: 0; }
.section, .cta-box { margin-top: 48px; }
.section-head { margin: 0 0 16px; align-items: center; }
.section-head h2, .section-head a { line-height: 1.2; }
.panel h2 { margin: 0 0 12px; }
.tiles, .grid { margin: 0; }
.site-footer { margin-top: 48px; }
@media (max-width: 640px) { .hero { padding-top: 28px; } .section, .cta-box { margin-top: 36px; } .site-footer { margin-top: 36px; } }
.rank-filters { margin-top: 16px; }
h1 + .rank-filters, h1 + .lead, h1 + .sort { margin-top: 16px; }
.hero { align-items: stretch; }
.hero .panel { display: flex; flex-direction: column; }
.hero .panel-foot { margin-top: auto; margin-bottom: 0; padding-top: 12px; }
.hero .panel { padding-top: 5px; }   /* верх букв «По подписчикам» на линии верха букв h1: замерено по canvas-метрикам шрифта */
.hero .panel-foot { margin-bottom: 1.55em; }   /* на одну строку выше: вровень с первой строкой подводки слева */
.hero .panel-foot { padding-top: 0; }
/* панель «По подписчикам» держит те же направляющие, что левая колонка:
   заголовок — по верху букв h1, линия под последней строкой — по низу кнопок, «Весь рейтинг» — по строке подводки */
.hero .ranked { flex: 1; }
.hero .ranked li { flex: 1; }
.hero .panel-foot { padding-top: 12px; border-top: 1px solid var(--line); }
.hero .ranked li:last-child { border-bottom: 0; }
.hero .ranked li { padding: 4px 0; min-height: 44px; }
/* числа в колонке фильтров — в одной колонке у всех строк; шеврон занимает свой слот справа от числа */
.filters .f-item::after { content: ""; width: 16px; flex: none; }
.filters .f-branch > .f-item::after { display: none; }
.filters .f-branch > .f-item .f-chev { margin-left: 0; }
@media (max-width: 900px) { .filters .f-item::after { display: none; } }
.catalog { grid-template-columns: 280px minmax(0, 1fr); }
.filters .f-item { white-space: nowrap; }
h1 + .catalog { margin-top: 20px; }

/* ── плитка подписчиков с графиком на всю ширину ── */
.metric-subs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 45%); gap: 24px; align-items: end; min-height: 0; }
.metric-subs .metric-body { min-width: 0; }
.chart { width: 100%; height: 96px; display: block; overflow: visible; }
.chart-area { fill: var(--tint); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; }
@media (max-width: 640px) { .metric-subs { grid-template-columns: 1fr; } }
.metric-subs .metric-head { justify-content: flex-start; gap: 14px; }
.metric-subs .metric-name { text-align: left; }
.metric-subs .metric-rows dt { min-width: 96px; }
.metric-subs { align-items: center; }
.chart-note { margin: 0; color: var(--muted); font-size: 14px; text-align: right; }
@media (max-width: 640px) { .chart-note { text-align: left; } }
.chart-wrap { min-width: 0; }
.chart-dash { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 5; vector-effect: non-scaling-stroke; opacity: .55; }
.chart-ticks { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-note { display: none; }
/* карточка: под названием — подписчики, ниже описание, регион внизу */
.card-title-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-subs { font-size: 13px; color: var(--muted); font-weight: 400; }
.card-meta { margin-top: auto; }
.card-region { color: var(--muted); }
.card-region:hover { color: var(--accent); }
.chart-dash { opacity: .8; }
.chart-area-dash { fill: var(--tint); opacity: .5; }

/* ── карточки одинаковой анатомии: 2 строки на название, 2 на описание, строка региона всегда ── */
.card { gap: 0; }
.card-head { align-items: flex-start; min-height: 48px; }
.card-title-wrap { min-height: 44px; justify-content: flex-start; }
.card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-wrap: normal; }
.card-desc { margin: 12px 0 0; height: 42px; line-height: 21px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-wrap: normal; flex: none; }
.card-meta { margin: 12px 0 0; min-height: 20px; line-height: 20px; }
.card-head { height: 64px; min-height: 0; }
.card-title-wrap { min-height: 0; }

/* ── карточка: название в одну строку, под ним подписчики и регион, ниже две строки описания ── */
.card-head { height: auto; min-height: 44px; align-items: center; }
.card-title-wrap { min-width: 0; flex: 1; gap: 2px; }
.card-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-subs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-desc { margin: 12px 0 0; height: 42px; }
.card-meta { display: none; }
.catalog .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .catalog .grid { grid-template-columns: 1fr; } }
.card-avatar { display: inline-flex; flex: none; }
.card-title { color: var(--ink); }
.card-title:hover { color: var(--accent); }
.card-region { color: var(--muted); border-bottom: 1px solid transparent; }
.card-region:hover { color: var(--accent); }

/* ── карточка канала: факты слева одной строкой, справа только кнопка ── */
.ch-card { grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; }
.ch-aside { align-self: center; }
.ch-meta { margin: 0; font-size: 14px; }
.ch-meta .sep { color: var(--line); margin: 0 6px; }
.metric-subs { grid-template-columns: minmax(0, 1fr) minmax(280px, 50%); align-items: end; }
.chart { height: 64px; }
@media (max-width: 900px) { .ch-card { grid-template-columns: 88px minmax(0, 1fr); } .ch-aside { grid-column: 1 / -1; } }
.rank-reg { font-size: 14px; white-space: nowrap; }
.rank-reg a { color: var(--muted); }
.rank-reg a:hover { color: var(--accent); }
.rank-table td { vertical-align: middle; }
.rank-table tr { height: 56px; }
@media (max-width: 640px) { .rank-reg { display: none; } }
/* плитка подписчиков: число и график на одной оси, график — спарклайн */
.metric-subs { grid-template-columns: minmax(0, 1fr) minmax(260px, 44%); align-items: center; padding: 18px 22px; min-height: 0; }
.metric-subs .metric-head { align-items: baseline; }
.metric-subs .metric-rows { margin-top: 6px; }
.chart-wrap { padding-top: 6px; }
.chart { height: 44px; }
.chart-ticks { margin-top: 4px; }

/* ── подписчики под верхним блоком без рамки: одна карточка на странице, не две ── */
.metrics .metric-subs { background: transparent; border: 0; box-shadow: none; padding: 8px 0 0; border-radius: 0; }
.metrics .metric { min-height: 0; }
.metrics { gap: 0; }

/* ── верхний блок: подписчики как главная цифра справа, над кнопкой; динамика — секцией при истории ── */
.ch-aside { align-items: flex-end; text-align: right; gap: 14px; }
.ch-stat-num { font-size: 36px; line-height: 1.1; margin: 0; }
.ch-stat-label { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.ch-stat-label .growth { margin: 0; }
.history-wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.history-wrap .chart { height: 120px; }
@media (max-width: 900px) { .ch-aside { align-items: flex-start; text-align: left; } .history-wrap { grid-template-columns: 1fr; } }
/* верхний блок: всё от верхней линии — аватар, заголовок, правая колонка */
.ch-card { align-items: start; }
.ch-aside { align-self: start; padding-top: 6px; }
.ch-info h1 { margin-top: 0; line-height: 1.05; }
.avatar.xl { margin-top: 2px; }

/* ── верхний блок канала, композиция по tgstat ── */
.ch-card { grid-template-columns: 96px minmax(0, 1fr) 220px; gap: 24px 32px; padding: 32px; align-items: start; }
.avatar.xl { width: 96px; height: 96px; font-size: 34px; border-radius: 24px; margin: 0; }
.ch-info h1 { font-size: 32px; line-height: 1.1; margin: 0 0 12px; }
.ch-link { height: 34px; margin: 0 0 14px; }
.ch-rule { display: none; }
.ch-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.tag { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--bg); color: var(--ink); font-size: 13px; font-weight: 500; }
.tag:hover { color: var(--accent); background: var(--tint); }
.ch-desc { margin: 0; font-size: 16px; line-height: 1.5; max-width: 620px; }
.ch-aside { align-items: stretch; text-align: right; gap: 16px; padding-top: 4px; align-self: start; }
.ch-facts { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.ch-facts dt { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.ch-facts dd { margin: 0; font-size: 16px; }
.ch-facts .ch-stat-num { font-size: 32px; line-height: 1.1; }
.ch-growth { font-size: 13px; }
.ch-aside .btn { width: 100%; }
.ch-owner { font-size: 13px; color: var(--muted); }
.ch-owner:hover { color: var(--accent); }
@media (max-width: 900px) {
  .ch-card { grid-template-columns: 72px minmax(0, 1fr); padding: 20px; gap: 16px; }
  .avatar.xl { width: 72px; height: 72px; font-size: 26px; border-radius: 18px; }
  .ch-aside { grid-column: 1 / -1; text-align: left; align-items: flex-start; }
  .ch-facts { flex-direction: row; gap: 24px; }
  .ch-aside .btn { width: auto; }
}

/* ── верхний блок канала: три ряда на одной сетке, шаг 16px ── */
.ch-card { display: flex; flex-direction: column; gap: 16px; padding: 32px; }
.ch-head { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 0 16px; align-items: start; }
.avatar.xl { width: 72px; height: 72px; font-size: 26px; border-radius: 18px; margin: 0; }
.ch-title { display: flex; flex-direction: column; justify-content: space-between; height: 72px; min-width: 0; }
.ch-title h1 { font-size: 30px; line-height: 34px; margin: 0; }
.ch-title .ch-link { height: 30px; margin: 0; }
.ch-open { height: 48px; }
.ch-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 15px; line-height: 24px; }
.ch-facts li b { font-weight: 500; }
.ch-facts .growth { margin-left: 8px; font-size: 14px; }
.ch-facts .ch-owner { font-size: 15px; }
.ch-card .ch-desc { margin: 0; font-size: 16px; line-height: 24px; max-width: 720px; }
.ch-aside, .ch-tags, .ch-info { display: none; }
@media (max-width: 640px) {
  .ch-card { padding: 20px; }
  .ch-head { grid-template-columns: 56px minmax(0, 1fr); }
  .avatar.xl { width: 56px; height: 56px; font-size: 22px; border-radius: 14px; }
  .ch-title { height: auto; gap: 8px; }
  .ch-title h1 { font-size: 24px; line-height: 28px; }
  .ch-open { grid-column: 1 / -1; margin-top: 16px; }
}
.ch-card { align-items: stretch; }
.ch-facts { flex-direction: row; }
/* динамика: график в высоту таблицы, общие верх и низ */
.history-wrap { align-items: stretch; }
.history-wrap .chart-wrap { display: flex; flex-direction: column; padding-top: 0; }
.history-wrap .chart { flex: 1; height: auto; min-height: 96px; }
.history-wrap .chart-ticks { margin-top: 6px; line-height: 20px; }
.history-wrap .history { margin: 0; }

.ch-title .ch-link { align-self: flex-start; max-width: 100%; }

/* ── шапка канала: ссылка + компактная кнопка рядом, подписчики справа ── */
.ch-linkrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ch-linkrow .ch-link { align-self: auto; }
.ch-open.btn-sm { height: 34px; padding: 0 14px; font-size: 14px; }
.ch-subs { text-align: right; align-self: start; }
.ch-subs-num { font-size: 32px; line-height: 34px; margin: 0; }
.ch-subs-label { margin: 2px 0 0; font-size: 14px; color: var(--muted); white-space: nowrap; }
.ch-subs-label .growth { margin-left: 6px; font-size: 14px; }
@media (max-width: 640px) { .ch-subs { grid-column: 1 / -1; text-align: left; margin-top: 4px; } .ch-linkrow { gap: 8px; } }
/* ссылка без пилюли: просто текст с иконкой копирования */
.ch-linkrow .ch-link { border: 0; padding: 0; height: auto; gap: 4px; color: var(--accent); }
.ch-linkrow .ch-link code { font-size: 14px; }
.ch-linkrow .ch-copy { width: 28px; height: 28px; }
.ch-subs-num { font-size: 15px; line-height: 34px; white-space: nowrap; }
.ch-subs-num b { font-weight: 500; font-size: 28px; margin-right: 2px; }
.ch-subs-label .growth { margin: 0; }
.ch-subs { display: flex; flex-direction: column; align-items: flex-end; gap: 0; }
.ch-subs-num { font-size: 28px; line-height: 34px; margin: 0; }
.ch-subs-word { margin: 0; font-size: 14px; line-height: 18px; color: var(--muted); }
.ch-subs-label { margin: 2px 0 0; font-size: 13px; line-height: 18px; }
.history-wrap .chart-wrap { padding: 0; }
.history-wrap .history { align-self: start; }
.history-wrap .chart-ticks { line-height: 18px; margin-top: 8px; }
.history-wrap .chart { min-height: 0; }
.history-wrap .chart-wrap { align-self: stretch; }
.history-wrap .chart { height: 0; flex: 1 1 0; }

/* ── новости как окно мессенджера ── */
.feed { max-width: 760px; margin: 0 auto; padding-top: 8px; }
.feed-frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.feed-head { margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 12px 16px; gap: 12px; }
.feed-avatar { width: 44px; height: 44px; border-radius: 12px; font-size: 15px; }
.feed-who { flex: 1; min-width: 0; }
.feed-title { font-size: 17px; font-family: var(--text); font-weight: 600; letter-spacing: 0; }
.feed-sub { font-size: 13px; }
.feed-rss { color: var(--muted); display: inline-flex; padding: 8px; border-radius: 10px; }
.feed-rss:hover { color: var(--accent); background: var(--bg); }
.feed-body { background: #eceef5; padding: 16px 16px 20px; }
.day { margin: 8px 0 12px; }
.day span { background: rgba(255, 255, 255, .85); border: 0; color: var(--muted); font-size: 12px; padding: 4px 10px; }
.msg { max-width: 78%; margin: 0 0 8px; border: 0; box-shadow: 0 1px 1px rgba(20, 16, 40, .06); border-radius: 4px 16px 16px 16px; padding: 10px 14px 8px; }
.msg-from { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--accent); }
.msg-body { font-size: 15px; line-height: 1.5; }
.msg-meta { margin-top: 2px; }
.msg-time { font-size: 11px; }
.feed .pager { margin-top: 16px; }
@media (max-width: 640px) { .feed-body { padding: 12px; } .msg { max-width: 94%; } }
.feed-body { min-height: 360px; }

/* ── форма добавления: подпись, подсказка, поле; справа структурированная справка ── */
.form { gap: 20px; }
.form label { gap: 6px; }
.form .lbl { font-weight: 500; font-size: 15px; }
.form label small { color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: -2px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form p { margin: 4px 0 0; }
.form-layout { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 48px; align-items: start; }
.add-help { padding-top: 34px; display: flex; flex-direction: column; gap: 24px; }
.help-block h2 { font-family: var(--text); font-weight: 600; font-size: 15px; letter-spacing: 0; margin: 0 0 8px; }
.help-block ol, .help-block ul { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.55; color: var(--ink); }
.help-block li { margin-bottom: 4px; }
.help-block li::marker { color: var(--muted); }
.help-block code { font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.help-note { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
@media (max-width: 900px) { .form-layout { grid-template-columns: 1fr; gap: 32px; } .add-help { padding-top: 0; } .form-row { grid-template-columns: 1fr; } }
.lbl-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lbl-row small { margin: 0; }
.form-row label { justify-content: flex-end; }
.form-row .lbl-row { flex-wrap: nowrap; white-space: nowrap; }
.form-row .lbl-row small { overflow: hidden; text-overflow: ellipsis; }
.help-block p { margin: 0; font-size: 14px; line-height: 1.55; }
.footer-links { justify-content: flex-end; }
.rank-stats { display: flex; gap: 28px; margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.rank-stat-n { font-size: 22px; color: var(--ink); margin-right: 4px; line-height: 1; }
h1 + .rank-stats + .rank-filters { margin-top: 20px; }

/* ── счётчики у заголовка рейтинга ── */
.rank-titlebar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.rank-titlebar h1 { margin: 0; }
.counters { display: flex; gap: 10px; margin: 0; }
.counter { display: flex; flex-direction: column; align-items: flex-start; min-width: 132px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.counter dd { margin: 0; font-size: 22px; line-height: 26px; }
.counter dt { font-size: 12px; color: var(--muted); line-height: 16px; }
.counter-new dd { color: var(--ok); }
.rank-stats { display: none; }
.rank-titlebar + .rank-filters { margin-top: 20px; }
@media (max-width: 640px) { .counters { width: 100%; } .counter { flex: 1; min-width: 0; } }
.counter { background: transparent; border: 0; padding: 0; min-width: 0; }
.counters { gap: 28px; padding-bottom: 6px; }
.counter dd { font-size: 24px; line-height: 28px; }
.counters { padding-bottom: 0; }
.counter dt { line-height: 18px; }
/* выравнивание по глифам: верх цифры = верх букв h1, базовая линия подписи = базовая линия h1 (замер canvas) */
.counter dd { margin-bottom: -5px; }
.counters { margin-bottom: 2.5px; }
/* подсветка только у той ссылки, на которой курсор */
.card-head:hover .card-title { color: var(--ink); }
.card-head .card-title:hover { color: var(--accent); }
h1 + .chips { margin-top: 16px; }
.chips + .sort, .chips + .grid { margin-top: 16px; }
.rank-reset { align-self: flex-end; height: 44px; line-height: 44px; display: inline-block; }
.feed-link { display: flex; align-items: center; gap: 12px; color: var(--ink); flex: 1; min-width: 0; }
.feed-link:hover .feed-title { color: var(--accent); }
.feed-who { display: flex; flex-direction: column; min-width: 0; }
.feed-title { display: block; }
.feed-sub { display: block; }
.feed-open { flex: none; }
.opt-top { font-weight: 600; }
.history-solo { grid-template-columns: 1fr; }
.history-solo .chart { height: 120px; flex: none; }
.history-wrap .chart { min-height: 96px; }
.history-wrap .chart-wrap { padding-right: 5px; }
.history-wrap .chart-wrap { position: relative; }
.chart-dot-html { position: absolute; right: 0; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-sizing: border-box; }
.chart-box { position: relative; flex: 1; display: flex; min-height: 96px; }
.chart-box .chart { flex: 1; height: auto; min-height: 0; }
.chart-dot-html { right: -5px; }
.chart-box { min-height: 0; }
.history-wrap .chart { min-height: 0; }
.history-wrap .chart-wrap { align-self: stretch; }
.chart-box { flex: 1 1 0; min-height: 0; display: block; }
.chart-box .chart { position: absolute; inset: 0; width: 100%; height: 100%; }
.feed-actions { display: flex; gap: 8px; flex: none; }
@media (max-width: 640px) { .feed-actions { flex-wrap: wrap; } }

/* в конце файла, чтобы перебить .catalog { 280px … } выше: на телефоне одна колонка, трек minmax(0,…) */
@media (max-width: 900px) { .catalog { grid-template-columns: minmax(0, 1fr); } }

/* Телефон: поиск в шапке ужимался до 46px («Най»). Поиск — отдельной строкой на всю ширину,
   кнопка «Добавить» остаётся у логотипа. display: contents выносит детей .header-right в строку шапки. */
@media (max-width: 640px) {
  .header-right { display: contents; }
  .header-right .btn { order: 2; margin-left: auto; }
  .search { order: 4; flex-basis: 100%; margin: 0 0 10px; }
  .search input { min-width: 0; }
}
