/* Оформление RevFlow: тёмная и светлая темы, светло-зелёный акцент.
   Одна страница аналитики, панели-разрезы и переключатель тем. */

:root, [data-theme="light"] {
  --bg: #f4f7f5;         --bg-soft: #ffffff;
  --surface: #ffffff;    --surface2: #eef2ef;
  --border: #dde4df;     --border-soft: #e9eeea;
  --text: #10161b;       --muted: #55636e;    --dim: #7b8792;
  --accent: #4ade80;     --accent-strong: #16a34a; --accent-ink: #062b16;
  --accent-soft: rgba(74,222,128,.18);
  --up: #16a34a;         --down: #dc2626;     --warn: #b45309;
  --topbar: rgba(244,247,245,.82);
  --shadow: 0 18px 40px rgba(16,22,27,.10);
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --font-mono: Consolas, "JetBrains Mono", ui-monospace, Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #131619;         --bg-soft: #171b1f;
  --surface: #1a1e23;    --surface2: #232830;
  --border: #2e343c;     --border-soft: #262b32;
  --text: #e8ecf0;       --muted: #9aa5b1;    --dim: #727d89;
  --accent: #86efac;     --accent-strong: #4ade80; --accent-ink: #062b16;
  --accent-soft: rgba(134,239,172,.13);
  --up: #4ade80;         --down: #ff7b7b;     --warn: #e6b566;
  --topbar: rgba(19,22,25,.82);
  --shadow: 0 16px 36px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: clip; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding-left: 18px; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--font-mono); font-size: .9em; }
.dim { color: var(--dim); } .muted { color: var(--muted); }
.note { font-size: 12.5px; color: var(--dim); line-height: 1.55; }
.muted-lg { color: var(--muted); font-size: 14px; }
.right { text-align: right; }
.inline { display: inline; }

.ico { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: middle; display: inline-block; }

.topbar { position: sticky; top: 0; z-index: 40;
  background: var(--topbar); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 16px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap; }
.wordmark { font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.dot { color: var(--accent-strong); }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border-radius: 999px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
  transition: color .12s ease, border-color .12s ease; }
.theme-toggle:hover { color: var(--accent-strong); border-color: var(--accent-strong); }
.theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: inline-block; }

::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
.theme-anim, .theme-anim * {
  transition: background-color .4s ease, color .4s ease, border-color .4s ease,
    fill .4s ease, stroke .4s ease;
}

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 32px 24px;
  display: flex; flex-direction: column; gap: 24px; animation: page-in .28s ease; }
.wrap.is-leaving { opacity: 0; transform: translateY(6px);
  transition: opacity .17s ease, transform .17s ease; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.wrap-narrow { max-width: 460px; }
.wrap-wide { max-width: 1120px; }
.stack-lg { gap: 28px; }

.card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px; }
.card-flat { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; }
.card-hover { border-width: 0;
  box-shadow: inset 0 0 0 1px var(--border), 0 18px 40px rgba(0,0,0,0);
  will-change: transform; backface-visibility: hidden;
  transition: transform .15s ease, box-shadow .15s ease; }
.card-hover:hover { transform: translateY(-2px) scale(1.02);
  box-shadow: inset 0 0 0 1px var(--accent-strong), var(--shadow); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; }
.page-title { font-size: clamp(22px, 3vw, 30px); font-weight: 650;
  letter-spacing: -.02em; margin: 0; }
.page-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--dim); }
.kpi-value { font-size: 28px; font-weight: 650; line-height: 1.12; letter-spacing: -.6px; }
.kpi-hint { font-size: 12.5px; color: var(--muted); }
.up { color: var(--up); } .down { color: var(--down); }

.tip { position: relative; cursor: help; border-bottom: 1px dotted var(--dim); }
.tip::after { content: attr(data-tip); position: absolute; left: 0; bottom: calc(100% + 8px);
  width: max-content; max-width: 230px; z-index: 60; pointer-events: none;
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 8px 10px; box-shadow: var(--shadow);
  font-size: 12px; font-weight: 400; line-height: 1.45; text-transform: none;
  letter-spacing: normal; white-space: normal;
  opacity: 0; visibility: hidden; transition: opacity .12s ease; }
.tip:hover::after, .tip:focus-visible::after { opacity: 1; visibility: visible; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 980px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid-2, .kpi-grid { grid-template-columns: 1fr; }
}
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

.btn { font-size: 14px; padding: 8px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface2); color: var(--text);
  cursor: pointer; transition: border-color .12s ease, background .12s ease, color .12s ease; }
.btn:hover { border-color: var(--accent-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent);
  color: var(--accent-ink); font-weight: 650; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-quiet { background: transparent; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge-accent { border-color: var(--accent-strong); color: var(--accent-strong); background: var(--accent-soft); }
.bar { display: block; height: 6px; border-radius: 999px; background: var(--accent-strong); }
.funnel-list > * { transition: opacity .15s ease; }
.funnel-list:hover > * { opacity: .5; }
.funnel-list:hover > *:hover { opacity: 1; }

.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); }
.segment { padding: 5px 12px; border-radius: 999px; font-size: 13px; color: var(--muted);
  border: 0; background: transparent; font-family: inherit; cursor: pointer;
  transition: background .12s ease, color .12s ease; }
.segment:hover { color: var(--text); }
.segment[data-active="true"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; }
.segmented-sm { padding: 2px; }
.segmented-sm .segment { padding: 4px 10px; font-size: 12px; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 12px; height: 4px; border-radius: 999px; background: var(--accent-strong); }
.legend-pageviews { background: var(--muted); }

.panel-title { display: flex; align-items: center; gap: 8px; margin: 0;
  font-size: 13px; font-weight: 650; letter-spacing: .2px; }
.panel-title .ico { color: var(--accent-strong); }

.chip { display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; background: var(--surface2);
  border: 1px solid var(--border-soft); color: var(--muted); }
.chip .ico { width: 16px; height: 16px; }
.flag { font-size: 15px; line-height: 1; }

.bd-list { display: flex; flex-direction: column; gap: 2px; }
.bd-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px; align-items: center; padding: 6px 0;
  transition: opacity .15s ease; }
.bd-list:hover .bd-row { opacity: .45; }
.bd-list:hover .bd-row:hover { opacity: 1; }
.bd-main { min-width: 0; }
.bd-top { display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; font-size: 13px; }
.bd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-track { display: block; height: 5px; margin-top: 6px; border-radius: 999px;
  background: var(--surface2); overflow: hidden; }
.bd-fill { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong)); }
.bd-share { color: var(--dim); font-size: 12px; min-width: 34px; text-align: right; }
.bd-meta { font-size: 11.5px; color: var(--dim); margin-top: 4px; }

.geo-panels { height: 320px; overflow-y: auto;
  scrollbar-width: none; }
.geo-panels::-webkit-scrollbar { display: none; }
.geo-panels > [data-panel] { min-height: 0; }
.geo-panels > [data-panel="map"] { height: 100%; }
@media (max-width: 820px) { .geo-panels { height: auto; } }
.map-wrap { position: relative; width: 100%; height: 100%; min-height: 220px;
  border-radius: var(--r-md); overflow: hidden; background: var(--bg);
  border: 1px solid var(--border-soft); }
.map-wrap .map-svg { display: block; width: 100%; height: 100%; }
.map-country { transition: filter .15s ease, stroke .15s ease; }
.map-country:hover { filter: brightness(1.08); }
.map-tip { position: absolute; z-index: 5; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 7px 10px; box-shadow: var(--shadow); animation: map-tip-in .14s ease; }
.map-tip[hidden] { display: none; }
.map-tip-title { font-size: 12.5px; font-weight: 600; }
.map-tip-value { font-size: 12px; color: var(--muted); margin-top: 2px; }
@keyframes map-tip-in {
  from { opacity: 0; transform: translateY(4px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.panel-in { animation: rv-in .22s ease; }
@keyframes rv-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.alert { border-radius: var(--r-md); padding: 12px 16px; font-size: 13.5px; margin: 0; }
.alert-ok { border: 1px solid var(--accent-strong); background: var(--accent-soft); color: var(--accent-strong); }
.alert-warn { border: 1px solid var(--warn); color: var(--warn); }
.alert-error { border: 1px solid var(--down); background: rgba(255,107,107,.08); color: var(--down); }

input:not([type=hidden]) { font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 9px 11px; width: 100%; }
input::placeholder { color: var(--dim); }
input:focus { outline: none; border-color: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: flex; flex-direction: column; gap: 6px; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--dim); padding: 9px 12px;
  border-bottom: 1px solid var(--border); background: var(--surface2); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
.table th.right, .table td.right { text-align: right; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: opacity .15s ease; }
.table tbody:hover tr { opacity: .5; }
.table tbody tr:hover { opacity: 1; }
.table tbody tr:hover td { background: var(--surface2); }

.code-block { display: block; max-width: 100%; font-family: var(--font-mono);
  font-size: 12.5px; line-height: 1.6; color: var(--accent-strong); background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 10px;
  overflow-wrap: anywhere; }

.chart-frame { position: relative; width: 100%; max-width: 100%; overflow: visible; }
.chart-frame svg { display: block; width: 100%; height: auto; }
.chart-grid { stroke: var(--border-soft); stroke-width: 1; }
.chart-axis { fill: var(--dim); font-size: 11px; }
.chart-line { fill: none; stroke-width: 2; transition: opacity .15s ease; }
.chart-line-accent { stroke: var(--accent-strong); }
.chart-line-pageviews { stroke: var(--muted); stroke-width: 1.5; }
.chart-line-previous { stroke: var(--dim); stroke-width: 1.5; }
.chart-area-start, .chart-area-end { stop-color: var(--accent); }
.chart-dot { fill: var(--accent-strong); opacity: .6;
  transition: opacity .15s ease, r .12s ease; }
.chart-frame.is-active .chart-dot { opacity: .3; }
.chart-frame.is-active .chart-dot.is-focus { opacity: 1; }
.chart-frame.is-active .chart-line-accent { opacity: .6; }
.chart-frame.is-active .chart-line-pageviews { opacity: .3; }
.chart-overlay { fill: transparent; cursor: crosshair; }
.chart-guide { stroke: var(--accent-strong); stroke-width: 1;
  stroke-dasharray: 3 3; opacity: .55; }
.chart-guide[hidden] { display: none; }
.chart-tip { position: absolute; top: 0; left: 0; z-index: 5; pointer-events: none;
  white-space: nowrap; transform: translate(-50%, -115%);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow);
  animation: chart-tip-in .14s ease; }
.chart-tip[hidden] { display: none; }
.chart-tip-row { display: flex; gap: 14px; justify-content: space-between; }
@keyframes chart-tip-in {
  from { opacity: 0; transform: translate(-50%, -100%); }
  to { opacity: 1; transform: translate(-50%, -115%); }
}

@keyframes rv-pulse { 0% { transform: scale(1); opacity: .45; }
  70% { transform: scale(2.2); opacity: 0; } 100% { transform: scale(2.2); opacity: 0; } }
.live { display: inline-flex; align-items: baseline; gap: 8px; }
.live-dot { position: relative; display: inline-flex; width: 8px; height: 8px; }
.live-dot span:first-child { position: absolute; inset: 0; border-radius: 999px;
  background: var(--accent-strong); opacity: .35; animation: rv-pulse 1.8s ease-out infinite; }
.live-dot span:last-child { position: relative; width: 8px; height: 8px; border-radius: 999px;
  background: var(--accent-strong); }
.live-value { font-weight: 650; color: var(--accent-strong); }

.hero { position: relative; display: flex; flex-direction: column; align-items: flex-start;
  text-align: left; gap: 20px; padding: 44px 0 24px; }
.hero::before { content: ""; position: absolute; left: 0; top: -28px;
  width: min(760px, 100%); height: 340px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 72%); }
.hero-title { font-size: clamp(26px, 4vw, 42px); font-weight: 650;
  letter-spacing: -.02em; line-height: 1.12; margin: 0; }
.hero-title-xl { font-size: clamp(32px, 5.5vw, 58px); max-width: 22ch; }
.hero-title-sm { font-size: 26px; }
.hero-sub { font-size: 15px; color: var(--muted); max-width: 58ch; line-height: 1.6; margin: 0; }
.hero .hero-sub { font-size: 16px; max-width: 62ch; }
.step-card { background: var(--surface);
  border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: inset 0 0 0 1px var(--border), 0 18px 40px rgba(0,0,0,0);
  will-change: transform; backface-visibility: hidden;
  transition: transform .15s ease, box-shadow .15s ease; }
.step-card:hover { transform: translateY(-2px) scale(1.02);
  box-shadow: inset 0 0 0 1px var(--accent-strong), var(--shadow); }
.step-num { display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 999px; border: 1px solid var(--accent-strong);
  color: var(--accent-strong); font-size: 13px; font-family: var(--font-mono); }
.faq-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq-item summary { cursor: pointer; font-size: 14px; }
.faq-item p { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.legal-doc { color: var(--muted); font-size: 14px; line-height: 1.65; display: flex;
  flex-direction: column; gap: 12px; }
.legal-doc h2 { font-size: 15px; color: var(--text); margin: 0; }
.legal-doc a { color: var(--accent-strong); }
.link-quiet { color: var(--accent-strong); }

@media (prefers-reduced-motion: reduce) {
  .live-dot span:first-child { animation: none; }
  .wrap { animation: none; }
  .wrap.is-leaving { transition: none; }
  .step-card, .card-hover { transition: none; }
  .step-card:hover, .card-hover:hover { transform: none; }
}
