/* ───────── Токены ───────── */
:root {
  color-scheme: light;
  /* тёплые нейтральные + тлеющий акцент из аватарки канала */
  --bg: #f7f4ee;
  --surface: #fdfbf7;
  --surface-2: #efe9df;
  --text: #1f1b16;
  --text-2: #5e554a;
  --muted: #72695d;
  --line: #e7e1d6;
  --line-strong: #d3cbbe;
  --accent: #b5361b;
  --accent-ink: #ffffff;
  --accent-soft: #f6e4dc;
  --good: #16a34a;
  --bad: #dc2626;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --shadow: 0 1px 2px rgba(31, 27, 22, .05), 0 8px 24px rgba(31, 27, 22, .06);
  /* площадки: проверенная палитра (3 цвета, различимы при дальтонизме) */
  --c-youtube: #d95926;
  --c-tiktok: #1baf7a;
  --c-telegram: #2a78d6;
  --radius: 16px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161513;
    --surface: #1c1a18;
    --surface-2: #262421;
    --text: #efe9de;
    --text-2: #aaa398;
    --muted: #8a847a;
    --line: #2e2b27;
    --line-strong: #3d3a35;
    --accent: #f07a4a;
    --accent-ink: #161513;
    --accent-soft: #3a2219;
    --good: #4cc38a;
    --bad: #e5484d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .2);
    --c-youtube: #d95926;
    --c-tiktok: #199e70;
    --c-telegram: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161513;
  --surface: #1c1a18;
  --surface-2: #262421;
  --text: #efe9de;
  --text-2: #aaa398;
  --muted: #8a847a;
  --line: #2e2b27;
  --line-strong: #3d3a35;
  --accent: #f07a4a;
  --accent-ink: #161513;
  --accent-soft: #3a2219;
  --good: #4cc38a;
  --bad: #e5484d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .2);
  --c-youtube: #d95926;
  --c-tiktok: #199e70;
  --c-telegram: #3987e5;
}

/* ───────── База ───────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.15; margin: 0; }
h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -.01em; }
h3 { font-size: 17px; }
p { margin: 0; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
section { padding: 48px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head p { color: var(--text-2); max-width: 560px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────── Шапка ───────── */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-display); font-weight: 500; font-size: 17px; }
.brand img, .brand .ph { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.topbar nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.topbar nav a.link { text-decoration: none; color: var(--text-2); padding: 6px 10px; border-radius: 8px; font-size: 14px; transition: background-color .15s var(--ease), color .15s var(--ease); }
.topbar nav a.link:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 720px) { .topbar nav a.link { display: none; } }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); font: 500 13px var(--font); padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--text); color: var(--bg); font: 500 15px var(--font); height: 48px; padding: 0 20px; border-radius: 10px;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease); }
.btn:hover { background: color-mix(in srgb, var(--text) 86%, var(--bg)); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ───────── Первый экран: текст слева, огненный арт канала справа ───────── */
.hero { padding: 64px 0 32px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.hero .kicker { color: var(--text-2); font-size: 15px; margin-bottom: 12px; }
.hero h1 { font-size: clamp(40px, 6.4vw, 68px); letter-spacing: -.03em; line-height: 1.04; margin-bottom: 16px; }
.hero .tagline { font-size: clamp(17px, 2vw, 20px); line-height: 1.5; color: var(--text-2); max-width: 36rem; margin-bottom: 32px; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-visual { position: relative; padding-bottom: 72px; }
.hero-art { width: 100%; max-width: 440px; aspect-ratio: 1; margin-left: auto; border-radius: 20px; overflow: hidden; background: var(--surface-2); }
.hero-art img { width: 100%; height: 100%; object-fit: cover; }
.hero-visual.no-art { padding-bottom: 0; }
.hero-visual.no-art .hero-art { display: none; }
.hero-visual.no-art .hero-card { position: static; width: 100%; }
.hero-card { position: absolute; left: 0; bottom: 0; width: min(380px, 88%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px 24px 24px; box-shadow: var(--shadow); }
.hero-card .label { color: var(--text-2); font-size: 14px; }
.hero-card .big { font-family: var(--font-display); font-size: clamp(40px, 5vw, 56px); font-weight: 500; letter-spacing: -.03em; line-height: 1.05; margin: 4px 0 16px; font-variant-numeric: tabular-nums; }
.live { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-top: 16px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
@media (max-width: 860px) {
  .hero { padding: 40px 0 24px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-visual { padding-bottom: 0; }
  .hero-art { max-width: none; aspect-ratio: 16 / 10; }
  .hero-art img { object-position: center 30%; }
  .hero-card { position: relative; width: auto; margin: -64px 16px 0; }
}

/* Доля аудитории по площадкам */
.share-bar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; margin-bottom: 16px; }
.share-bar span { display: block; height: 100%; min-width: 4px; }
.share-legend { display: grid; gap: 8px; }
.share-legend .row { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 12px; align-items: center; font-size: 14px; }
.share-legend .row .v { font-weight: 500; font-variant-numeric: tabular-nums; }
.share-legend .row .p { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* ───────── Показатели ───────── */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.kpi .label { color: var(--text-2); font-size: 14px; }
.kpi .value { font-size: clamp(28px, 3.2vw, 32px); font-weight: 500; line-height: 1.1; margin-top: 8px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ───────── Площадки: таблица как экран итогов матча ───────── */
.board { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.board-head, .board-row { display: grid; grid-template-columns: minmax(170px, 1.4fr) repeat(var(--cols), minmax(0, 1fr)); gap: 16px; align-items: center; padding: 0 24px; }
.board-head { height: 44px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.board-head span:not(:first-child), .board-row .cell { text-align: right; }
.board-row { min-height: 72px; border-bottom: 1px solid var(--line); position: relative; }
.board-row:last-child { border-bottom: 0; }
.board-row::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--pc); }
.board .pname { display: flex; align-items: center; gap: 10px; font-weight: 500; text-decoration: none; }
.board .pname .icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.board .pname .icon svg { width: 16px; height: 16px; fill: var(--text); }
.board .pname .ext { color: var(--muted); font-size: 13px; transition: color .15s var(--ease); }
.board a.pname:hover .ext { color: var(--text); }
.board .cell .k { display: none; }
.board .cell .v { font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.board .cell.lead .v { font-size: 20px; }
@media (max-width: 720px) {
  .board-head { display: none; }
  .board-row { grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 20px 20px 20px 24px; }
  .board-row::before { top: 20px; bottom: 20px; }
  .board .pname { grid-column: 1 / -1; }
  .board-row .cell { text-align: left; }
  .board .cell .k { display: block; color: var(--muted); font-size: 13px; }
}

/* ───────── Графики ───────── */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.chart-card .chart-title { font-weight: 500; font-size: 17px; margin-bottom: 4px; }
.chart-card .chart-sub { color: var(--text-2); font-size: 14px; margin-bottom: 16px; }
.chart-box { position: relative; height: 300px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; font-size: 14px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.sq { width: 10px; height: 10px; border-radius: 3px; }

/* ───────── О нас ───────── */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.about.single { grid-template-columns: 1fr; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }
.about .box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.about .box h3 { margin-bottom: 12px; }
.about .box p { color: var(--text-2); white-space: pre-line; }

/* ───────── Лучшие ролики ───────── */
.videos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 860px) { .videos { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .videos { grid-template-columns: 1fr; } }
.vcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-decoration: none; display: flex; flex-direction: column; transition: border-color .15s var(--ease); }
.vcard:hover { border-color: var(--line-strong); }
.vthumb { aspect-ratio: 16 / 9; background: var(--surface-2); position: relative; overflow: hidden; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 1; }
.vthumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; padding: 12px; text-align: center; }
.vbadge { position: absolute; z-index: 2; left: 12px; top: 12px; display: inline-flex; align-items: center; gap: 6px; background: rgba(22, 21, 19, .78); color: #fff; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 6px; }
.vbody { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.vtitle { font-weight: 500; font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vstats { display: flex; gap: 16px; color: var(--text-2); font-size: 14px; margin-top: auto; font-variant-numeric: tabular-nums; }
.vstats b { color: var(--text); font-weight: 500; }

/* ───────── Форматы и кейсы ───────── */
.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.fcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.fcard .price { font-size: 22px; font-weight: 500; margin-top: auto; font-variant-numeric: tabular-nums; }
.fcard p { color: var(--text-2); white-space: pre-line; }
.fcard .price + .fmeta { margin-top: 0; }
.fmeta { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }
.fmeta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.fmeta small { display: block; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
#forecast-list { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
#forecast-list .label { display: flex; align-items: center; gap: 8px; }
.cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.case { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.case .brand-name { font-weight: 500; font-size: 17px; margin-bottom: 8px; }
.case p { color: var(--text-2); white-space: pre-line; }
.case a { display: inline-block; margin-top: 12px; font-size: 14px; color: var(--accent); }

/* ───────── Контакты ───────── */
.contact { background: var(--text); color: var(--bg); border-radius: 20px; padding: clamp(24px, 5vw, 48px); display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center; }
@media (max-width: 860px) { .contact { grid-template-columns: 1fr; } }
.contact h2 { color: inherit; margin-bottom: 12px; }
.contact p { opacity: .75; }
.contact .links { display: grid; gap: 8px; }
.contact .links a { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-decoration: none; background: color-mix(in srgb, var(--bg) 8%, transparent); border: 1px solid color-mix(in srgb, var(--bg) 18%, transparent); padding: 0 16px; height: 52px; border-radius: 10px; font-weight: 500; transition: background-color .15s var(--ease); }
.contact .links a:hover { background: color-mix(in srgb, var(--bg) 16%, transparent); }
.contact .links small { opacity: .7; font-weight: 400; font-size: 13px; }

footer { padding: 32px 0 40px; color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Скелетон загрузки */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; color: transparent !important; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.notice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--text-2); }

/* Подсказка графика */
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); border-radius: 10px; padding: 8px 10px; font-size: 13px; color: var(--text); z-index: 5; min-width: 140px; }
.tip .t { color: var(--text-2); margin-bottom: 4px; }
.tip .r { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip .r span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tip .r b { font-variant-numeric: tabular-nums; }

/* ═════════ Админка ═════════ */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.login h1 { font-size: 24px; margin-bottom: 6px; }
.login p { color: var(--text-2); font-size: 14px; margin-bottom: 18px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], textarea {
  width: 100%; font: 15px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 10px 12px; outline: none; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 8px; }

.admin-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-bar .tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0 24px; }
.tabs button { border: 0; background: transparent; color: var(--text-2); font: 600 15px var(--font); padding: 12px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; transition: color .15s var(--ease); }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
/* Узкий экран: вкладки переносятся на вторую строку «таблетками», а не уезжают за край */
@media (max-width: 900px) {
  .tabs { flex-wrap: wrap; gap: 6px; border-bottom: 0; margin: 16px 0 20px; }
  .tabs button { padding: 7px 12px; font-size: 14px; border: 1px solid var(--line); border-radius: 999px; margin: 0; background: var(--surface); }
  .tabs button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
}

/* Шапка админки: аватарка, метка, свежесть данных */
.brand .ava { position: relative; width: 32px; height: 32px; flex: none; }
.brand .ava img, .brand .ava .ph { position: absolute; inset: 0; width: 32px; height: 32px; border-radius: 8px; }
.brand .ava .ph { display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font: 600 16px var(--font); }
.admin-tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 6px; }
.fresh { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; margin-right: 4px; border: 1px solid var(--line); border-radius: 8px; background: transparent;
  color: var(--text-2); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fresh:hover { background: var(--surface-2); color: var(--text); }
.fresh i { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.fresh.warn i { background: #e0a526; }
.fresh.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.fresh.bad i { background: var(--bad); }
.fresh.off i { background: var(--muted); }
.fresh.run i { background: var(--accent); animation: fresh-pulse 1.2s ease-in-out infinite; }
@keyframes fresh-pulse { 50% { opacity: .3; } }
.show-sm { display: none; }
@media (max-width: 640px) {
  .topbar .wrap { gap: 8px; }
  .admin-tag, .hide-sm, .brand .brand-name { display: none; }
  .show-sm { display: inline; }
  .fresh { padding: 0 10px; margin-right: 0; }
}

/* Число-ссылка в таблицах и карточках: ведёт к комментариям */
.num-link { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; font-variant-numeric: tabular-nums; }
.num-link:hover { text-decoration-color: currentColor; }
.num-link.warn { color: var(--bad); }
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.seg .dot { width: 8px; height: 8px; }
.kit-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.kit-head .seg { flex-wrap: wrap; }
.vis-find { max-width: 320px; margin-bottom: 8px; }
.panel-grid { display: grid; gap: 12px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 860px) { .cols-2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card > h3 { margin-bottom: 4px; }
.card > .sub { color: var(--text-2); font-size: 14px; margin-bottom: 16px; }

.pstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 860px) { .pstats { grid-template-columns: 1fr; } }
.pstat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; border-top: 4px solid var(--pc); }
.pstat .t { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 10px; }
.pstat dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: 14px; }
.pstat dt { color: var(--text-2); }
.pstat dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.pstat dd.warn { color: var(--bad); }

.tbl-wrap { overflow-x: auto; overflow-y: hidden; margin: 0 -20px; padding: 0 20px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl td.r { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 420px; text-decoration: none; }
.tbl td .title:hover { text-decoration: underline; }
.tbl tr.dim td { opacity: .45; }
.up { color: var(--good); }
.down { color: var(--bad); }
.small { font-size: 12.5px; }
.tbl.plain th { cursor: default; }
.tbl td .chip + .title { margin-top: 2px; }
.ratio { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.ratio.up { color: var(--good); }
.ratio.down { color: var(--bad); }
.meter-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.meter { width: 64px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border-bottom: 0; }
.switch .l b { display: block; font-weight: 600; }
.switch .l span { color: var(--muted); font-size: 13px; }
.tgl { position: relative; display: inline-block; vertical-align: middle; width: 44px; height: 26px; flex: none; }
.tgl input { opacity: 0; width: 0; height: 0; position: absolute; }
.tgl span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; cursor: pointer; transition: background .15s; }
.tgl span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.tgl input:checked + span { background: var(--accent); }
.tgl input:checked + span::after { transform: translateX(18px); }
.tgl input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

.list-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: var(--bg); }
.list-item .row { display: grid; grid-template-columns: 1fr 180px; gap: 10px; }
@media (max-width: 600px) { .list-item .row { grid-template-columns: 1fr; } }
.list-item .actions { display: flex; justify-content: flex-end; }
.link-btn { background: none; border: 0; color: var(--bad); font: 600 13px var(--font); cursor: pointer; padding: 4px; }

.savebar { position: sticky; bottom: 12px; z-index: 30; margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--text); color: var(--bg); border-radius: 14px; padding: 12px 12px 12px 18px; box-shadow: var(--shadow); }
.savebar .btn { background: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; box-shadow: var(--shadow); }
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); }

/* ═════════ PDF (печать медиакита) ═════════ */
.print-only { display: none; }
@media (max-width: 520px) { #pdf-btn span { display: none; } }
@media print {
  @page { size: A4; margin: 12mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  :root { --bg: #ffffff; --shadow: none; }
  body { font-size: 12px; background: #fff; }
  .topbar, .hero .actions, .tip, .live { display: none !important; }
  .print-only { display: inline; }
  .wrap { max-width: none; padding: 0; }
  section { padding: 12px 0; }
  .hero { padding: 0 0 8px; }
  .hero-grid { grid-template-columns: 1.1fr 1fr; gap: 24px; }
  .hero .kicker { font-size: 13px; margin-bottom: 8px; }
  .hero h1 { font-size: 36px; margin-bottom: 8px; }
  .hero .tagline { font-size: 14px; margin-bottom: 0; }
  .hero-visual { padding-bottom: 56px; }
  .hero-art { max-width: 260px; aspect-ratio: 1; }
  .hero-card { position: absolute; width: 74%; margin: 0; padding: 12px 16px 16px; }
  .hero-card .big { font-size: 32px; margin: 2px 0 8px; }
  .share-bar { height: 8px; margin-bottom: 8px; }
  .share-legend { gap: 4px; }
  .share-legend .row { font-size: 12px; }
  .kpis { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .value { font-size: 22px; }
  .board-head, .board-row { grid-template-columns: minmax(120px, 1.3fr) repeat(var(--cols), minmax(0, 1fr)); padding: 0 16px; gap: 12px; }
  .board-head { display: grid; height: 32px; font-size: 11px; }
  .board-row { min-height: 48px; padding: 0 16px; }
  .board-row::before { top: 10px; bottom: 10px; }
  .board-row .cell { text-align: right; }
  .board .cell .k { display: none; }
  .board .pname { grid-column: auto; }
  .board .pname .icon { width: 24px; height: 24px; }
  .board .pname .ext { display: none; }
  .board .cell .v, .board .cell.lead .v { font-size: 14px; }
  .chart-card { padding: 16px; }
  .chart-box { height: auto !important; }
  .chart-box canvas { width: 100% !important; height: auto !important; }
  .about { grid-template-columns: 1fr 1fr; gap: 8px; }
  .about.single { grid-template-columns: 1fr; }
  .about .box { padding: 16px; }
  .videos { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .vbody { padding: 8px 12px 12px; gap: 8px; }
  .vtitle { font-size: 13px; }
  .vstats { font-size: 11px; gap: 4px 10px; flex-wrap: wrap; }
  .vstats span { white-space: nowrap; }
  .formats, .cases { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .contact { grid-template-columns: 1.2fr 1fr; padding: 24px; border-radius: 16px; }
  .contact h2 { font-size: 22px; }
  .contact { grid-template-columns: 1fr 1fr; }
  .contact .links a { height: 40px; padding: 0 12px; }
  .contact .links small { font-size: 11px; white-space: nowrap; }
  .section-head { margin-bottom: 8px; break-after: avoid; }
  .section-head h2 { font-size: 20px; }
  .kpi, .board, .chart-card, .about .box, .vcard, .fcard, .case, .contact, .hero-grid { break-inside: avoid; }
  a { text-decoration: none; }
  footer { padding: 8px 0 0; }
}

/* По часам */
.hr-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.hr-bar .seg { flex-wrap: wrap; }
.hr-bar select { width: 100%; font: 15px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 10px 12px; outline: none; text-overflow: ellipsis; }
.hr-bar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hr-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 16px; }
@media (max-width: 700px) { .hr-stats { grid-template-columns: repeat(2, 1fr); } }
.hr-stat { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.hr-stat span { display: block; font-size: 12.5px; color: var(--text-2); }
.hr-stat b { display: block; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.hr-stat small { display: block; font-size: 12px; color: var(--muted); }
.hr-empty { min-height: 120px; display: grid; place-items: center; }
.tbl tr.pick { cursor: pointer; }
.tbl tr.pick:hover td { background: var(--surface-2); }

/* Прогноз охвата в админке */
.fc-h { font-size: 15px; font-weight: 600; font-family: var(--font); margin: 20px 0 4px; }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.kind { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px; font-size: 14px; cursor: pointer; background: var(--bg); }
.kind input { accent-color: var(--accent); margin: 0; }
.kind:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/* Сайт: кто смотрит, кейсы с цифрами, персональное предложение */
.aud-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.aud-card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--pc); border-radius: 16px; padding: 20px 24px 24px; }
.aud-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 14px; }
.aud-head .icon { width: 24px; height: 24px; display: inline-grid; place-items: center; color: var(--pc); }
.aud-head .icon svg { width: 22px; height: 22px; fill: currentColor; }
.aud-head .muted { font-size: 13px; margin-left: auto; }
.aud-sub { font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.gender .gbar { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--pc) 30%, var(--surface-2)); overflow: hidden; }
.gender .gbar i { display: block; height: 100%; background: var(--pc); }
.gender .glabels { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); margin-top: 6px; }
.gender b { color: var(--text); font-variant-numeric: tabular-nums; }
.aud-card .bar i { background: var(--pc); }
.case-stats { margin-top: 16px; }
.case-stats .dot { width: 8px; height: 8px; }
.offer-note { background: var(--accent-soft); border-radius: 14px; padding: 14px 18px; margin-bottom: 20px; max-width: 36rem; }
.offer-note b { display: block; color: var(--accent); margin-bottom: 4px; }
.offer-note p { white-space: pre-line; color: var(--text); margin: 0; }
.offer-note p:empty { display: none; }
#core-kpi { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Отчёт по интеграции */
.rep { padding-top: 32px; padding-bottom: 48px; display: grid; gap: 16px; }
.rep h1 { font-size: clamp(28px, 4vw, 40px); margin: -6px 0 4px; }
.rep .kicker { color: var(--text-2); margin: 0; }
.rep-video { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: center; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.rep-video .vthumb { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.rep-video .vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rep-video .vtitle { font-weight: 600; margin-bottom: 4px; }
@media (max-width: 600px) { .rep-video { grid-template-columns: 1fr; } }
.rep .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* Вкладки «Контент», «Аудитория», «Вопросы», «Отчёты» */
.tabs .badge { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; line-height: 18px; text-align: center; }
.tabs .badge.hidden { display: none; }
.remember { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); margin: 0 0 14px; cursor: pointer; }
.remember input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
select.sel { width: 100%; font: 15px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; outline: none; }
select.sel:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag-soft { display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 6px; margin-left: 4px; }
.tag-btn { border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); border-radius: 999px; padding: 4px 10px; font: 13px var(--font); cursor: pointer; }
.tag-btn:hover { background: var(--surface-2); }

.heat-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.heat { border-collapse: separate; border-spacing: 2px; width: 100%; min-width: 560px; table-layout: fixed; }
.heat th { font-size: 11.5px; font-weight: 500; color: var(--muted); text-align: left; padding: 0 0 2px; overflow: visible; white-space: nowrap; }
.heat thead th:first-child, .heat tbody th { width: 28px; padding-right: 6px; }
.heat td { height: 24px; border-radius: 4px; background: var(--surface-2); }

.topic-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 10px; align-items: end; }
.topic-row .link-btn { margin-bottom: 22px; }
@media (max-width: 600px) { .topic-row { grid-template-columns: 1fr; } .topic-row .link-btn { margin: -8px 0 12px; justify-self: start; } }

.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 120px) 1fr 52px; gap: 10px; align-items: center; font-size: 14px; }
.bar-row > span:first-child { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-row b { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.aud-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0 10px; }
.aud-grid.countries { grid-template-columns: repeat(2, 2fr 1fr); }
@media (max-width: 700px) { .aud-grid { grid-template-columns: repeat(3, 1fr); } .aud-grid.countries { grid-template-columns: 2fr 1fr; } }

.q-item { border-top: 1px solid var(--line); padding: 14px 0; }
.q-item:first-of-type { border-top: 0; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; }
.q-text { margin: 6px 0 8px; white-space: pre-line; overflow-wrap: anywhere; }
.q-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.q-video { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-actions { display: flex; gap: 8px; margin-left: auto; }

.link-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.link-item > div:first-child { min-width: 0; flex: 1 1 260px; }
.link-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-add { display: grid; grid-template-columns: 2fr 1fr auto; gap: 10px; align-items: end; margin-top: 12px; }
.row-add .btn { margin-bottom: 14px; height: 44px; }
@media (max-width: 700px) { .row-add { grid-template-columns: 1fr; } .row-add .btn { margin: 0; } }
.offer-format { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; align-items: end; }
.offer-format .link-btn { margin-bottom: 22px; }
@media (max-width: 700px) { .offer-format { grid-template-columns: 1fr; } .offer-format .link-btn { margin: -8px 0 12px; justify-self: start; } }

/* Печать отчёта за месяц: только сам отчёт */
@media print {
  body.print-report .topbar, body.print-report .tabs, body.print-report .savebar, body.print-report #app main > div:not(#tab-reports),
  body.print-report #tab-reports > .card:not(:first-child), body.print-report #tab-reports .hr-bar,
  body.print-report #tab-reports .card > .sub, body.print-report #tab-reports .card > h3, body.print-report #tab-reports .btn { display: none !important; }
  body.print-report #tab-reports .card { border: 0; padding: 0; }
  body.print-report .tbl-wrap { overflow: visible; margin: 0; padding: 0; }
}

/* Фильтр по площадкам в «Новых публикациях» */
.dyn-seg { margin-bottom: 12px; flex-wrap: wrap; }
.dyn-seg button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; }
.dyn-seg .dot { width: 8px; height: 8px; }

/* Советы автору */
.advice { border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 10px; background: var(--bg); }
.advice.hot { border-left-color: var(--accent); }
.advice.do { border-left-color: var(--text-2); }
.advice.is-hidden { opacity: .55; }
.advice-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.advice-lvl { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); }
.advice.hot .advice-lvl { color: var(--accent); }
.advice-v { margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.advice-v .title { overflow-wrap: anywhere; }
.advice p { margin: 6px 0 0; color: var(--text-2); }
.advice-ex { margin: 8px 0 0; padding-left: 18px; color: var(--text-2); font-size: 14px; }
.advice-ex li { margin: 2px 0; overflow-wrap: anywhere; }
.advice-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.advice-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.link-btn.muted-btn { color: var(--muted); font-weight: 500; }
.link-btn.muted-btn:hover { color: var(--text); }
td.down { color: var(--bad); }

/* ───────── админка: комментарии, авторы, сбор ───────── */
.cm-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.cm-bar .seg { flex-wrap: wrap; }
.cm-bar input[type=text] { flex: 1 1 220px; width: auto; }
.cm-own { margin: 0; }
#cm-active { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
#cm-active:empty { display: none; }
.q-item.cm-done .q-text { color: var(--text-2); }
.cm-note { margin: 0 0 8px; }
.cm-note textarea { min-height: 56px; font-size: 14px; }
.st-details { white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.5 ui-monospace, Consolas, monospace; color: var(--text-2);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0 14px; max-height: 220px; overflow: auto; }
.st-select { width: 100%; max-width: 320px; font: 15px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 10px 12px; }
.st-log summary { cursor: pointer; font-size: 14px; }
.st-log div { margin-top: 6px; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .switch > div:last-child { flex-wrap: wrap; justify-content: flex-end; }
  .switch input[type=text] { width: 100% !important; }
}
