:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ef;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: #cde2fb;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0ca30c;
  --good-ink: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-ink: #b42f2f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-wash: #184f95;
    --series-1: #3987e5;
    --series-2: #d95926;
    --good-ink: #0ca30c;
    --critical-ink: #e66767;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-wash: #184f95;
  --series-1: #3987e5;
  --series-2: #d95926;
  --good-ink: #0ca30c;
  --critical-ink: #e66767;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
code, pre { font-family: var(--mono); font-size: 13px; }

/* ---------- каркас ---------- */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 18px;
  font-size: 18px; font-weight: 700; color: var(--ink); text-decoration: none;
}
.brand svg { width: 26px; height: 26px; }
.nav-link {
  padding: 8px 12px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--accent-wash); color: var(--ink); }
.sidebar-foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); }

.main { min-width: 0; padding: 20px 28px 48px; }
.view { max-width: 1280px; }
.view.loading { opacity: 0.55; transition: opacity 0.15s; }

/* ---------- фильтры ---------- */
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 20px; max-width: 1280px;
}
.seg {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
}
.seg button {
  border: 0; background: transparent; padding: 5px 10px; border-radius: 6px; cursor: pointer;
  color: var(--ink-2); white-space: nowrap;
}
.seg button:hover { background: var(--surface-2); }
.seg button[aria-checked="true"] { background: var(--accent); color: #fff; }
.filters select, .filters input, .input, textarea.input {
  height: 34px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.filters input[type="search"] { width: 180px; }
.custom-range { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- карточки, плитки ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: 2fr 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; min-width: 0;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head .hint { font-size: 12px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { padding: 14px 16px; }
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font-size: 26px; font-weight: 620; margin-top: 2px; }
.tile .sub { font-size: 12px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  font-weight: 550; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--critical-ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--muted);
  padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap;
}
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--surface-2); }
.trunc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.badge.good .dot { background: var(--good); }
.badge.warning .dot { background: var(--warning); }
.badge.serious .dot { background: var(--serious); }
.badge.critical .dot { background: var(--critical); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }

.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }
.empty h2 { margin-bottom: 6px; }
.notice {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--warning);
}
.notice.error { border-left-color: var(--critical); }

/* ---------- графики ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--series-1); }
.chart .bar-hit { fill: transparent; cursor: default; }
.chart .bar-hit:hover + .bar, .chart .bar-hit:focus + .bar { opacity: 0.8; }
.chart .bar-hit:focus { outline: none; }

.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 12px; }
.funnel-label { color: var(--ink-2); }
.funnel-track { grid-column: 1 / -1; height: 14px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.funnel-fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.funnel-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.funnel-drop { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  padding: 8px 10px; border-radius: 8px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}
.tooltip strong { display: block; font-size: 14px; }
.tooltip .key { display: inline-block; width: 12px; height: 2px; margin-right: 6px; vertical-align: middle; background: var(--series-1); }

details.table-view { margin-top: 10px; }
details.table-view summary { cursor: pointer; color: var(--muted); font-size: 12px; }

/* ---------- плеер ---------- */
.session-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.player-card { padding: 12px; }
#player { min-height: 420px; display: flex; justify-content: center; }
#player .rr-player { box-shadow: none; background: var(--surface-2); border-radius: 8px; }
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; }
.timeline { max-height: 70vh; overflow-y: auto; margin: 0 -8px; padding: 0; list-style: none; }
.timeline li {
  display: grid; grid-template-columns: 48px 1fr; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.timeline li:hover { background: var(--surface-2); }
.timeline li.current { background: var(--accent-wash); }
.timeline li.page { font-weight: 600; margin-top: 6px; }
.timeline li.problem .what { color: var(--critical-ink); }
.timeline li.goal .what { color: var(--good-ink); font-weight: 550; }
.timeline .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline .detail { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* ---------- ИИ ---------- */
.ai-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
textarea.input { width: 100%; height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.chip {
  padding: 4px 10px; border-radius: 999px; cursor: pointer; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2);
}
.chip:hover { color: var(--ink); border-color: var(--accent); }
.ai-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.scope { font-size: 13px; color: var(--ink-2); }
.progress { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 8px 0; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--grid); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.thinking { margin: 4px 0 14px; font-size: 13px; }
.thinking summary { cursor: pointer; color: var(--muted); }
.thinking-text {
  max-height: 180px; overflow-y: auto; white-space: pre-wrap; margin-top: 6px;
  padding: 10px 12px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2);
}
.turn + .turn, .followup-turn { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--grid); }
.turn-q { font-weight: 600; margin-bottom: 8px; color: var(--ink-2); }
.turn-q::before { content: "Вопрос: "; color: var(--muted); font-weight: 500; }
.report { line-height: 1.6; overflow-wrap: anywhere; }
.report h1, .report h2, .report h3 { margin: 22px 0 8px; }
.report h2 { font-size: 17px; }
.report h3 { font-size: 15px; }
.report > :first-child { margin-top: 0; }
.report ul, .report ol { padding-left: 22px; }
.report li { margin: 3px 0; }
.report .table-scroll { overflow-x: auto; margin: 12px 0; }
.report table { border-collapse: collapse; width: 100%; font-size: 13px; }
.report th, .report td { border: 1px solid var(--grid); padding: 6px 8px; text-align: left; vertical-align: top; min-width: 96px; overflow-wrap: normal; }
.report th { background: var(--surface-2); font-weight: 600; }
.report code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.report blockquote { margin: 8px 0; padding: 4px 12px; border-left: 3px solid var(--grid); color: var(--ink-2); }
a.srefs {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 0 6px; margin: 0 1px; border-radius: 5px; font-size: 12px; font-family: var(--mono);
  background: var(--accent-wash); color: var(--ink); text-decoration: none; white-space: nowrap;
}
a.srefs:hover { outline: 1px solid var(--accent); }
.followup { display: flex; gap: 8px; margin-top: 20px; }
.followup input { flex: 1; height: 38px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.report-meta { font-size: 12px; color: var(--muted); margin-top: 14px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li a {
  display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink);
}
.history li a:hover { background: var(--surface-2); }
.history li a.active { background: var(--accent-wash); }
.history .q { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; }
.history .when { font-size: 12px; color: var(--muted); }

/* ---------- установка ---------- */
.code {
  position: relative; padding: 12px 14px; border-radius: 8px; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--border); white-space: pre; margin: 8px 0 14px; padding-right: 120px;
}
.copy-btn { position: absolute; top: 8px; right: 8px; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 10px; }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .session-layout, .ai-layout, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 6px 10px 6px 0; }
  .sidebar-foot { display: none; }
  .main { padding: 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .filters input[type="search"] { width: 100%; }
}

/* ================= v2: проекты, настройки, тепловые карты ================= */

.small { font-size: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .input, .toolbar select { height: 34px; padding: 0 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.notice.soft { border-left-color: var(--accent); }
.filters.period-only .full-only { display: none; }

/* переключатель проектов */
.switcher { position: relative; margin: 0 0 12px; }
.switcher-btn {
  width: 100%; display: grid; grid-template-columns: 1fr auto; text-align: left; gap: 0 6px;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
}
.switcher-btn:hover { border-color: var(--accent); }
.switcher-label { grid-column: 1; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.switcher-name { grid-column: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher-caret { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--muted); }
.switcher-menu {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; min-width: 220px;
  padding: 6px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); max-height: 60vh; overflow-y: auto;
}
.switcher-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--ink); text-decoration: none; }
.switcher-item:hover { background: var(--surface-2); }
.switcher-item.active { background: var(--accent-wash); }
.switcher-item.accent { color: var(--accent-ink); font-weight: 600; }
.switcher-sep { height: 1px; background: var(--grid); margin: 6px 4px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-sep { height: 1px; background: var(--grid); margin: 8px 10px; }
.sidebar-foot { display: flex; flex-direction: column; gap: 6px; padding: 10px 0 0; }
.sidebar-foot .muted { padding: 0 12px; }

/* плитки с изменением к прошлому периоду */
.value-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.delta { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--critical-ink); }

/* проекты */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card { display: flex; flex-direction: column; gap: 6px; }
.project-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.project-name { font-size: 17px; font-weight: 650; color: var(--ink); text-decoration: none; }
.project-name:hover { color: var(--accent-ink); }
.project-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0 2px; }
.project-stats .value { font-size: 22px; font-weight: 620; }
.project-stats .label { font-size: 12px; color: var(--muted); }
.add-card {
  align-items: center; justify-content: center; min-height: 180px; text-decoration: none; color: var(--ink-2);
  border-style: dashed; box-shadow: none; background: transparent;
}
.add-card:hover { color: var(--accent-ink); border-color: var(--accent); }
.add-card .plus { font-size: 32px; line-height: 1; }

/* формы */
.form-card { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 550; }
.field small, .check small { color: var(--muted); font-size: 12px; display: block; }
.field .input, .field select, .field textarea { width: 100%; height: 38px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.field textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:focus, .switcher-btn:focus-visible, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.narrow-input { max-width: 120px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.choice {
  display: grid; gap: 4px; text-align: left; padding: 12px 14px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
}
.choice span { font-size: 12px; color: var(--ink-2); }
.choice:hover { border-color: var(--accent); }
.choice[aria-checked="true"] { border: 2px solid var(--accent); padding: 11px 13px; background: var(--accent-wash); }
.save-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 12px; align-items: center;
  padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}
.danger-zone { border-color: color-mix(in srgb, var(--critical) 35%, var(--border)); }

/* редактор воронки */
.funnel-editor { display: grid; gap: 8px; }
.funnel-step { display: grid; grid-template-columns: 28px minmax(120px, 1fr) minmax(150px, 0.9fr) minmax(140px, 1fr) auto; gap: 8px; align-items: center; }
.funnel-step .input { height: 36px; padding: 0 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; width: 100%; }
.step-num { text-align: center; font-weight: 650; color: var(--muted); }
.step-actions { display: flex; gap: 2px; }
.icon-btn { width: 30px; height: 30px; border-radius: 7px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }

/* вкладки и статус установки */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--grid); margin-top: 6px; }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.install-status { display: grid; gap: 12px; }
.status-line { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); }
.status-line p { margin: 4px 0 8px; color: var(--ink-2); }
.status-line .spinner { margin-top: 3px; }
.status-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--muted); }
.status-line.ok .status-icon { background: var(--good); }
.status-line.warn .status-icon { background: var(--serious); }

/* список сессий */
.sessions-table td:first-child { width: 14px; padding-right: 0; }
.unseen-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; }
tr.unseen td:nth-child(2) { font-weight: 600; }
.trunc.narrow { max-width: 150px; }
.star { border: 0; background: none; cursor: pointer; font-size: 17px; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.star:hover { background: var(--surface-2); }
.star.on { color: #eda100; }
.more-row { display: flex; justify-content: center; padding: 10px; }

/* тепловые карты */
.hm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.hm-card { padding: 12px; }
.hm-stage { position: relative; min-height: 300px; overflow: hidden; border-radius: 8px; background: var(--surface-2); }
.hm-frame { position: absolute; top: 0; left: 0; pointer-events: none; }
.hm-frame .replayer-wrapper { position: relative; left: 0; top: 0; float: none; }
.hm-frame .replayer-mouse, .hm-frame .replayer-mouse-tail { display: none !important; }
.hm-frame iframe { border: 0; background: #fff; display: block; }
.hm-canvas { position: absolute; top: 0; pointer-events: none; }
.hm-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.hm-legend { margin-top: 14px; }
.hm-scale { height: 10px; border-radius: 5px; }
.hm-scale-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.page-select { max-width: 420px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  padding: 10px 18px; border-radius: 10px; background: var(--ink); color: var(--page); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.toast.error { background: var(--critical); color: #fff; }

@media (max-width: 1100px) {
  .hm-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .choice-grid { grid-template-columns: 1fr; }
  .funnel-step { grid-template-columns: 24px 1fr; }
  .funnel-step > :nth-child(n + 3) { grid-column: 2; }
  .switcher { width: 100%; order: 2; }
  .nav-group { flex-direction: row; flex-wrap: wrap; order: 3; }
  .nav-sep { display: none; }
  .sidebar-foot { display: none; }
}
.hm-layout aside .trunc { max-width: 190px; }
.hm-layout aside table.data td, .hm-layout aside table.data th { padding: 7px 6px; }
.nowrap { white-space: nowrap; }
#f-segment { max-width: 280px; }
.sessions-table td { padding: 8px 8px; }

/* ================= v3: вход, аккаунт ================= */

body.auth-mode .layout { display: none; }
#auth-root { min-height: 100vh; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.auth-card h1 { margin: 18px 0 14px; }
.auth-brand { display: flex; gap: 12px; align-items: center; }
.auth-brand strong { font-size: 20px; }
.auth-logo {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at center, #0d366b 0 18%, #fff 19% 42%, var(--accent) 43%);
}
.auth-form { display: grid; gap: 14px; }
.auth-switch { margin: 16px 0 0; color: var(--ink-2); }
.btn.wide { width: 100%; height: 40px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }

.user-box { display: flex; align-items: center; gap: 4px; padding: 4px 0; }
.user-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.user-link:hover { background: var(--surface-2); }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; color: #fff; background: var(--accent); }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.inline-form { display: flex; gap: 8px; max-width: 460px; }
.inline-form .input { flex: 1; height: 36px; padding: 0 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }

.dev-details { margin-top: 14px; border-top: 1px solid var(--grid); padding-top: 12px; }
.dev-details summary { cursor: pointer; color: var(--ink-2); }
.auto-status { margin-top: 4px; }
