:root {
  --color-page: #eef3f8;
  --color-surface: #ffffff;
  --color-surface-muted: #f7f9fc;
  --color-text: #172033;
  --color-text-secondary: #5c6d82;
  --color-border: #dbe3ec;
  --color-accent: #1769aa;
  --color-accent-dark: #0b5f9b;
  font-family: Inter, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-page);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-page);
}
.page {
  max-width: 1480px;
  margin: auto;
  padding: 20px;
}
.page__header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 22px 24px;
  border-radius: 14px;
  background: #153f66;
  color: white;
  box-shadow:
    0 1px 2px rgba(16, 35, 55, 0.08),
    0 10px 28px rgba(16, 35, 55, 0.12);
}
.eyebrow {
  margin: 0 0 5px;
  color: #b9dcf7;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
h1 {
  font-size: 30px;
  line-height: 1.15;
  margin: 0;
}
h2 {
  font-size: 18px;
  margin: 0;
}
.subtitle,
.table-card__head p {
  color: var(--color-text-secondary);
  margin: 7px 0 0;
}
.page__header .subtitle {
  color: #d8e8f5;
}
.sync {
  font-size: 13px;
  color: #e4f1fb;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}
.tabs {
  display: flex;
  width: fit-content;
  gap: 4px;
  margin-top: 14px;
  padding: 5px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(16, 35, 55, 0.05);
}
.tab {
  border: 0;
  background: transparent;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 8px;
  color: #52637a;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition-property: background-color, color, transform;
  transition-duration: 120ms;
  transition-timing-function: ease-out;
}
.tab.is-active {
  color: white;
  background: var(--color-accent);
  box-shadow: 0 1px 2px rgba(11, 70, 115, 0.18);
}
.tab:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
.table-wrap:focus-visible,
a:focus-visible {
  outline: 3px solid #0b5f9b;
  outline-offset: 2px;
}
.filters {
  display: grid;
  grid-template-columns: 180px 180px minmax(240px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin: 14px 0 18px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: 0 1px 3px rgba(16, 35, 55, 0.04);
}
.filters label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: #46556a;
}
.filters input,
.filters select {
  width: 100%;
  height: 42px;
  border: 1px solid #cdd5df;
  border-radius: 7px;
  background: white;
  color: #172033;
  padding: 0 11px;
  font: inherit;
}
.primary,
.secondary {
  height: 42px;
  border-radius: 7px;
  padding: 0 17px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition-property: background-color, border-color, color, transform;
  transition-duration: 120ms;
  transition-timing-function: ease-out;
}
.primary {
  border: 1px solid #1769aa;
  background: #1769aa;
  color: white;
}
.secondary {
  border: 1px solid #cdd5df;
  background: white;
  color: #243249;
}
.primary:active,
.secondary:active,
.tab:active {
  transform: scale(0.96);
}
.notice {
  padding: 13px 15px;
  border: 1px solid #efcf83;
  background: #fff8e6;
  border-radius: 8px;
  color: #684d12;
  margin-bottom: 18px;
}
.notice.is-error {
  border-color: #e0a5a5;
  background: #fff0f0;
  color: #782121;
}
.kpi-group {
  margin-bottom: 22px;
}
.kpi-group > h2 {
  font-size: 13px;
  color: #40536a;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
}
.summary article {
  position: relative;
  min-height: 108px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 17px 16px;
  box-shadow: 0 2px 8px rgba(16, 35, 55, 0.04);
}
.summary span {
  display: block;
  color: var(--color-text-secondary);
  font-size: 12px;
  margin-bottom: 7px;
}
.summary strong {
  font-size: 24px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.summary small {
  display: block;
  color: #637083;
  margin-top: 5px;
  line-height: 1.3;
}
.funnel {
  counter-reset: funnel-step;
}
.funnel article {
  padding-inline-end: 44px;
}
.funnel article::before {
  counter-increment: funnel-step;
  content: counter(funnel-step);
  position: absolute;
  inset-block-start: 15px;
  inset-inline-end: 15px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #edf3f8;
  color: #526b82;
  font-size: 12px;
  font-weight: 700;
}
.funnel article:not(:last-child)::after {
  content: "›";
  position: absolute;
  right: -9px;
  top: 28px;
  z-index: 1;
  color: #9aa7b8;
  background: var(--color-page);
  font-size: 20px;
  padding: 0 2px;
}
.table-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 1px 3px rgba(16, 35, 55, 0.05),
    0 8px 24px rgba(16, 35, 55, 0.05);
}
.table-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 19px 20px;
  border-bottom: 1px solid #e5e9ef;
  background: var(--color-surface-muted);
}
.table-wrap {
  overflow: auto;
  max-height: 65vh;
}
.table-scroll-hint {
  display: none;
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e9ef;
  background: #eef6fc;
  color: #244b6d;
  font-size: 13px;
  line-height: 1.4;
}
.table-scroll-hint:not([hidden]) {
  display: block;
}
.table-scroll-hint span {
  display: inline-block;
  margin-inline-end: 5px;
  font-size: 18px;
  vertical-align: -1px;
}
table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #e9edf2;
  text-align: right;
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f6fa;
  color: #566478;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
th:first-child,
td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--color-surface);
  min-width: 260px;
  max-width: 340px;
  white-space: normal;
  box-shadow: 8px 0 14px -16px rgba(20, 43, 65, 0.9);
}
th:first-child {
  z-index: 3;
  background: #f3f6fa;
}
tr.total td {
  background: #eef6fc;
  font-weight: 750;
}
tr.total td:first-child {
  background: #eef6fc;
}
.vk-only {
  display: none;
}
.channel-vk .vk-only {
  display: table-cell;
}
.tree-name {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding-inline-start: calc(var(--tree-level) * 22px);
}
.tree-toggle,
.tree-spacer {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
}
.tree-toggle {
  display: grid;
  place-items: center;
  margin-top: -3px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #1769aa;
  cursor: pointer;
}
.tree-toggle:hover {
  background: #e7f1f9;
}
.tree-toggle span {
  font-size: 21px;
  line-height: 1;
  transition: transform 120ms ease-out;
}
.tree-toggle[aria-expanded="true"] span {
  transform: rotate(90deg);
}
.kind-section td,
.kind-group td {
  background: #f8fafc;
  font-weight: 650;
}
.kind-section td:first-child,
.kind-group td:first-child {
  background: #f8fafc;
}
.kind-keyword td:first-child,
.kind-placement td:first-child,
.kind-ad td:first-child {
  color: #485a70;
}
.metric-link {
  color: #0969a9;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}
.metric-link:hover {
  border-bottom-style: solid;
}
.empty {
  text-align: center;
  padding: 54px 20px;
  color: #637083;
}
.empty h3 {
  color: #27364b;
  margin: 0 0 8px;
}
.positive {
  color: #157347;
}
.negative {
  color: #b42318;
}
@media (max-width: 1100px) {
  .summary {
    grid-template-columns: repeat(3, 1fr);
  }
  .funnel article::after {
    display: none;
  }
}
@media (max-width: 900px) {
  .page {
    padding: 16px;
  }
  .page__header {
    display: block;
    padding: 20px;
  }
  .sync {
    margin-top: 8px;
  }
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .campaign-filter {
    grid-column: 1/-1;
  }
  .primary {
    grid-column: 1/-1;
  }
  .summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .table-card__head {
    align-items: flex-start;
    gap: 12px;
  }
  .secondary {
    flex: 0 0 auto;
  }
}
@media (max-width: 520px) {
  h1 {
    font-size: 25px;
  }
  .page {
    padding: 10px;
  }
  .page__header {
    padding: 18px;
    border-radius: 12px;
  }
  .sync {
    width: fit-content;
  }
  .tabs {
    width: 100%;
  }
  .tab {
    flex: 1;
    padding-inline: 10px;
  }
  .filters {
    grid-template-columns: 1fr;
    margin-top: 10px;
    padding: 14px;
  }
  .campaign-filter,
  .primary {
    grid-column: auto;
  }
  .summary {
    grid-template-columns: 1fr 1fr;
  }
  .filters input,
  .filters select {
    font-size: 16px;
  }
  .table-card__head {
    display: block;
  }
  .secondary {
    margin-top: 13px;
    width: 100%;
  }
}
