:root {
  --bg: #07070a; --panel: #0e0e13; --panel-2: #13131a; --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.12);
  --ink: #f3f2f7; --ink-2: #b7b5c3; --ink-3: #7d7a8c; --accent: #a78bfa; --accent-2: #f472b6; --good: #34d399; --warn: #fbbf24; --bad: #fb7185;
  --grad: linear-gradient(110deg, #f472b6, #a78bfa 55%, #60a5fa);
  --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; background: radial-gradient(900px 500px at 15% -10%, rgba(167,139,250,.10), transparent 60%), radial-gradient(700px 400px at 100% 0%, rgba(244,114,182,.07), transparent 60%), var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.brand svg { width: 28px; height: 28px; }
.brand small { color: var(--ink-3); font-weight: 500; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(380px, 100%); padding: 32px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.login h1 { margin: 22px 0 6px; font-size: 22px; letter-spacing: -.02em; }
.login p { margin: 0 0 22px; color: var(--ink-3); }
.field { width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); outline: none; transition: border-color .2s; }
.field:focus { border-color: rgba(167,139,250,.6); }
.btn { height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: background .2s, border-color .2s; white-space: nowrap; }
.btn:hover { background: #1a1a23; border-color: rgba(255,255,255,.2); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 10px 30px -12px rgba(167,139,250,.7); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(255,255,255,.05); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn svg { width: 16px; height: 16px; }
.err { color: var(--bad); font-size: 13px; min-height: 20px; margin-top: 10px; }

header.top { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); background: rgba(7,7,10,.72); border-bottom: 1px solid var(--line); }
header.top .in { max-width: 1320px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 14px; }
main { max-width: 1320px; margin: 0 auto; padding: 26px 24px 80px; }
.select { position: relative; }
.select > button { height: 40px; min-width: 230px; justify-content: space-between; }
.menu { position: absolute; top: 46px; left: 0; min-width: 300px; padding: 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 24px 60px -20px rgba(0,0,0,.9); z-index: 30; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 9px; text-align: left; }
.menu button:hover, .menu button.on { background: rgba(255,255,255,.06); }
.menu .dom { color: var(--ink-3); font-size: 12px; margin-left: auto; }
.menu svg { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.seg { display: flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.seg button { height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--ink-3); font-weight: 600; font-size: 13px; }
.seg button.on { background: rgba(255,255,255,.09); color: var(--ink); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: ping 1.8s infinite; flex: none; display: inline-block; }
.live-dot.off { background: var(--ink-3); animation: none; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.55); } 80%, 100% { box-shadow: 0 0 0 9px rgba(52,211,153,0); } }

.head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.head .dom { color: var(--ink-3); }
.updated { color: var(--ink-3); font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 99px; background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.25); color: #a7f3d0; font-weight: 600; font-size: 12.5px; }

.tabs-main { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs-main button { position: relative; height: 40px; padding: 0 14px; border: 0; background: none; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.tabs-main button.on { color: var(--ink); }
.tabs-main button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--grad); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { padding: 16px 18px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); position: relative; }
.kpi .l { color: var(--ink-3); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; display: flex; gap: 6px; align-items: center; }
.kpi .v { margin-top: 6px; font-size: 26px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .d { margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.kpi .help { position: absolute; right: 12px; top: 12px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--ink-3); font-size: 11px; display: grid; place-items: center; cursor: help; }
.up { color: var(--good) !important; } .down { color: var(--bad) !important; } .warn { color: var(--warn) !important; }

.card { border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); }
.chart { margin-top: 12px; padding: 16px 18px 10px; }
.legend { display: flex; gap: 16px; color: var(--ink-3); font-size: 12.5px; margin-bottom: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart svg { width: 100%; height: 240px; display: block; overflow: visible; }
.tip { position: fixed; pointer-events: none; z-index: 50; padding: 9px 12px; border-radius: 11px; background: #17171f; border: 1px solid var(--line-2); font-size: 12.5px; box-shadow: 0 14px 40px -12px rgba(0,0,0,.8); white-space: nowrap; }

.insights { margin-top: 12px; padding: 16px 18px; }
.insights h3 { margin: 0 0 10px; font-size: 13px; display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
.insights h3 svg { width: 16px; height: 16px; color: var(--accent); }
.insights ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.insights li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; color: var(--ink-2); }
.insights li b { color: var(--ink); }
.insights li::before { content: ''; flex: none; width: 7px; height: 7px; margin-top: 7px; border-radius: 50%; background: var(--accent); }
.insights li.good::before { background: var(--good); } .insights li.bad::before { background: var(--bad); } .insights li.warn::before { background: var(--warn); }

.grid { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.span2 { grid-column: span 2; } .span3 { grid-column: 1 / -1; }
.panel { padding: 16px 18px 12px; min-width: 0; }
.panel h3 { margin: 0 0 4px; font-size: 13.5px; color: var(--ink); font-weight: 650; display: flex; justify-content: space-between; gap: 10px; }
.panel h3 span { color: var(--ink-3); font-weight: 500; font-size: 12px; }
.panel .sub { color: var(--ink-3); font-size: 12px; margin: 0 0 10px; line-height: 1.45; }
.rows { display: grid; gap: 4px; }
.row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 10px; border-radius: 9px; overflow: hidden; }
.row .bar { position: absolute; inset: 0 auto 0 0; border-radius: 9px; background: linear-gradient(90deg, rgba(167,139,250,.22), rgba(167,139,250,.08)); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.row .k { position: relative; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .n { position: relative; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.row .n small { color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.row img { position: relative; width: 16px; height: 16px; border-radius: 4px; }
.flag { position: relative; display: inline-flex; }
.fl { width: 20px !important; height: 14px !important; border-radius: 3px !important; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.empty { color: var(--ink-3); padding: 14px 4px; font-size: 13px; line-height: 1.5; }
.empty code { font-family: 'JetBrains Mono', monospace; color: var(--ink-2); }
.tag { position: relative; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: rgba(244,114,182,.15); color: #fbcfe8; white-space: nowrap; }
.tag.pv { background: rgba(167,139,250,.14); color: #ddd6fe; }
.tag.ok { background: rgba(52,211,153,.14); color: #a7f3d0; }
.tag.bad { background: rgba(251,113,133,.15); color: #fecdd3; }

/* tables */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; color: var(--ink-3); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.t td.k { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.r, table.t th.r { text-align: right; }
.scroll-x { overflow-x: auto; }

/* section journey */
.journey { display: grid; gap: 6px; }
.jstep { display: grid; grid-template-columns: minmax(140px, 220px) 1fr 90px 90px; gap: 12px; align-items: center; }
.jstep .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jstep .track { height: 28px; border-radius: 8px; background: rgba(255,255,255,.04); overflow: hidden; position: relative; }
.jstep .fill { position: absolute; inset: 0 auto 0 0; border-radius: 8px; background: var(--grad); opacity: .85; }
.jstep .fill span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); white-space: nowrap; }
.jstep .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12.5px; }
.jdrop { margin-left: 232px; font-size: 11.5px; color: var(--ink-3); }
.jdrop.bad { color: var(--bad); }

/* funnels */
.funnel { display: grid; gap: 10px; }
.fstep { display: grid; grid-template-columns: 220px 1fr 110px; gap: 14px; align-items: center; }
.fstep .lbl { font-weight: 600; }
.fstep .lbl small { display: block; color: var(--ink-3); font-weight: 500; font-size: 11.5px; }
.fstep .track { height: 34px; border-radius: 9px; background: rgba(255,255,255,.04); position: relative; overflow: hidden; }
.fstep .fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, rgba(167,139,250,.75), rgba(96,165,250,.6)); border-radius: 9px; }
.fstep .num { text-align: right; font-variant-numeric: tabular-nums; }
.fstep .num b { font-size: 16px; } .fstep .num small { display: block; color: var(--ink-3); font-size: 11.5px; }

/* histogram */
.hist { display: grid; gap: 6px; }
.hist .row { min-height: 28px; }

/* heatmap */
.heat { display: grid; grid-template-columns: 38px repeat(24, 1fr); gap: 3px; font-size: 10.5px; color: var(--ink-3); }
.heat .c { aspect-ratio: 1; border-radius: 4px; background: rgba(167,139,250,.06); }
.heat .lab { display: flex; align-items: center; }
.heat .hl { text-align: center; }

/* retention */
table.ret td.c { text-align: center; border-radius: 6px; font-size: 12px; font-weight: 600; }

.sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.site { padding: 18px; cursor: pointer; transition: border-color .2s, transform .2s; }
.site:hover { border-color: rgba(167,139,250,.4); transform: translateY(-2px); }
.site .nm { font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.site .nm svg { width: 15px; height: 15px; color: var(--ink-3); }
.site .dm { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.site .nums { display: flex; gap: 22px; margin-top: 16px; }
.site .nums b { display: block; font-size: 22px; letter-spacing: -.02em; }
.site .nums span { color: var(--ink-3); font-size: 12px; }
.site.add { display: grid; place-items: center; min-height: 150px; border-style: dashed; color: var(--ink-3); font-weight: 600; }

.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 26px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 40px 100px -30px rgba(0,0,0,.9); }
.modal h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.02em; }
.modal p.sub { margin: 0 0 18px; color: var(--ink-3); }
.modal label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin: 14px 0 6px; }
.tabs { display: flex; gap: 4px; margin: 18px 0 10px; flex-wrap: wrap; }
.tabs button { height: 30px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: none; color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.tabs button.on { background: rgba(255,255,255,.08); color: var(--ink); border-color: var(--line-2); }
pre.code { position: relative; margin: 0; padding: 14px 52px 14px 14px; border-radius: 12px; background: #050507; border: 1px solid var(--line); font: 12.5px/1.6 'JetBrains Mono', monospace; color: #e4e2ee; white-space: pre-wrap; word-break: break-all; }
pre.code .copy { position: absolute; right: 8px; top: 8px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 12px; }
.hint { color: var(--ink-3); font-size: 12.5px; margin-top: 10px; line-height: 1.55; }
.hint code { font-family: 'JetBrains Mono', monospace; color: var(--ink-2); font-size: 12px; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.modal .foot { display: flex; gap: 10px; margin-top: 22px; justify-content: flex-end; flex-wrap: wrap; }
.kindpick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kindpick button { padding: 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); text-align: left; }
.kindpick button.on { border-color: rgba(167,139,250,.6); background: rgba(167,139,250,.1); }
.kindpick b { display: flex; gap: 8px; align-items: center; } .kindpick span { display: block; color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.kindpick svg { width: 16px; height: 16px; }

@media (max-width: 1100px) { .grid { grid-template-columns: repeat(2, 1fr); } .kpis { grid-template-columns: repeat(2, 1fr); } .span2 { grid-column: span 2; } }
@media (max-width: 700px) {
  .grid, .grid.two { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  header.top .in { padding: 10px 16px; flex-wrap: wrap; } main { padding: 18px 16px 60px; }
  .select > button { min-width: 0; } .kpi .v { font-size: 22px; } .hide-sm { display: none; }
  .jstep { grid-template-columns: 110px 1fr 70px; } .jstep .num.t { display: none; } .jdrop { margin-left: 122px; }
  .fstep { grid-template-columns: 1fr; gap: 6px; } .fstep .num { text-align: left; }
}

/* downloads */
.dlgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.dlbox { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.dli { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.05); color: var(--ink-2); flex: none; }
.dli svg { width: 20px; height: 20px; }
.dlt { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.dln { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.split { display: flex; height: 10px; border-radius: 99px; overflow: hidden; margin-top: 14px; background: rgba(255,255,255,.05); }
.split .sw { background: #60a5fa; } .split .sm { background: #e5e7eb; }
.splitlbl { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 12px; margin-top: 6px; }
/* comparison */
table.cmp td:first-child { color: var(--ink-2); white-space: nowrap; }
table.cmp td.win { color: #a7f3d0; font-weight: 700; background: rgba(52,211,153,.06); }
/* live map */
.mapcard { padding-bottom: 14px; }
#livemap { height: 460px; border-radius: 12px; overflow: hidden; background: #0b0b10; border: 1px solid var(--line); }
.leaflet-container { background: #0b0b10 !important; font: inherit; }
.livepin { position: relative; }
.livepin .face { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; border-radius: 50%; background: rgba(20,20,28,.9); box-shadow: 0 0 0 2px rgba(167,139,250,.9), 0 6px 18px -4px rgba(0,0,0,.8); z-index: 2; }
.livepin .ring { position: absolute; inset: 0; border-radius: 50%; animation: livering 2s ease-out infinite; box-shadow: 0 0 0 0 rgba(167,139,250,.6); }
@keyframes livering { 0% { box-shadow: 0 0 0 0 rgba(167,139,250,.55); } 100% { box-shadow: 0 0 0 18px rgba(167,139,250,0); } }
.ltip { background: #15151d !important; color: var(--ink) !important; border: 1px solid var(--line-2) !important; border-radius: 12px !important; box-shadow: 0 16px 40px -12px rgba(0,0,0,.8) !important; padding: 10px 12px !important; }
.ltip::before { display: none; }
.lt { display: grid; gap: 3px; font-size: 12.5px; line-height: 1.4; }
.lt .ln { font-weight: 700; font-size: 13.5px; }
@media (max-width: 700px) { .dlgrid { grid-template-columns: 1fr; } #livemap { height: 340px; } }

/* feedback inbox */
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 99px; background: var(--accent-2); color: #fff; font-size: 11px; font-weight: 700; }
.fblist { display: grid; gap: 10px; }
.fb { padding: 14px 16px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); }
.fb.done { opacity: .55; }
.fbh, .fbf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.fbh a { color: var(--accent); }
.fbm { margin: 10px 0; white-space: pre-wrap; line-height: 1.55; font-size: 14px; }
.fbf .btn { height: 30px; }
