/* Кабинет рекламы — визуальный язык Гипериона (палитра «сталь»), по согласованному
   макету: светло-серый фон, белые карточки с волосяной рамкой, уголь, оранжевый
   градиент со свечением только на главном действии и цели. Текстом оранжевый
   берёт читаемый --accent-ink. Светлая тема по умолчанию, тёмная — по
   prefers-color-scheme.

   Путь статики нейтральный (ui/): блокировщики рекламы режут файлы, в адресе
   которых есть «postback», «ads», «track», «pixel» и похожие слова. */

/* Шрифты свои (SIL OFL 1.1, лицензии рядом). У Inter Tight и Martian Mono только
   латиница: русский текст берёт системный гротеск, моноширинный — IBM Plex Mono. */
@font-face {
  font-family: "Inter Tight";
  src: url("fonts/inter-tight-var-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Martian Mono";
  src: url("fonts/martian-mono-var-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 112.5%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-400-cyrillic.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0400-045F, U+0490-0491, U+04D8-04D9, U+04E8-04E9;
}

:root {
  --bg: #eeeeee;
  --surface: #ffffff;
  --surface-2: #e2e2e2;
  --surface-3: #fafafa;
  --ink: #1c1c1c;
  --ink-2: #5c5c5c;
  --ink-3: #6a6a6a;
  --line: #d9d9d9;
  --line-soft: #e2e2e2;
  --line-strong: #c4c4c4;
  --accent-soft: #ffe9dc;
  --accent-ink: #b0400a;
  --accent-ink-hover: #8a3208;
  --on-accent: #1c1c1c;
  --panel: #1c1c1c;
  --on-panel: #f2f2f2;
  --on-panel-2: #ababab;
  --panel-accent: #ff9a5c;
  --bad: #c0271d;
  --bad-soft: #fbe3e1;
  --warn: #8a6100;
  --warn-soft: #f6ecd5;
  color-scheme: light;

  --grad-accent: linear-gradient(135deg, #ffb84d 0%, #ff7426 55%, #e83d0c 100%);
  --grad-accent-down: linear-gradient(180deg, #ffb84d 0%, #ff7426 55%, #e83d0c 100%);
  --glow: 0 6px 18px rgb(255 116 38 / 0.22);
  --glow-hot: 0 8px 26px rgb(255 116 38 / 0.36);
  --glow-soft: 0 4px 14px rgb(255 116 38 / 0.25);

  --font: "Inter Tight", "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Martian Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
    Consolas, monospace;

  --r-sm: 8px;
  --r: 10px;
  --r-md: 12px;
  --r-card: 16px;
  --control-h: 44px;
  --field-h: 48px;
  --dur-fast: 150ms;
  --dur-base: 300ms;
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-emphasized: cubic-bezier(0.05, 0.7, 0.1, 1);
  --stagger: 60ms;
  --focus-ring: #ff7426;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --surface: #242424;
    --surface-2: #2f2f2f;
    --surface-3: #292929;
    --ink: #f2f2f2;
    --ink-2: #ababab;
    --ink-3: #9a9a9a;
    --line: #383838;
    --line-soft: #303030;
    --line-strong: #4a4a4a;
    --accent-soft: #3a2418;
    --accent-ink: #ff9a5c;
    --accent-ink-hover: #ffb27f;
    --panel: #111111;
    --bad: #f08a80;
    --bad-soft: #2e1a18;
    --warn: #e0b060;
    --warn-soft: #2c2412;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--accent-ink-hover); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

p { margin: 0; text-wrap: pretty; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.muted { color: var(--ink-2); }
.mono { font-family: var(--mono); font-size: 0.875em; }
.caption { font-size: 14px; color: var(--ink-3); }
.lead { font-size: 16px; color: var(--ink-2); max-width: 66ch; }
.eyebrow {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Шапка ------------------------------------------------------------------ */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-height: 64px;
  padding: 8px 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.top-main, .top-side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; }
.top-side { gap: 8px 16px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand-mark { width: auto; height: 24px; fill: currentColor; }
.brand-mark .dot { fill: url(#grad-accent) #ff7426; }
.brand-sub { font-weight: 400; color: var(--ink-2); }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  padding: 0 14px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav a:hover { color: var(--ink); background: var(--surface-3); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); font-weight: 500; }

.switcher { position: relative; }
.switcher summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  list-style: none;
}
.switcher summary::-webkit-details-marker { display: none; }
.switcher summary svg { fill: none; stroke: var(--ink-2); stroke-width: 1.6; transition: transform var(--dur-fast) var(--ease-out); }
.switcher[open] summary svg { transform: rotate(180deg); }
.switcher-list {
  position: absolute;
  right: 0;
  z-index: 10;
  min-width: 220px;
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgb(28 28 28 / 0.12);
}
.switcher-list a {
  display: flex;
  align-items: center;
  min-height: var(--control-h);
  padding: 0 12px;
  border-radius: var(--r-sm);
  color: var(--ink);
  text-decoration: none;
}
.switcher-list a:hover { background: var(--surface-3); }
.switcher-list a[aria-current="true"] { background: var(--accent-soft); font-weight: 600; }
.company-tag { font-size: 14px; color: var(--ink-2); padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.logout { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.who { color: var(--ink-2); }

/* Страница --------------------------------------------------------------- */

.page {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1280px;
  padding: 32px 40px 80px;
}
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.page-head > div:first-child { display: grid; gap: 6px; }
.page-title {
  margin: 0;
  font-size: clamp(26px, 22px + 1vw, 30px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.crumbs { font-size: 14px; margin-bottom: -12px; }
.subnav { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: var(--r); align-self: flex-start; }
.subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
}
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.section { padding: 28px; display: grid; gap: 16px; align-content: start; }
.section-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; justify-content: space-between; }
.section-head > div { display: grid; gap: 6px; max-width: 70ch; }
.card-title { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.3; }
.card-title.spaced { margin-top: 16px; }
.sub-title { margin: 8px 0 0; font-size: 16px; font-weight: 600; }
.split { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px; align-items: start; }
.stack { display: grid; gap: 24px; }
.narrow { max-width: 560px; }

.messages { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.message {
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: inset 3px 0 0 #ff7426;
}
.message.error { color: var(--bad); background: var(--bad-soft); border-color: transparent; box-shadow: inset 3px 0 0 var(--bad); }

/* Кнопки ----------------------------------------------------------------- */

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-h);
  padding: 0 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
button:hover, .button:hover { color: var(--ink); border-color: var(--ink-2); }
button:active, .button:active { transform: scale(0.97); }
.primary, button.primary {
  min-height: var(--field-h);
  padding: 0 24px;
  font-weight: 600;
  font-size: 16px;
  color: var(--on-accent);
  background: var(--grad-accent);
  border-color: transparent;
  box-shadow: var(--glow);
}
.primary:hover, button.primary:hover { color: var(--on-accent); border-color: transparent; box-shadow: var(--glow-hot); }
.secondary { background: var(--surface); }
.dark, button.dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.dark:hover, button.dark:hover { color: var(--surface); background: color-mix(in srgb, var(--ink) 86%, var(--surface)); }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
button.link {
  min-height: var(--control-h);
  padding: 0 4px;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
button.link:hover { color: var(--ink); }
.wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* Формы ------------------------------------------------------------------ */

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > label, .field-label { font-size: 14px; font-weight: 500; color: var(--ink); }
.field-label { margin: 8px 0 -2px; }
input[type="email"], input[type="password"], input[type="text"], input[type="date"], select {
  min-height: var(--field-h);
  padding: 0 14px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  max-width: 100%;
}
.field input { width: 100%; }
input.mono { font-family: var(--mono); font-size: 15px; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.field ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.field ul label { display: flex; gap: 10px; align-items: center; min-height: var(--control-h); }
.field input[type="checkbox"] { width: 20px; height: 20px; accent-color: #ff7426; }
.hint { font-size: 14px; color: var(--ink-3); }
.error { color: var(--bad); font-size: 14px; }
.has-error input { border-color: var(--bad); }
p.error { display: flex; gap: 8px; align-items: flex-start; }
p.error::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  background: currentColor;
  -webkit-mask: var(--icon-alert) center / contain no-repeat;
  mask: var(--icon-alert) center / contain no-repeat;
}
.check-ok { font-size: 14px; color: var(--ink-2); display: flex; gap: 8px; }
.check-ok::before { content: "✓"; color: var(--accent-ink); font-weight: 700; }
:root {
  --icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.6v5M12 16.1h.01'/%3E%3C/svg%3E");
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--r);
  font-size: 15px;
  line-height: 1.45;
  background: var(--bad-soft);
  box-shadow: inset 3px 0 0 var(--bad);
}
.notice svg { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--bad); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notice strong { display: block; font-weight: 600; }
.notice.locked { background: var(--warn-soft); box-shadow: inset 3px 0 0 var(--warn); }
.notice.locked svg { color: var(--warn); }
.alert { padding: 12px 16px; border-radius: var(--r); background: var(--bad-soft); box-shadow: inset 3px 0 0 var(--bad); }

.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form select, .inline-form input { min-height: var(--control-h); font-size: 15px; }
.inline-edit summary { cursor: pointer; font-size: 14px; color: var(--ink-2); min-height: var(--control-h); display: flex; align-items: center; }
.inline-edit > form { margin-bottom: 8px; }

.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row code {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow-wrap: anywhere;
}
.copy-row button { flex: none; }
.secret { font-size: 17px !important; letter-spacing: 0.02em; }
.manual-mark { margin-top: 4px; }
.mark-failed + .manual-mark button { border-color: var(--bad); }

.badge {
  display: inline-block;
  padding: 1px 8px;
  font-size: 12px;
  line-height: 1.6;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge.ok { border-color: transparent; background: var(--accent-soft); color: var(--accent-ink); }
.badge.warn { border-color: transparent; background: var(--bad-soft); color: var(--bad); }

/* Списки и таблицы администрирования ------------------------------------- */

.rows { list-style: none; padding: 0; margin: 0; }
.row-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.row-item:last-child { border-bottom: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.event-name { font-weight: 500; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 24px; margin: 0; }
.facts div { display: grid; gap: 2px; }
.facts dt { font-size: 13px; color: var(--ink-3); }
.facts dd { margin: 0; }
.landing { display: grid; gap: 6px; padding: 16px 0; border-top: 1px solid var(--line-soft); }
.landing:first-of-type { border-top: 0; padding-top: 0; }

.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-2);
  text-align: left;
  background: var(--surface-3);
  border-bottom: 1px solid var(--line);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right !important; font-variant-numeric: tabular-nums lining-nums; }
td.num { font-family: var(--mono); font-size: 14px; }

/* Переключатель события --------------------------------------------------- */

.toggle { gap: 10px; min-width: 150px; justify-content: flex-start; padding: 0 14px; }
.toggle-track {
  position: relative;
  flex: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform var(--dur-fast) var(--ease-out);
}
.toggle[aria-checked="true"] .toggle-track { background: var(--grad-accent); box-shadow: var(--glow-soft); }
.toggle[aria-checked="true"] .toggle-thumb { transform: translateX(16px); }

/* Шаги настройки --------------------------------------------------------- */

.setup { padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.setup-steps { list-style: none; margin: 0; padding: 0; }
.setup-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 20px;
  padding: 20px 24px;
  border-radius: var(--r-md);
}
.setup-step { position: relative; }
.setup-step.is-current { background: var(--accent-soft); }
/* Разделитель между двумя неподсвеченными шагами — с отступами, как в макете. */
.setup-step:not(.is-current) + .setup-step:not(.is-current)::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  border-top: 1px solid var(--line-soft);
}
.step-mark, .step-dot {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: var(--mono);
  color: var(--ink-2);
  border: 1.5px solid var(--line-strong);
}
.step-mark { width: 36px; height: 36px; font-size: 15px; }
.is-current > .step-mark, .is-current > .step-dot { border-color: transparent; background: var(--grad-accent); color: var(--on-accent); font-weight: 600; }
.is-done > .step-mark, .is-done > .step-dot { border-color: var(--ink); background: var(--ink); color: var(--surface); }
.step-text { flex: 1 1 220px; display: grid; gap: 4px; min-width: 0; }
.step-title { font-size: 18px; font-weight: 600; }
.setup-step:not(.is-current):not(.is-done) .step-title { color: var(--ink-2); }
.step-sub { font-size: 15px; color: var(--ink-2); }
.setup-step .copy-row { margin-top: 10px; }
.setup-step .copy-row code { background: var(--surface); }

.empty-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-card);
}
.empty-box svg { fill: none; stroke: var(--ink-3); stroke-width: 1.8; stroke-linejoin: round; }
.empty-box .muted { max-width: 460px; font-size: 15px; }
.empty-title { font-size: 18px; font-weight: 600; }

/* Воронка ---------------------------------------------------------------- */

.funnel-filter { row-gap: 12px; }
.filter-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.landing-pick select { min-height: var(--control-h); font-size: 14px; padding: 0 12px; }
.segmented { display: flex; gap: 4px; margin: 0; padding: 4px; border: 0; background: var(--surface-2); border-radius: var(--r); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.segmented input:checked + span { background: var(--surface); color: var(--ink); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.custom-dates { display: none; flex-basis: 100%; justify-content: flex-end; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.funnel-filter:has(input[value="custom"]:checked) .custom-dates { display: flex; }
.custom-dates label { display: grid; gap: 4px; }
.custom-dates input { min-height: var(--control-h); font-size: 15px; }
.filter-error { flex-basis: 100%; justify-content: flex-end; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.kpi-label, .kpi-sub { font-size: 14px; color: var(--ink-2); }
.kpi-value {
  font-family: var(--mono);
  font-size: clamp(24px, 20px + 0.8vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums lining-nums;
  overflow-wrap: anywhere;
}
.kpi-value.is-stacked { font-size: clamp(20px, 18px + 0.5vw, 24px); }
.kpi-sub + .kpi-value { margin-top: 6px; }

.funnel-table { width: 100%; min-width: 960px; border-collapse: collapse; font-size: 15px; }
.funnel-table thead th {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 400;
  color: var(--ink-2);
  text-align: left;
  white-space: nowrap;
  background: var(--surface-3);
  border-bottom: 1px solid var(--line);
}
.funnel-table thead th:first-child { padding-left: 24px; width: 30%; }
.funnel-table thead th:last-child, .funnel-table td:last-child { padding-right: 24px; }
.funnel-table tbody tr {
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.funnel-table tbody tr:last-child { border-bottom: 0; }
.funnel-table tbody tr:hover { background: var(--surface-3); }
.funnel-table tbody tr.is-selected { background: var(--accent-soft); }
.funnel-table tbody th { padding: 0; text-align: left; font-weight: 400; }
.funnel-table td { padding: 14px 16px; vertical-align: middle; }
.funnel-table tr.level-0 th { font-weight: 600; }
.row-pick {
  justify-content: flex-start;
  width: 100%;
  min-height: 52px;
  padding: 0 12px 0 24px;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 15px;
  font-weight: inherit;
  text-align: left;
  white-space: normal;
}
.row-pick:hover { border: 0; }
.row-pick:active { transform: none; }
.row-pick:focus-visible { outline-offset: -2px; }
.level-1 .row-pick { padding-left: 52px; }
.level-2 .row-pick { padding-left: 80px; }
.is-unmarked .row-pick { font-style: italic; }
.chevron {
  display: inline-block;
  flex: none;
  width: 14px;
  color: var(--ink-2);
  transition: transform var(--dur-fast) var(--ease-out);
}
.chevron.is-leaf { visibility: hidden; }
.row-pick[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.row-name { min-width: 0; overflow-wrap: anywhere; }
td.strong { font-weight: 600; }
td.accent { color: var(--accent-ink); font-weight: 600; }
.line { display: block; white-space: nowrap; }
.table-note { padding: 14px 24px; border-top: 1px solid var(--line-soft); font-size: 14px; }

.journey { padding: 24px; display: grid; gap: 16px; }
.journey-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}
.bar-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bar-count { font-family: var(--mono); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-track { display: flex; align-items: flex-end; height: 110px; }
.bar {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 4px;
  border-radius: 8px 8px 4px 4px;
  background: var(--line-strong);
  transform-origin: bottom;
  transform: scaleY(max(var(--share, 0), 0.04));
  transition: transform var(--dur-base) var(--ease-emphasized);
}
.is-goal .bar { background: var(--grad-accent-down); box-shadow: var(--glow-soft); }
.bar-label { min-height: 34px; font-size: 13px; line-height: 1.3; color: var(--ink-2); }
.bar-conv { min-height: 18px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

/* Мастер подключения ----------------------------------------------------- */

.wizard { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 40px; align-items: start; }
.wizard-aside { display: flex; flex-direction: column; gap: 6px; }
.back-link { display: inline-flex; align-items: center; min-height: var(--control-h); margin-bottom: 6px; font-size: 14px; text-decoration: none; }
.wizard-aside .eyebrow { margin-bottom: 6px; }
.wizard-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.wizard-step {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--control-h);
  padding: 8px 12px;
  border-radius: var(--r);
  font-size: 15px;
  color: var(--ink-2);
  text-decoration: none;
}
a.wizard-step:hover { color: var(--ink); background: var(--surface-3); }
.wizard-step.is-done { color: var(--ink); }
.wizard-step.is-current { background: var(--surface); color: var(--ink); font-weight: 600; }
.step-dot { width: 26px; height: 26px; font-size: 12px; }
.wizard-body { padding: 36px; display: flex; flex-direction: column; gap: 24px; min-height: 560px; }
.wizard-head { display: grid; gap: 6px; }
.step-kicker { font-family: var(--mono); font-size: 13px; color: var(--accent-ink); text-transform: uppercase; }
.wizard-title { margin: 0; font-size: clamp(24px, 21px + 0.8vw, 28px); font-weight: 700; line-height: 1.15; }
.wizard-form { max-width: 640px; gap: 20px; }
.wizard-form .actions { margin-top: 4px; }

/* Инструкция выпуска ключа: аккордеон, открыт один шаг. Плавное раскрытие —
   где браузер умеет анимировать ::details-content; иначе шаг открывается сразу. */
.guide { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 760px; interpolate-size: allow-keywords; }
.guide-step {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.guide-step[open] { border-color: var(--line-strong); background: var(--surface-3); }
.guide-step summary {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  line-height: 1.3;
}
.guide-step summary::-webkit-details-marker { display: none; }
.guide-step summary:hover .guide-title { color: var(--ink); }
.guide-step summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.guide-title { flex: 1; min-width: 0; color: var(--ink-2); transition: color var(--dur-fast) var(--ease-out); }
.guide-step[open] .guide-title { color: var(--ink); font-weight: 600; }
.guide-step[open] .step-dot { border-color: transparent; background: var(--grad-accent); box-shadow: var(--glow-soft); color: var(--on-accent); font-weight: 600; }
.guide-chevron { flex: none; fill: none; stroke: var(--ink-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--dur-base) var(--ease-emphasized); }
.guide-step[open] .guide-chevron { transform: rotate(180deg); }
.guide-step::details-content {
  block-size: 0;
  overflow: hidden;
  transition: block-size var(--dur-base) var(--ease-emphasized), content-visibility var(--dur-base) allow-discrete;
}
.guide-step[open]::details-content { block-size: auto; }
.guide-body { display: grid; gap: 12px; padding: 0 16px 16px 56px; line-height: 1.5; }
.guide-body p { margin: 0; }
.guide-body .muted { font-size: 14px; }
.guide code { font-family: var(--mono); font-size: 13px; }
.guide-shots { display: grid; gap: 12px; }
.guide-shot {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  cursor: zoom-in;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.guide-shot:hover { border-color: var(--line-strong); box-shadow: 0 4px 14px rgb(0 0 0 / 0.08); }
.guide-shot img { display: block; width: 100%; height: auto; }

.lightbox {
  max-width: min(1200px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: auto;
}
.lightbox::backdrop { background: rgb(0 0 0 / 0.72); }
.lightbox[open] { animation: lightbox-in var(--dur-base) var(--ease-emphasized); }
.lightbox form { position: sticky; top: 0; height: 0; display: flex; justify-content: flex-end; }
.lightbox-close {
  margin: 8px;
  width: var(--control-h);
  height: var(--control-h);
  padding: 0;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  background: var(--surface);
}
.lightbox-img { display: block; max-width: 100%; height: auto; }
@keyframes lightbox-in { from { opacity: 0; transform: scale(0.97); } }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 640px; }
.check { display: flex; gap: 14px; align-items: center; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--r-md); }
.check svg { flex: none; fill: none; stroke: var(--ink); stroke-width: 2; }
.check > div { display: grid; gap: 2px; }
.check-title { font-weight: 600; }
.check-sub { font-size: 14px; color: var(--ink-2); }
.params-box { display: grid; gap: 10px; max-width: 640px; padding: 20px; border-radius: var(--r-md); background: var(--bg); }
.params-title { font-weight: 600; }

/* Вход ------------------------------------------------------------------- */

.entry {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--bg);
}
.entry-main { display: flex; justify-content: center; align-items: center; padding: 64px; }
.entry-body { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 28px; }
.entry-head { display: grid; gap: 8px; }
.entry h1 { margin: 0; font-size: clamp(30px, 26px + 1vw, 36px); line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.entry .brand { font-size: 17px; }
.entry .brand-mark { height: 28px; }
.entry .form { gap: 16px; }
.entry button.primary { margin-top: 8px; }
.entry-note { font-size: 14px; color: var(--ink-2); }
.entry-aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  margin: 24px;
  padding: 64px;
  border-radius: 20px;
  background: var(--panel);
  color: var(--on-panel);
}
.entry-aside .eyebrow { color: var(--on-panel-2); letter-spacing: 0.08em; }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.points li { display: flex; gap: 16px; align-items: baseline; }
.points .n { flex: none; font-family: var(--mono); font-size: 14px; color: var(--panel-accent); }
.points strong { display: block; margin-bottom: 4px; font-size: 20px; font-weight: 600; line-height: 1.3; }
.points li > span:last-child { font-size: 15px; color: var(--on-panel-2); }

/* Появление каскадом: блоки входа поднимаются по очереди, один раз. */
.reveal > * { animation: rise 400ms var(--ease-out) both; }
.reveal > :nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
.reveal > :nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
.reveal > :nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
.reveal > :nth-child(n + 5) { animation-delay: calc(var(--stagger) * 4); }
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* Узкие экраны ----------------------------------------------------------- */

@media (max-width: 1024px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wizard { grid-template-columns: 1fr; gap: 16px; }
  .wizard-steps { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); overflow-x: auto; }
}
@media (max-width: 860px) {
  .top { padding: 8px 16px; gap: 4px 12px; }
  .top-main { gap: 4px 16px; }
  .page { padding: 24px 16px 64px; gap: 20px; }
  .split { grid-template-columns: 1fr; }
  .section { padding: 20px; }
  .setup-step { padding: 16px; }
  .wizard-body { padding: 24px 20px; min-height: 0; }
  .journey { padding: 20px 16px; }
  .bars { gap: 4px; }
  .bar-label { font-size: 11px; overflow-wrap: anywhere; }
  .bar-count { font-size: 13px; }
  .entry { grid-template-columns: 1fr; min-height: 0; }
  .entry-main { padding: 32px 16px; }
  .entry-aside { margin: 0 16px 24px; padding: 32px 24px; }
  .points strong { font-size: 17px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .copy-row { flex-direction: column; }
  .wizard-step span:last-child { font-size: 13px; }
  .guide-step summary { gap: 12px; padding: 12px; }
  .guide-body { padding: 0 12px 14px; }
  .bar-conv { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  button:active, .button:active { transform: none; }
}
