@font-face {
  font-family: 'Geist';
  src: url('/static/fonts/geist-cyrillic-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Geist';
  src: url('/static/fonts/geist-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2199, U+2212, U+2215;
}

/* ---------- Темы ----------
   Светлая — на :root. Тёмная — по системной настройке, если пользователь не выбрал светлую,
   и по явному выбору data-theme="dark". Графики читают эти же переменные при отрисовке. */

:root {
  color-scheme: light;

  --bg: #f5f5f2;
  --glow-1: rgba(124, 99, 255, 0.09);
  --glow-2: rgba(56, 132, 229, 0.07);
  --noise-opacity: 0.02;

  --shell: rgba(18, 20, 30, 0.028);
  --shell-line: rgba(18, 20, 30, 0.07);
  --core: #ffffff;
  --core-raised: #fafaf8;
  --line: rgba(18, 20, 30, 0.075);
  --line-soft: rgba(18, 20, 30, 0.05);
  --line-strong: rgba(18, 20, 30, 0.13);
  --wash: rgba(18, 20, 30, 0.035);
  --wash-strong: rgba(18, 20, 30, 0.06);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --card-shadow: 0 1px 2px rgba(16, 18, 27, 0.04), 0 12px 32px -18px rgba(16, 18, 27, 0.14);
  --sidebar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.6));
  --bar-bg: rgba(255, 255, 255, 0.82);
  --tooltip-bg: rgba(255, 255, 255, 0.97);
  --tooltip-shadow: 0 16px 40px -14px rgba(16, 18, 27, 0.28);
  --thumb: #ffffff;
  --thumb-shadow: 0 1px 2px rgba(16, 18, 27, 0.08), 0 2px 8px -2px rgba(16, 18, 27, 0.12);

  --text: #0d0e13;
  --text-2: #555965;
  --muted: #7f838d;

  --accent: #6b5bf6;
  --accent-soft: rgba(107, 91, 246, 0.14);
  --brand-gradient: linear-gradient(135deg, #9a7bff 0%, #5b8cff 55%, #3fb5ff 100%);
  --button-bg: #0d0e13;
  --button-fg: #ffffff;
  --button-icon-bg: rgba(255, 255, 255, 0.14);

  /* Серии графиков: проверенные слоты 1–3 для светлой подложки */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-muted: #b9bcc4;
  --loss: #e34948;
  --up: #11823b;
  --down: #d03b3b;
  --up-soft: rgba(17, 130, 59, 0.1);
  --down-soft: rgba(208, 59, 59, 0.09);
  --warn: #b7791f;
  --warn-soft: rgba(183, 121, 31, 0.12);
  --grid: rgba(18, 20, 30, 0.07);
  --axis: rgba(18, 20, 30, 0.2);
  --crosshair: rgba(18, 20, 30, 0.28);

  --privacy-public: #11823b;
  --privacy-private: #b8860b;
  --privacy-expired: #a2a5ad;
  --audience-private: #7a5af8;
  --audience-expired: #cfd1d6;

  --avatar-l1: 58%;
  --avatar-l2: 44%;

  --radius-shell: 26px;
  --radius-core: 20px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #07080a;
    --glow-1: rgba(124, 99, 255, 0.13);
    --glow-2: rgba(56, 132, 229, 0.09);
    --noise-opacity: 0.035;
    --shell: rgba(255, 255, 255, 0.028);
    --shell-line: rgba(255, 255, 255, 0.065);
    --core: #0e0f13;
    --core-raised: #14161b;
    --line: rgba(255, 255, 255, 0.06);
    --line-soft: rgba(255, 255, 255, 0.035);
    --line-strong: rgba(255, 255, 255, 0.11);
    --wash: rgba(255, 255, 255, 0.035);
    --wash-strong: rgba(255, 255, 255, 0.065);
    --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.045);
    --card-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
    --sidebar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
    --bar-bg: rgba(14, 15, 19, 0.8);
    --tooltip-bg: rgba(22, 24, 30, 0.97);
    --tooltip-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
    --thumb: rgba(255, 255, 255, 0.1);
    --thumb-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px -2px rgba(0, 0, 0, 0.5);
    --text: #f3f3f5;
    --text-2: #a3a5ae;
    --muted: #7c7f89;
    --accent: #8f82ff;
    --accent-soft: rgba(143, 130, 255, 0.16);
    --button-bg: #f3f3f5;
    --button-fg: #0b0b0e;
    --button-icon-bg: rgba(0, 0, 0, 0.08);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-muted: #4a4d57;
    --loss: #e66767;
    --up: #2fbf5b;
    --down: #e66767;
    --up-soft: rgba(47, 191, 91, 0.1);
    --down-soft: rgba(230, 103, 103, 0.1);
    --warn: #e0a43a;
    --warn-soft: rgba(224, 164, 58, 0.12);
    --grid: rgba(255, 255, 255, 0.055);
    --axis: rgba(255, 255, 255, 0.16);
    --crosshair: rgba(255, 255, 255, 0.22);
    --privacy-public: #2fbf5b;
    --privacy-private: #c9a227;
    --privacy-expired: #6d707a;
    --audience-private: #7c63ff;
    --audience-expired: #3a3d46;
    --avatar-l1: 36%;
    --avatar-l2: 19%;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #07080a;
  --glow-1: rgba(124, 99, 255, 0.13);
  --glow-2: rgba(56, 132, 229, 0.09);
  --noise-opacity: 0.035;
  --shell: rgba(255, 255, 255, 0.028);
  --shell-line: rgba(255, 255, 255, 0.065);
  --core: #0e0f13;
  --core-raised: #14161b;
  --line: rgba(255, 255, 255, 0.06);
  --line-soft: rgba(255, 255, 255, 0.035);
  --line-strong: rgba(255, 255, 255, 0.11);
  --wash: rgba(255, 255, 255, 0.035);
  --wash-strong: rgba(255, 255, 255, 0.065);
  --highlight: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  --card-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  --sidebar-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  --bar-bg: rgba(14, 15, 19, 0.8);
  --tooltip-bg: rgba(22, 24, 30, 0.97);
  --tooltip-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.7);
  --thumb: rgba(255, 255, 255, 0.1);
  --thumb-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px -2px rgba(0, 0, 0, 0.5);
  --text: #f3f3f5;
  --text-2: #a3a5ae;
  --muted: #7c7f89;
  --accent: #8f82ff;
  --accent-soft: rgba(143, 130, 255, 0.16);
  --button-bg: #f3f3f5;
  --button-fg: #0b0b0e;
  --button-icon-bg: rgba(0, 0, 0, 0.08);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-muted: #4a4d57;
  --loss: #e66767;
  --up: #2fbf5b;
  --down: #e66767;
  --up-soft: rgba(47, 191, 91, 0.1);
  --down-soft: rgba(230, 103, 103, 0.1);
  --warn: #e0a43a;
  --warn-soft: rgba(224, 164, 58, 0.12);
  --grid: rgba(255, 255, 255, 0.055);
  --axis: rgba(255, 255, 255, 0.16);
  --crosshair: rgba(255, 255, 255, 0.22);
  --privacy-public: #2fbf5b;
  --privacy-private: #c9a227;
  --privacy-expired: #6d707a;
  --audience-private: #7c63ff;
  --audience-expired: #3a3d46;
  --avatar-l1: 36%;
  --avatar-l2: 19%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}

/* Фон: мягкое свечение и зерно — неподвижные слои, прокрутку не нагружают */
.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 12% -8%, var(--glow-1), transparent 60%),
    radial-gradient(760px 480px at 92% -12%, var(--glow-2), transparent 62%);
}
.backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.link { color: var(--text-2); transition: color 0.3s var(--ease); }
.link:hover { color: var(--text); }

/* ---------- Каркас ---------- */

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 14px 0 14px 14px;
}

.sidebar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  border-radius: var(--radius-shell);
  background: var(--sidebar-bg);
  border: 1px solid var(--shell-line);
  box-shadow: var(--highlight), var(--card-shadow);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--brand-gradient);
  box-shadow: 0 6px 20px -6px rgba(110, 110, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  flex: none;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 0 12px 8px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 12px;
  color: var(--text-2);
  transition: color 0.4s var(--ease), background-color 0.4s var(--ease);
}
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.nav-link:hover { color: var(--text); background: var(--wash); }
.nav-link.is-active { color: var(--text); background: var(--wash-strong); }
.nav-link.is-active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-gradient);
}
.nav-count { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: var(--warn);
  background: var(--warn-soft);
  font-variant-numeric: tabular-nums;
}

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

.freshness {
  padding: 12px;
  border-radius: 14px;
  background: var(--wash);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-2);
}
.freshness-title { display: flex; align-items: center; gap: 7px; color: var(--text); font-weight: 500; margin-bottom: 3px; }
.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--up);
  animation: pulse 2.4s var(--ease-out) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 7px transparent; }
}

.sidebar-actions { display: flex; align-items: center; gap: 6px; }

.theme-switch {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--wash);
  border: 1px solid var(--line);
}
.theme-switch button {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: color 0.4s var(--ease);
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed='true'] { color: var(--text); }
.theme-switch svg { width: 15px; height: 15px; }

.icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: color 0.4s var(--ease), background-color 0.4s var(--ease);
}
.icon-button:hover { color: var(--text); background: var(--wash); }
.icon-button svg { width: 17px; height: 17px; }
.theme-cycle { display: none; }

.logout {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: color 0.4s var(--ease), background-color 0.4s var(--ease);
}
.logout svg { width: 17px; height: 17px; }
.logout:hover { color: var(--text); background: var(--wash); }

.main { min-width: 0; padding: 36px 44px 96px; }
.page { max-width: 1260px; margin: 0 auto; }

/* ---------- Заголовок страницы ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--wash);
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-2);
}
.eyebrow::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-gradient); }

.page-title {
  margin: 14px 0 6px;
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.page-lead { margin: 0; color: var(--text-2); font-size: 15px; max-width: 660px; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 14px;
}
.section-title h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.section-title p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- Карточки: внешняя оправа и внутреннее ядро ---------- */

.bezel {
  padding: 5px;
  border-radius: var(--radius-shell);
  background: var(--shell);
  border: 1px solid var(--shell-line);
  min-width: 0;
}
.core {
  height: 100%;
  border-radius: var(--radius-core);
  background: var(--core);
  box-shadow: var(--highlight), var(--card-shadow);
  padding: 22px 24px;
  min-width: 0;
  transition: background-color 0.5s var(--ease);
}
a.bezel .core { transition: background-color 0.4s var(--ease); }
a.bezel:hover .core { background: var(--core-raised); }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-title { font-size: 14px; font-weight: 550; letter-spacing: -0.01em; margin: 0; }
.card-note { font-size: 12px; color: var(--muted); }
.card-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; }

.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.stack { display: grid; gap: 14px; }

/* ---------- Появление ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: reveal 0.9s var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes reveal { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; opacity: 1; transform: none; }
  .pulse { animation: none; }
}

/* ---------- Цифры ---------- */

.hero-value { font-size: clamp(44px, 5.4vw, 68px); line-height: 0.95; font-weight: 600; letter-spacing: -0.045em; margin: 12px 0 14px; }
.stat-label { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat-label svg { width: 14px; height: 14px; color: var(--muted); }
.stat-value { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; margin: 8px 0 4px; }
.stat-value small { font-size: 17px; color: var(--muted); font-weight: 500; letter-spacing: -0.01em; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stat-sub b { color: var(--text-2); font-weight: 550; }

.delta { display: inline-flex; align-items: center; gap: 5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta.is-up { color: var(--up); }
.delta.is-down { color: var(--down); }
.delta.is-flat, .delta.is-none { color: var(--muted); }
.delta-pill { padding: 5px 10px; border-radius: 999px; font-size: 13px; }
.delta-pill.is-up { background: var(--up-soft); }
.delta-pill.is-down { background: var(--down-soft); }
.delta-pill.is-flat { background: var(--wash-strong); }
.delta-arrow { width: 10px; height: 10px; }

.caption { color: var(--muted); font-size: 13px; }

.composition { display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; margin: 14px 0 12px; }
.composition span { display: block; height: 100%; border-radius: 2px; }
.composition span:first-child { border-radius: 999px 2px 2px 999px; }
.composition span:last-child { border-radius: 2px 999px 999px 2px; }
.composition-sm { height: 6px; margin: 8px 0 0; min-width: 90px; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-item b { color: var(--text); font-weight: 550; font-variant-numeric: tabular-nums; }
.swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.swatch-line { width: 14px; height: 2px; border-radius: 2px; flex: none; }
.swatch-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.meter { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--series-1) 16%, transparent); overflow: hidden; margin-top: 14px; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--series-1); }

/* ---------- Главное: выводы ---------- */

.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.insight {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 10px;
  margin: 0 -10px;
  border-radius: 14px;
  transition: background-color 0.35s var(--ease);
}
a.insight:hover { background: var(--wash); }
.insight-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--wash-strong);
  color: var(--text-2);
}
.insight-icon svg { width: 18px; height: 18px; }
.insight-icon.is-up { background: var(--up-soft); color: var(--up); }
.insight-icon.is-down { background: var(--down-soft); color: var(--down); }
.insight-icon.is-warn { background: var(--warn-soft); color: var(--warn); }
.insight-icon.is-accent { background: var(--accent-soft); color: var(--accent); }
.insight-text { font-size: 14.5px; line-height: 1.45; }
.insight-text b { font-weight: 600; }
.insight-text small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.insight-go { color: var(--muted); font-size: 12.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: color 0.3s var(--ease), transform 0.5s var(--ease); }
.insight-go svg { width: 14px; height: 14px; }
a.insight:hover .insight-go { color: var(--text); transform: translateX(2px); }

/* ---------- Списки каналов ---------- */

.rank-list { list-style: none; margin: 0 -10px; padding: 0; }
.rank-row {
  display: grid;
  grid-template-columns: 22px 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 14px;
  transition: background-color 0.35s var(--ease);
}
.rank-row:hover { background: var(--wash); }
.rank-num { color: var(--muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.rank-main { min-width: 0; }
.rank-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.rank-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-value { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.rank-value small { display: block; font-size: 11.5px; color: var(--muted); }

.bar-track { height: 4px; border-radius: 999px; background: var(--wash-strong); margin-top: 6px; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--series-1); transform-origin: left; animation: grow 1.1s var(--ease-out) both; }
@keyframes grow { from { transform: scaleX(0); } }

.avatar {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  background: linear-gradient(140deg, hsl(var(--h) 42% var(--avatar-l1)), hsl(calc(var(--h) + 40) 46% var(--avatar-l2)));
  box-shadow: inset 0 0 0 1px var(--line);
  flex: none;
  overflow: hidden;
  user-select: none;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; border-radius: 20px; font-size: 24px; }
.avatar-sm { width: 28px; height: 28px; border-radius: 9px; font-size: 11px; }

.spark { display: block; overflow: visible; color: var(--series-1); }
.spark.is-down { color: var(--loss); }
.spark.is-flat { color: var(--muted); }

.empty-inline { color: var(--muted); font-size: 13px; padding: 12px 0; }

/* ---------- Флаги-сигналы ---------- */

.flags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--warn);
  background: var(--warn-soft);
}
.flag svg { width: 11px; height: 11px; }
.flag.is-up { color: var(--up); background: var(--up-soft); }
.flag.is-accent { color: var(--accent); background: var(--accent-soft); }
.flag.is-down { color: var(--down); background: var(--down-soft); }

.banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--warn-soft);
  color: var(--text);
  margin-bottom: 14px;
  font-size: 13.5px;
}
.banner svg { width: 18px; height: 18px; color: var(--warn); flex: none; margin-top: 1px; }
.banner ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }

/* ---------- Панель фильтров ---------- */

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-spacer { flex: 1; }
.toolbar-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.segmented {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--wash);
  border: 1px solid var(--line);
  max-width: 100%;
}
.segmented button {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
  transition: color 0.4s var(--ease);
}
.segmented button:hover, .segmented button[aria-pressed='true'] { color: var(--text); }
.segmented-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  border-radius: 999px;
  background: var(--thumb);
  box-shadow: var(--thumb-shadow);
  transition: transform 0.55s var(--ease), width 0.55s var(--ease);
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--wash);
  color: var(--text-2);
  font-size: 12.5px;
  white-space: nowrap;
  transition: color 0.35s var(--ease), border-color 0.35s var(--ease), background-color 0.35s var(--ease);
}
.toggle-chip:hover { color: var(--text); }
.toggle-chip[aria-pressed='true'] { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.toggle-chip svg { width: 14px; height: 14px; }

.search { position: relative; flex: 0 1 300px; min-width: 200px; }
.search svg { position: absolute; left: 13px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--wash);
  outline: none;
  transition: border-color 0.4s var(--ease), background-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--core); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ---------- Таблицы ---------- */

.table-core { padding: 6px 8px 8px; }
.table-scroll { overflow-x: auto; }

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--core);
  text-align: right;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th.left, .table td.left, .table th:first-child, .table td:first-child { text-align: left; }
.table th button { border: 0; background: none; padding: 0; color: inherit; display: inline-flex; align-items: center; gap: 5px; transition: color 0.3s var(--ease); }
.table th button:hover, .table th button.is-sorted { color: var(--text); }
.sort-arrow { width: 9px; height: 9px; opacity: 0; transition: opacity 0.3s var(--ease), transform 0.4s var(--ease); }
.is-sorted .sort-arrow { opacity: 1; }
.is-asc .sort-arrow { transform: rotate(180deg); }
.th-hint { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; margin-top: 1px; }

.table td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.table tbody tr { transition: background-color 0.3s var(--ease); }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover { background: var(--wash); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody td:first-child { border-radius: 12px 0 0 12px; }
.table tbody td:last-child { border-radius: 0 12px 12px 0; }

.channel-cell { display: flex; align-items: center; gap: 12px; min-width: 240px; max-width: 380px; }
.channel-cell .avatar { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
.channel-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.channel-meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; min-width: 0; }
.channel-meta-text { overflow: hidden; text-overflow: ellipsis; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--wash);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.privacy-public { background: var(--privacy-public); }
.privacy-private { background: var(--privacy-private); }
.privacy-expired { background: var(--privacy-expired); }

.cell-muted { color: var(--muted); }
.cell-sub { display: block; font-size: 11.5px; color: var(--muted); }

.star {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: color 0.3s var(--ease), background-color 0.3s var(--ease), transform 0.4s var(--ease);
}
.star:hover { color: var(--text); background: var(--wash-strong); }
.star:active { transform: scale(0.9); }
.star svg { width: 17px; height: 17px; }
.star[aria-pressed='true'] { color: var(--accent); }
.star[aria-pressed='true'] svg { fill: currentColor; }

.load-more { display: flex; justify-content: center; padding: 18px 0 10px; color: var(--muted); font-size: 12.5px; }

.empty-state { display: grid; place-items: center; text-align: center; padding: 56px 24px; color: var(--text-2); }
.empty-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  background: var(--wash);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.empty-icon svg { width: 22px; height: 22px; }
.empty-title { color: var(--text); font-size: 16px; font-weight: 550; margin-bottom: 6px; }
.empty-text { max-width: 460px; font-size: 13.5px; }

/* ---------- Лента сигналов ---------- */

.feed { list-style: none; margin: 0 -10px; padding: 0; }
.feed-day { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; padding: 16px 10px 6px; }
.feed-day:first-child { padding-top: 4px; }
.feed-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1.3fr) minmax(0, 1fr) 150px 20px;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 14px;
  transition: background-color 0.35s var(--ease);
}
.feed-row:hover { background: var(--wash); }
.feed-what { font-size: 13px; color: var(--text-2); }
.feed-what b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.feed-chart { height: 34px; }
.feed-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.feed-chevron { color: var(--muted); width: 16px; height: 16px; }

/* ---------- Медиаплан ---------- */

.dock {
  position: fixed;
  left: calc(256px + 14px + 44px);
  right: 44px;
  bottom: 18px;
  z-index: 20;
  max-width: 1260px;
  margin: 0 auto;
  border-radius: 22px;
  padding: 5px;
  background: var(--shell);
  border: 1px solid var(--shell-line);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  transform: translateY(140%);
  opacity: 0;
  transition: transform 0.7s var(--ease), opacity 0.5s var(--ease);
}
.dock.is-visible { transform: none; opacity: 1; }
.dock-core {
  border-radius: 18px;
  background: var(--bar-bg);
  box-shadow: var(--highlight), var(--tooltip-shadow);
  padding: 12px 12px 12px 18px;
}
.dock-bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.dock-metric { display: flex; flex-direction: column; min-width: 0; }
.dock-metric span { font-size: 11.5px; color: var(--muted); }
.dock-metric b { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dock-cpm { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dock-cpm input {
  width: 64px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--core);
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
}
.dock-cpm input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dock-actions { margin-left: auto; display: flex; gap: 6px; }
.dock-list { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); max-height: 280px; overflow: auto; }
.dock-list .table td { padding: 7px 10px; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--core);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.35s var(--ease), transform 0.4s var(--ease), border-color 0.35s var(--ease);
}
.button:hover { background: var(--core-raised); border-color: var(--axis); }
.button:active { transform: scale(0.98); }
.button svg { width: 15px; height: 15px; }
.button.is-primary { background: var(--button-bg); color: var(--button-fg); border-color: transparent; }
.button.is-primary:hover { opacity: 0.92; }

/* Кнопка-пилюля со вложенным кружком под стрелку */
.pill-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  border: 0;
  background: var(--button-bg);
  color: var(--button-fg);
  font-weight: 550;
  font-size: 13.5px;
  white-space: nowrap;
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
  box-shadow: 0 8px 24px -12px color-mix(in srgb, var(--button-bg) 60%, transparent);
}
.pill-button:active { transform: scale(0.98); }
.pill-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--button-icon-bg);
  transition: transform 0.5s var(--ease);
}
.pill-icon svg { width: 14px; height: 14px; }
.pill-button:hover .pill-icon { transform: translate(2px, -1px) scale(1.05); }

/* ---------- Профиль канала ---------- */

.back { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; margin-bottom: 22px; transition: color 0.35s var(--ease); }
.back svg { width: 16px; height: 16px; transition: transform 0.5s var(--ease); }
.back:hover { color: var(--text); }
.back:hover svg { transform: translateX(-3px); }

.profile-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.profile-title-wrap { min-width: 0; flex: 1 1 380px; }
.profile-title { margin: 0 0 10px; font-size: clamp(24px, 2.6vw, 34px); line-height: 1.12; font-weight: 600; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.profile-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-button { cursor: pointer; transition: color 0.3s var(--ease), border-color 0.3s var(--ease); }
.chip-button:hover { color: var(--text); border-color: var(--line-strong); }
.chip-button svg { width: 12px; height: 12px; }
.description { color: var(--text-2); font-size: 13.5px; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; margin: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 24px; margin: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 550; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- Графики ---------- */

.chart { position: relative; height: 280px; }
.chart-sm { height: 220px; }
.chart-lg { height: 360px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis-text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis-title { fill: var(--muted); font-size: 11px; }
.chart .quadrant-text { fill: var(--muted); font-size: 11.5px; }
.chart .value-label { fill: var(--text-2); font-size: 11.5px; font-weight: 550; font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .guide-line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .crosshair { stroke: var(--crosshair); stroke-width: 1; shape-rendering: crispEdges; }
.chart .line-path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .draw { animation: draw 1.4s var(--ease-out) both; }
@keyframes draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.chart .area-path { animation: fade 1.2s var(--ease-out) both; }
@keyframes fade { from { opacity: 0; } }
.chart .bar, .chart .dot { transition: opacity 0.25s var(--ease); }
.chart.is-hovering .bar:not(.is-hot) { opacity: 0.45; }
.chart.is-hovering .dot:not(.is-hot) { opacity: 0.35; }

.tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  min-width: 150px;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--tooltip-bg);
  border: 1px solid var(--line-strong);
  box-shadow: var(--tooltip-shadow);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  font-size: 12.5px;
}
.tooltip.is-visible { opacity: 1; }
.tooltip-date { color: var(--muted); font-size: 11.5px; margin-bottom: 6px; }
.tooltip-title { font-weight: 600; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tooltip-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tooltip-row strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.tooltip-row span:last-child { color: var(--text-2); margin-left: auto; padding-left: 12px; }

.data-table-toggle { border: 0; background: none; color: var(--text-2); font-size: 12.5px; padding: 0; display: inline-flex; align-items: center; gap: 6px; }
.data-table-toggle:hover { color: var(--text); }
.data-table-toggle svg { width: 12px; height: 12px; transition: transform 0.5s var(--ease); }
.data-table-toggle[aria-expanded='true'] svg { transform: rotate(180deg); }
.data-table { max-height: 420px; overflow: auto; margin-top: 12px; }

.footnote { margin-top: 22px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.footnote b { color: var(--text-2); font-weight: 500; }
.footnote a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }

.notes { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.notes li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; font-size: 13.5px; color: var(--text-2); line-height: 1.55; }
.notes li b { color: var(--text); font-weight: 550; }
.notes .insight-icon { width: 28px; height: 28px; border-radius: 9px; }
.notes .insight-icon svg { width: 15px; height: 15px; }

.skeleton {
  border-radius: 12px;
  background: linear-gradient(90deg, var(--wash), var(--wash-strong), var(--wash));
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Реклама: граф, размещения, карточка поста ---------- */

.avatar-xs { width: 22px; height: 22px; border-radius: 7px; font-size: 10px; flex: none; }
.nowrap { white-space: nowrap; }
.link-go { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; }
.link-go svg { width: 14px; height: 14px; }

.route { display: flex; align-items: center; gap: 6px; min-width: 0; }
.route-arrow { flex: none; color: var(--muted); display: grid; }
.route-arrow svg { width: 13px; height: 13px; }
.ad-channel { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 160px; color: var(--text); }
a.ad-channel:hover .ad-channel-title { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.ad-channel.is-outside { color: var(--text-2); }
.ad-channel-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

.post-cell { display: flex; align-items: center; gap: 10px; min-width: 170px; max-width: 250px; }
.post-thumb { flex: none; width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: var(--wash); }
.post-snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.4; color: var(--text-2); white-space: normal; }
.ads-table tbody tr[data-post] { cursor: pointer; }
/* Без contain короткие тексты раздували колонку поста до максимума, и таблица вылезала за карточку */
.ads-table .post-snippet { flex: 1; min-width: 0; contain: inline-size; }
@media (max-width: 1520px) {
  .ads-table .route .ad-channel { max-width: 120px; }
}
.ads-table tr.is-network td { opacity: 0.62; }
.is-shared .delta { opacity: 0.6; }

.chart-network { height: 560px; border-radius: 16px; overflow: hidden; background: var(--core-raised); }
.chart .network { cursor: grab; touch-action: pan-y; user-select: none; }
.network .node { cursor: pointer; }
.network .edge path { fill: none; stroke: var(--line-strong); transition: stroke 0.25s var(--ease), opacity 0.25s var(--ease); }
.network .edge .edge-head { fill: var(--line-strong); stroke: none; }
.network .edge.is-network path:not(.edge-head) { stroke-dasharray: 3 3; }
.network .node circle { fill: var(--series-muted); stroke: var(--core-raised); stroke-width: 1.5; transition: opacity 0.25s var(--ease); }
.network .node.is-registry circle { fill: var(--series-1); }
.network .node.is-match circle { stroke: var(--accent); stroke-width: 3; }
.network .node-label { fill: var(--text-2); font-size: 11px; paint-order: stroke; stroke: var(--core-raised); stroke-width: 3px; stroke-linejoin: round; opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease); }
.network .node.show-label .node-label { opacity: 1; }
.network.is-dim .edge path, .network.is-dim .node circle { opacity: 0.18; }
.network.is-dim .edge.is-lit path { opacity: 1; stroke: var(--text-2); }
.network.is-dim .edge.is-lit .edge-head { fill: var(--text-2); }
.network.is-dim .node.is-lit circle { opacity: 1; }
.network .node.is-focus circle { stroke: var(--accent); stroke-width: 3; }
.network .node.is-focus .node-label { fill: var(--text); font-weight: 600; }
.network-controls { position: absolute; right: 12px; bottom: 12px; display: grid; gap: 4px; }
.network-controls button {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--core);
  color: var(--text-2);
  font: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.network-controls button:hover { color: var(--text); background: var(--wash-strong); }

.focus-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 8px; border-radius: 999px; background: var(--accent-soft); }
.focus-chip button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2); cursor: pointer; }
.focus-chip button:hover { background: var(--wash-strong); color: var(--text); }
.focus-chip svg { width: 13px; height: 13px; }

.modal {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--shell-line);
  border-radius: var(--radius-core);
  background: var(--core);
  color: var(--text);
  box-shadow: var(--tooltip-shadow);
  overflow: auto;
}
.modal:focus { outline: none; }
.modal::backdrop { background: rgba(8, 9, 12, 0.45); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 0; }
.modal-head .eyebrow { margin-bottom: 10px; }
.modal-route { display: grid; gap: 6px; margin-top: 8px; }
.modal-route .ad-channel { max-width: 240px; }
.modal-route-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--text-2); }
.modal-body { padding: 16px 20px 4px; }
.modal-image { display: block; max-width: 100%; max-height: 360px; margin-bottom: 14px; border-radius: 14px; object-fit: contain; background: var(--wash); }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }
.modal-facts { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.modal-facts dd small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.modal-links { display: grid; gap: 4px; margin-top: 16px; font-size: 12.5px; overflow-wrap: anywhere; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 20px; }

/* ---------- Нижняя панель вкладок на телефоне ---------- */

.tabbar { display: none; }

@media (max-width: 1080px) {
  .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; }
  .span-3 { grid-column: span 6; }
  .main { padding: 28px 28px 96px; }
  .dock { left: calc(256px + 14px + 28px); right: 28px; }
  .feed-row { grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr) 20px; }
  .feed-chart { display: none; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 10; height: auto; padding: 10px 12px 0; }
  .sidebar-inner {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 7px 7px 7px 10px;
    border-radius: 999px;
    background: var(--bar-bg);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
  }
  .brand { padding: 0; margin-right: auto; }
  .brand-mark { width: 30px; height: 30px; border-radius: 50%; }
  .brand-sub, .nav-label, .freshness, .sidebar .nav, .theme-switch, .logout span { display: none; }
  .sidebar-footer { margin-top: 0; flex-direction: row; }
  .theme-cycle { display: grid; }
  .logout { border-radius: 999px; }

  .tabbar {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 5px;
    border-radius: 22px;
    background: var(--bar-bg);
    border: 1px solid var(--shell-line);
    box-shadow: var(--tooltip-shadow);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
  }
  .tabbar a {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 7px 2px 6px;
    border-radius: 17px;
    font-size: 10.5px;
    color: var(--muted);
    transition: color 0.35s var(--ease), background-color 0.35s var(--ease);
  }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.is-active { color: var(--text); background: var(--wash-strong); }
  .tabbar .tab-dot { position: absolute; top: 6px; right: calc(50% - 16px); width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }

  .main { padding: 22px 16px 120px; }
  .span-6 { grid-column: span 12; }
  .chart-network { height: 440px; }
  .core { padding: 18px; }
  .hide-narrow { display: none; }
  .dock { left: 12px; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); }
  .feed-row { grid-template-columns: 34px minmax(0, 1fr) 16px; }
  .feed-what { grid-column: 2; }
  .feed-row .feed-chevron { grid-row: 1 / span 2; grid-column: 3; }
  .insight { grid-template-columns: 32px minmax(0, 1fr); }
  .insight-go { display: none; }
}

@media (max-width: 520px) {
  .span-3 { grid-column: span 6; }
  .span-3 .core { padding: 16px; }
  .span-3 .stat-value { font-size: 23px; }
  .span-3 .stat-value small { font-size: 14px; }
  .dock-core { padding: 10px 10px 10px 14px; }
  .dock-bar { gap: 10px 14px; }
  .dock-cpm, #plan-list { display: none; }
  .dock-actions { margin-left: auto; width: auto; }
  .dock-metric b { font-size: 14.5px; }
  .hide-phone { display: none; }
  .brand-name { display: none; }
  .search { flex-basis: 100%; }
  .toolbar .segmented { overflow-x: auto; }
  .table-core { padding: 4px 2px 6px; }
  .table th, .table td { padding-left: 8px; padding-right: 8px; }
  .channel-cell { min-width: 0; max-width: 136px; gap: 10px; }
  .channel-cell .avatar { display: none; }
  .cell-sub { font-size: 11px; }
}

.benchmark-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.benchmark-head b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.benchmark .meter { margin: 8px 0 6px; }

/* ---------- Панель фильтров: диапазоны и наборы ---------- */

.filter-toggle[aria-expanded='true'] { color: var(--text); border-color: var(--line-strong); background: var(--wash-strong); }
.filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.filter-panel { margin: -4px 0 14px; padding: 5px; border-radius: var(--radius-shell); background: var(--shell); border: 1px solid var(--shell-line); }
.filter-panel-core { border-radius: var(--radius-core); background: var(--core); box-shadow: var(--highlight), var(--card-shadow); padding: 18px 20px 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px 24px; }
.filter-field { display: grid; gap: 7px; align-content: start; min-width: 0; }
.filter-label { font-size: 12px; color: var(--text-2); }
.range-inputs { display: flex; align-items: center; gap: 6px; }
.range-input { position: relative; flex: 1; min-width: 0; }
.range-input span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 11.5px; color: var(--muted); pointer-events: none; }
.range-input input {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 30px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--wash);
  font-variant-numeric: tabular-nums;
  outline: none;
  -moz-appearance: textfield;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.range-input input::-webkit-inner-spin-button, .range-input input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.range-input input:focus { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--core); box-shadow: 0 0 0 3px var(--accent-soft); }
.range-dash, .range-unit { color: var(--muted); font-size: 12px; flex: none; }
.filter-options { display: flex; flex-wrap: wrap; gap: 5px; }
.filter-option {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--wash);
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.filter-option:hover { color: var(--text); }
.filter-option[aria-pressed='true'] { color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.filter-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.filter-note { margin-right: auto; font-size: 12px; color: var(--muted); }
.filter-active { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 4px 0 11px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}
.filter-chip-x { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: var(--text-2); transition: background-color 0.3s var(--ease); }
.filter-chip-x svg { width: 12px; height: 12px; }
.filter-chip:hover .filter-chip-x { background: var(--wash-strong); color: var(--text); }
.filter-clear { border: 0; background: none; padding: 0 6px; color: var(--muted); font-size: 12px; }
.filter-clear:hover { color: var(--text); }

/* ---------- Что читают ---------- */

.search-wide { flex-basis: 420px; }
.theme-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 16px; font-size: 12px; color: var(--muted); }
.theme-examples span { margin-right: 2px; }
.content-body { transition: opacity 0.3s var(--ease); }
.content-body.is-loading { opacity: 0.55; }

.lift-bar { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; }
.lift-track { position: relative; width: 88px; height: 6px; border-radius: 999px; background: var(--wash-strong); flex: none; }
.lift-track::after { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--axis); }
.lift-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.lift-fill.is-above { background: var(--series-1); }
.lift-fill.is-below { background: var(--series-2); }
.lift-bar b { min-width: 46px; text-align: right; font-weight: 550; font-variant-numeric: tabular-nums; }

.themes-core { padding-bottom: 8px; }
.themes-table tbody tr[data-term] { cursor: pointer; }
.themes-table tr.is-baseline td { background: var(--wash); color: var(--text-2); }
.theme-name { font-weight: 550; }

.break-list { display: grid; gap: 2px; }
.break-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: calc(100% + 20px);
  margin: 0 -10px;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  text-align: left;
  transition: background-color 0.3s var(--ease);
}
.break-row:hover { background: var(--wash); }
.break-row[aria-pressed='true'] { background: var(--accent-soft); }
.break-main { min-width: 0; }
.break-name { display: block; font-weight: 500; }
.break-sub { display: block; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.heatmap-wrap { position: relative; }
.heatmap-scroll { overflow-x: auto; }
.heatmap { display: grid; grid-template-columns: 26px repeat(24, minmax(17px, 1fr)); gap: 3px; min-width: 560px; }
.heat-hour { font-size: 10.5px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.heat-day { display: flex; align-items: center; font-size: 11.5px; color: var(--text-2); }
.heat-cell { height: 28px; padding: 0; border: 0; border-radius: 6px; background: var(--core-raised); box-shadow: inset 0 0 0 1px var(--line-soft); }
.heat-cell.is-sparse { background-image: repeating-linear-gradient(135deg, var(--wash-strong) 0 2px, transparent 2px 6px); }
.heat-cell:hover { box-shadow: inset 0 0 0 2px var(--text-2); }
.heat-cell.is-chosen { box-shadow: inset 0 0 0 2px var(--accent); }
.heat-scale { width: 110px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--series-2), var(--core-raised), var(--series-1)); box-shadow: inset 0 0 0 1px var(--line); }
.heat-sparse-swatch { width: 14px; height: 14px; border-radius: 4px; background: repeating-linear-gradient(135deg, var(--wash-strong) 0 2px, transparent 2px 6px); box-shadow: inset 0 0 0 1px var(--line); }

/* Выводы под дашбордами: текст — цветами текста, тон несёт только значок */
.takeaways { margin-top: 16px; padding: 12px 14px 13px; border-radius: 14px; background: var(--wash); border: 1px solid var(--line-soft); }
.takeaways-title { margin-bottom: 8px; font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.takeaways ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.takeaway { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 9px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.takeaway b { color: var(--text); font-weight: 600; }
.takeaway-icon { display: grid; place-items: center; width: 18px; height: 20px; color: var(--muted); }
.takeaway-icon svg { width: 15px; height: 15px; }
.takeaway.is-up .takeaway-icon { color: var(--up); }
.takeaway.is-down .takeaway-icon { color: var(--down); }
#summary .takeaways { margin-top: 0; padding: 0; background: none; border: 0; }
#summary .takeaways-title { font-size: 14px; font-weight: 550; text-transform: none; letter-spacing: -0.01em; color: var(--text); margin-bottom: 12px; }
.table-takeaways .takeaways { margin: 6px 10px 10px; }

.posts-table tbody tr[data-post] { cursor: pointer; }
/* Строка «канал · время · формат» не переносится — без contain её длина стала бы минимумом колонки и таблица вылезла бы за экран */
.posts-table .post-col { width: 60%; }
.posts-table .post-cell { min-width: 230px; max-width: none; }
.post-main { flex: 1; min-width: 0; contain: inline-size; }
.post-tags { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-channel { color: var(--text-2); font-weight: 500; }
.post-channel:hover { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.best-post { border: 0; background: none; padding: 0; font: inherit; font-variant-numeric: tabular-nums; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.idea-snippet { max-width: 520px; }

/* Реклама: фильтры в списке размещений, креативы, разборы и лидеры закупок */
.table-filters { padding: 8px 10px 0; }
.table-filters .filter-panel { margin-top: 0; }
.creative-list { display: grid; gap: 2px; }
.creative-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 0 -10px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.3s var(--ease);
}
.creative-row:hover { background: var(--wash); }
.creative-row .post-cell { max-width: none; min-width: 0; }
.creative-meta { display: flex; align-items: center; min-width: 0; margin-top: 3px; }
.creative-meta .post-tags { margin-top: 0; min-width: 0; }
.creative-score { display: grid; justify-items: end; gap: 2px; }
.factor + .factor { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.factor-title { margin-bottom: 4px; font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.factor .takeaways { margin-top: 8px; }
.leaders-table tbody tr[data-target] { cursor: pointer; }

/* Сравнение каналов: цвет серии — только у отметок канала, текст — цветами текста */
.compare-picker { position: relative; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.compare-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 320px; padding: 5px 6px 5px 12px; border-radius: 999px; background: var(--core); border: 1px solid var(--line); }
.compare-chip button { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.compare-chip button:hover { background: var(--wash); color: var(--text); }
.compare-chip button svg { width: 14px; height: 14px; }
.compare-add { position: relative; flex: 0 1 320px; min-width: 220px; }
.compare-add .search { flex: none; width: 100%; min-width: 0; }
.compare-results { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; padding: 6px; border-radius: 16px; background: var(--core); border: 1px solid var(--line); box-shadow: var(--card-shadow); }
.compare-result { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 10px; background: none; text-align: left; }
.compare-result:hover, .compare-result:focus-visible { background: var(--wash); }
.compare-result .ad-channel-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-summary .takeaways { margin-top: 0; padding: 0; background: none; border: 0; }
.compare-summary .takeaways-title { font-size: 14px; font-weight: 550; text-transform: none; letter-spacing: -0.01em; color: var(--text); margin-bottom: 12px; }
.compare-table { table-layout: fixed; min-width: 640px; }
.compare-table th:first-child { width: 26%; }
.compare-head { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text); font-weight: 550; }
.compare-head .ad-channel-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-table td { vertical-align: top; }
.compare-table .compare-group td { padding-top: 16px; font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); background: none; }
.compare-label { color: var(--text-2); }
.compare-table td.is-best { font-weight: 650; color: var(--text); }
.compare-table-core .card-foot { margin: 6px 10px 10px; }
.compare-legend { margin: -4px 0 10px; }
.compare-format + .compare-format { margin-top: 12px; }
.compare-bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 58px 110px; align-items: center; gap: 10px; min-height: 22px; }
.compare-bar { position: relative; height: 8px; border-radius: 999px; background: var(--wash-strong); overflow: hidden; }
.compare-bar span { position: absolute; inset: 0 auto 0 0; border-radius: 999px; }
.compare-bar-row b { text-align: right; font-weight: 550; font-variant-numeric: tabular-nums; }
.compare-bar-row .cell-sub { margin: 0; }
.compare-hours-row + .compare-hours-row { margin-top: 14px; }
.compare-hours-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 6px; font-weight: 500; }
.compare-hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; }
.compare-hour { height: 26px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line-soft); }
.compare-hours-axis { margin-top: 6px; }
.compare-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.compare-top-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-weight: 550; min-width: 0; }
.compare-top-head .ad-channel-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-shared { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px 28px; }
.compare-shared-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.compare-shared-row .ad-channel { max-width: 260px; }
.compare-dots { display: inline-flex; gap: 4px; }
.leaders-table .ad-channel { max-width: 340px; }
.creative-meta { gap: 6px; }
@media (max-width: 520px) {
  .posts-table .post-cell { min-width: 150px; max-width: 200px; }
  .creative-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .leaders-table .ad-channel { max-width: 130px; }
  .compare-bar-row { grid-template-columns: minmax(0, 1fr) 52px; }
  .compare-bar-row .cell-sub { display: none; }
  .compare-hour { height: 20px; border-radius: 3px; }
  .creative-score { justify-items: start; }
  .lift-track { width: 56px; }
  .filter-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Широкие таблицы (площадки, реестр): колонка названия уже, отступы меньше — всё помещается без прокрутки */
.compact-table .channel-cell { min-width: 210px; max-width: 290px; }
.compact-table th, .compact-table td { padding-left: 10px; padding-right: 10px; }
@media (max-width: 1520px) {
  .hide-md { display: none; }
}
@media (max-width: 1180px) {
  .hide-lg { display: none; }
}
