/* Interactive developer dashboard. */
@font-face {
  font-family: Onest;
  src: url('/site5/fonts/onest-cyrillic.woff2') format('woff2');
  font-display: swap;
}

:root {
  --ink: #172033;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --canvas: #f2f4f7;
  --blue: #3975e8;
  --blue-soft: #eaf1ff;
  --red: #bf3651;
  --green: #2f8f4e;
  --amber: #d88a1e;
  --purple: #8c5ac2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 28px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Onest, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, select, input { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ========================================================================== */
/* Шапка                                                                      */
/* ========================================================================== */
.demo-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px clamp(18px, 3vw, 48px);
  color: #fff;
  background: #0c2340;
}

.demo-logo {
  flex: none;
  color: #fff;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.demo-logo span { color: #f5a623; }

.demo-header-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.demo-header-copy strong { font-size: 15px; }
.demo-header-copy span { color: #aebbd0; font-size: 13px; }

.demo-back {
  margin-left: auto;
  padding: 10px 14px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .2s, background .2s;
}

.demo-back:hover { border-color: #fff; background: rgba(255,255,255,.08); }

/* ========================================================================== */
/* Каркас                                                                     */
/* ========================================================================== */
.dashboard-shell { padding: 28px clamp(12px, 2.5vw, 40px) 56px; }

.dashboard { max-width: 1540px; margin: 0 auto; }

.dashboard-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(27px, 3vw, 42px);
  letter-spacing: -.045em;
  line-height: 1.08;
}

.demo-notice {
  max-width: 490px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  color: #465166;
  background: #fff9e9;
  border: 1px solid #f1dfaa;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
}

.notice-dot {
  width: 8px;
  height: 8px;
  flex: none;
  margin-top: 5px;
  background: var(--amber);
  border-radius: 50%;
}

.dashboard-tabs {
  display: flex;
  overflow-x: auto;
  scrollbar-width: thin;
  border-bottom: 1px solid #d8dde6;
}

.dashboard-tabs button {
  position: relative;
  flex: none;
  padding: 13px 17px 14px;
  color: #667085;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 15px;
  white-space: nowrap;
}

.dashboard-tabs button::after {
  content: '';
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 2px;
  background: transparent;
}

.dashboard-tabs button:hover { color: var(--ink); }
.dashboard-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 650; }
.dashboard-tabs button[aria-selected="true"]::after { background: var(--blue); }

/* ========================================================================== */
/* Фильтры                                                                    */
/* ========================================================================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 0 10px;
}

.filter-control {
  position: relative;
  min-width: 186px;
  padding: 8px 10px 9px;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 11px;
  box-shadow: var(--shadow);
}

.filter-control > span {
  display: block;
  margin: 0 2px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.filter-control select {
  width: 100%;
  min-height: 28px;
  padding: 0 26px 0 2px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.filter-control:focus-within { border-color: #9bbcf8; }
.source-filter { min-width: 216px; }

/* Мультиселект */
.ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 28px;
  padding: 0 2px;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.ms-trigger em { overflow: hidden; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.ms-trigger::after { content: '⌄'; flex: none; margin-top: -6px; color: #8a93a5; font-size: 15px; }
.ms[data-open="true"] .ms-trigger::after { transform: rotate(180deg); margin-top: 4px; }

.ms-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  background: #fff;
  border: 1px solid #dfe4ec;
  border-radius: 11px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
}

.ms-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
}

.ms-option:hover { background: #f4f7fd; }
.ms-option input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); }

.ms-foot { display: flex; gap: 8px; margin-top: 6px; padding-top: 8px; border-top: 1px solid #eceff4; }
.ms-foot button {
  flex: 1;
  padding: 6px 8px;
  color: #475467;
  background: #f4f6fa;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
}
.ms-foot button:hover { color: var(--blue); background: var(--blue-soft); }

/* Пресеты периода */
.preset-group { display: flex; align-self: stretch; align-items: stretch; gap: 0; }
.preset-group button {
  padding: 0 13px;
  color: #475467;
  background: #fff;
  border: 1px solid #dfe4ec;
  border-left-width: 0;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.preset-group button:first-child { border-left-width: 1px; border-radius: 11px 0 0 11px; }
.preset-group button:last-child { border-radius: 0 11px 11px 0; }
.preset-group button:hover { color: var(--blue); background: var(--blue-soft); }
.preset-group button[aria-pressed="true"] { color: #fff; background: var(--blue); border-color: var(--blue); font-weight: 650; }

.reset-filters {
  align-self: stretch;
  padding: 0 17px;
  color: #475467;
  background: transparent;
  border: 1px solid #cfd5df;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13px;
}

.reset-filters:hover { color: var(--blue); border-color: var(--blue); }

.filter-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 30px;
  padding-bottom: 12px;
}

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.chips-label { color: var(--muted); font-size: 12.5px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px 5px 11px;
  color: #1c3d7a;
  background: var(--blue-soft);
  border: 1px solid #cadcfd;
  border-radius: 999px;
  font-size: 12.5px;
}

.chip b { font-weight: 650; }
.chip button {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  color: #2f5fae;
  background: rgba(57, 117, 232, .14);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.chip button:hover { color: #fff; background: var(--blue); }

.updated-stamp { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; }
.updated-stamp::before { content: ''; width: 7px; height: 7px; background: #35b06a; border-radius: 50%; }

/* ========================================================================== */
/* Секции и панели                                                            */
/* ========================================================================== */
.dashboard-content { min-height: 620px; }

.section-head { margin: 4px 0 14px; }

.section-head h2 {
  margin: 0;
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: -.035em;
}

.section-head p {
  max-width: 640px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.45;
}

.kpi-card, .panel {
  background: var(--surface);
  border: 1px solid #edf0f4;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel { min-width: 0; padding: 16px 16px 14px; }
.panel + .panel, .panel + .grid-2, .grid-2 + .panel, .kpi-grid + .panel { margin-top: 10px; }

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.panel-title h3 { margin: 0; font-size: 15px; }
.panel-title .panel-sub { color: var(--muted); font-size: 12px; }
.panel-head-left { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.panel-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.panel-actions button {
  padding: 5px 10px;
  color: #55637a;
  background: #f5f7fa;
  border: 1px solid #e6eaf0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.panel-actions button:hover { color: var(--blue); background: var(--blue-soft); border-color: #cadcfd; }
.panel-actions button[aria-pressed="true"] { color: #fff; background: var(--blue); border-color: var(--blue); }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(400px, 1fr);
  align-items: start;
  gap: 10px;
  margin-top: 10px;
}

.grid-equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ========================================================================== */
/* KPI                                                                        */
/* ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.kpi-card { display: flex; flex-direction: column; min-height: 132px; padding: 16px 17px 14px; }
.kpi-card .kpi-label { min-height: 34px; display: block; color: #475467; font-size: 13px; line-height: 1.32; }

.kpi-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: clamp(26px, 2.1vw, 34px);
  letter-spacing: -.045em;
  line-height: 1.05;
}

/* Текстовые значения (названия источников, месяцев) не должны спорить с числами */
.kpi-card strong.is-text { font-size: 20px; letter-spacing: -.02em; line-height: 1.2; }

.kpi-card small { display: block; margin-top: auto; padding-top: 8px; color: #7a8496; font-size: 11.5px; }

/* ========================================================================== */
/* Графики                                                                    */
/* ========================================================================== */
.chart-block { position: relative; }
.chart-host { width: 100%; }
.chart-host svg { display: block; width: 100%; }
.chart-overlay { fill: transparent; }
.chart-overlay.is-clickable { cursor: pointer; }
.chart-empty { display: grid; place-items: center; height: 100%; min-height: 200px; color: var(--muted); font-size: 14px; }

.chart-cross { stroke: #b6c0cf; stroke-width: 1; stroke-dasharray: 3 3; }
.chart-halo { stroke: #fff; stroke-width: 2.5; }
.chart-bar-active { opacity: .78; }

.chart-tip {
  position: fixed;
  z-index: 90;
  max-width: 280px;
  padding: 9px 11px;
  color: #f2f5fa;
  background: rgba(14, 26, 45, .95);
  border-radius: 9px;
  box-shadow: 0 10px 26px rgba(12, 26, 48, .28);
  font-family: Onest, Arial, sans-serif;
  font-size: 12.5px;
  line-height: 1.45;
  pointer-events: none;
}
.chart-tip strong { display: block; margin-bottom: 5px; font-size: 13px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; }
.chart-tip .tip-row i { width: 9px; height: 9px; flex: none; border-radius: 2px; }
.chart-tip .tip-row span { flex: 1; color: #b9c5d6; }
.chart-tip .tip-row b { font-variant-numeric: tabular-nums; font-weight: 650; }
.chart-tip .tip-hint { margin-top: 6px; color: #8d9ab0; font-size: 11.5px; }

.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; margin-top: 8px; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  color: #46536b;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12.5px;
}
.legend-item:hover { background: #f2f5fa; border-color: #e4e9f1; }
.legend-item i { width: 14px; height: 3px; flex: none; border-radius: 2px; }
.legend-item.is-off { color: #a2abba; }
.legend-item.is-off i { opacity: .3; }

/* ========================================================================== */
/* Таблицы                                                                    */
/* ========================================================================== */
.table-scroll { max-width: 100%; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { min-width: 92px; padding: 9px 11px; border: 1px solid #e1e5eb; text-align: right; white-space: nowrap; }
.data-table th { position: relative; color: #475467; background: #f8f9fb; font-weight: 650; }
.data-table th.txt, .data-table td.txt { text-align: left; }
.data-table th:first-child, .data-table td:first-child { position: sticky; left: 0; z-index: 1; min-width: 168px; text-align: left; background: #fff; }
.data-table th:first-child { z-index: 2; background: #f8f9fb; }
.data-table tbody tr:hover td { background: #f7f9fd; }
.data-table tbody tr:hover td:first-child { background: #f7f9fd; }
.data-table tfoot td { background: #f0f2f5; font-weight: 750; }
.data-table tfoot td:first-child { background: #f0f2f5; }
.data-table .muted-cell { color: #98a2b3; }

.data-table th[data-col] { cursor: pointer; user-select: none; padding-right: 20px; }
.data-table th[data-col]:hover { color: var(--blue); }
.sort-mark { position: absolute; top: 50%; right: 7px; transform: translateY(-50%); color: #b6bec9; font-size: 9px; font-style: normal; }
.data-table th[aria-sort="ascending"] .sort-mark::after { content: '▲'; color: var(--blue); }
.data-table th[aria-sort="descending"] .sort-mark::after { content: '▼'; color: var(--blue); }
.data-table th[data-col]:not([aria-sort]) .sort-mark::after { content: '⇅'; }

.cell-filter {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed #b8c2d2;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.cell-filter:hover { color: var(--blue); border-bottom-color: var(--blue); }
.cell-filter.is-active { color: var(--blue); font-weight: 650; }

.drill-toggle {
  width: 18px;
  height: 18px;
  margin-right: 7px;
  padding: 0;
  color: #55637a;
  background: #eef1f6;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  vertical-align: middle;
}
.drill-toggle:hover { color: #fff; background: var(--blue); }
.drill-child td { color: #52607a; background: #fbfcfe; }
.drill-child td:first-child { padding-left: 38px; background: #fbfcfe; font-size: 12.5px; }

/* Тепловая карта: сине-оранжевая дивергентная шкала (различима при дальтонизме) */
.heat-cell { color: #172033; font-weight: 650; }
.heat-1 { background: #f3b98c; }
.heat-2 { background: #fadfc6; }
.heat-3 { background: #eef1f5; }
.heat-4 { background: #d3e2f8; }
.heat-5 { background: #a8c8f2; }

.heat-legend { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.heat-legend i { width: 26px; height: 11px; display: block; border-radius: 2px; }
.heat-legend .heat-scale { display: flex; gap: 2px; }

/* ========================================================================== */
/* Карточки каналов, доменов, воронка                                         */
/* ========================================================================== */
.channel-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 10px; margin-bottom: 10px; }
.channel-card { padding: 15px; background: #fff; border: 1px solid #e8ecf2; border-radius: 12px; }
.channel-card > span { color: var(--muted); font-size: 11.5px; }
.channel-card h3 { min-height: 38px; margin: 7px 0 11px; font-size: 15px; }
.channel-card h3 button { font-size: inherit; font-weight: inherit; }
.channel-card dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 0; font-size: 12.5px; }
.channel-card dt { color: var(--muted); }
.channel-card dd { margin: 0; font-weight: 650; }

.domain-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-bottom: 10px; }
.domain-card { padding: 16px; background: #fff; border: 1px solid #e8ecf2; border-radius: 12px; }
.domain-card code { color: #3568c6; font-family: inherit; font-size: 13px; }
.domain-card strong { display: block; margin-top: 12px; font-size: 25px; letter-spacing: -.03em; }
.domain-card span { color: var(--muted); font-size: 11.5px; }

.funnel { display: grid; gap: 10px; padding: 8px 0; }
.funnel-row { display: grid; grid-template-columns: 140px minmax(120px, 1fr) 78px; align-items: center; gap: 10px; font-size: 13px; }
.funnel-track { height: 32px; overflow: hidden; background: #f0f3f7; border-radius: 6px; }
.funnel-fill { min-width: 3px; height: 100%; background: linear-gradient(90deg, #82aefb, #3975e8); }
.funnel-row strong { text-align: right; font-variant-numeric: tabular-nums; }
.funnel-step { display: flex; justify-content: space-between; gap: 10px; padding: 0 2px; color: var(--muted); font-size: 12px; }

.campaign-name { max-width: 300px; white-space: normal !important; }
.share-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.share-bar i { width: 60px; height: 9px; display: inline-block; overflow: hidden; background: #edf0f4; border-radius: 5px; }
.share-bar i::after { content: ''; display: block; width: var(--share); height: 100%; background: #6ea8f5; }

.demo-explanation {
  max-width: 1540px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin: 22px auto 0;
  padding: 18px 20px;
  color: #e8edf7;
  background: #0c2340;
  border-radius: 14px;
}

.demo-explanation > span { color: #9fb0c9; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.demo-explanation p { margin: 0; font-size: 13px; line-height: 1.55; }
.demo-explanation a { color: #fff; font-size: 13px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.demo-explanation a b { color: #f5a623; }

.screen-reader-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

/* ========================================================================== */
/* Адаптив                                                                    */
/* ========================================================================== */
@media (max-width: 1180px) {
  .grid-2, .grid-equal { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .demo-header { min-height: 60px; gap: 14px; padding: 10px 16px; }
  .demo-header-copy span { display: none; }
  .demo-header-copy strong { display: block; max-width: 190px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
  .demo-back { padding: 8px 10px; font-size: 0; }
  .demo-back span { font-size: 15px; }
  .dashboard-shell { padding: 20px 10px 36px; }
  .dashboard-intro { display: block; }
  .demo-notice { margin-top: 14px; }
  .dashboard-tabs { margin-right: -10px; }
  .dashboard-tabs button { padding-right: 13px; padding-left: 13px; font-size: 14px; }
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-control, .source-filter { min-width: 0; }
  .filter-control:first-child, .source-filter { grid-column: span 2; }
  .preset-group { grid-column: span 2; }
  .preset-group button { flex: 1; padding: 10px 6px; }
  .reset-filters { grid-column: span 2; min-height: 44px; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); }
  .kpi-card { min-height: 142px; padding: 14px; }
  .kpi-card strong { font-size: 26px; }
  .panel { padding: 12px; }
  .funnel-row { grid-template-columns: 104px minmax(90px, 1fr) 62px; font-size: 12px; }
  .demo-explanation { grid-template-columns: 1fr; gap: 9px; }
}

@media (max-width: 390px) {
  .demo-header-copy { display: none; }
  .kpi-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
