/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #f7f7f7;
  --panel: #ffffff;
  --subtle: #f2f2f2;
  --hover: #f4f4f5;
  --border: #e6e6e6;
  --border-strong: #d4d4d4;
  --text: #171717;
  --muted: #737373;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.1);
  --chart: #6366f1;
  --chart-2: #10b981;
  --chart-3: #f59e0b;
  --chart-4: #ec4899;
  --bar: rgba(99, 102, 241, 0.09);
  --grid: #efefef;
  --good: #16a34a;
  --ok: #d97706;
  --bad: #dc2626;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --sidebar: 232px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --panel: #131313;
  --subtle: #1b1b1b;
  --hover: #1c1c1c;
  --border: #262626;
  --border-strong: #3a3a3a;
  --text: #f4f4f5;
  --muted: #a1a1a1;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.18);
  --chart: #818cf8;
  --chart-2: #34d399;
  --chart-3: #fbbf24;
  --chart-4: #f472b6;
  --bar: rgba(129, 140, 248, 0.13);
  --grid: #222222;
  --good: #22c55e;
  --ok: #f59e0b;
  --bad: #f87171;
  --shadow: none;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
p a, .muted a { color: var(--chart); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.92em; }
code { background: var(--subtle); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 600; }
.icon { flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.cap { text-transform: capitalize; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.baseline { align-items: baseline; }
.gap-xs { gap: 4px; } .gap-s { gap: 8px; } .gap-l { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.rel { position: relative; }
.push { margin-left: auto; }
.section-gap { margin-top: 16px; }
.down { color: var(--bad); }
.error { color: var(--bad); font-size: 13px; }
.mobile-only { display: none !important; }

/* ---------------------------------------------------------------- layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--border);
  padding: 12px 10px; overflow-y: auto;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand.big { font-size: 22px; gap: 10px; }
.switcher { position: relative; margin-bottom: 8px; }
.switcher-btn {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); box-shadow: var(--shadow); font-weight: 500; text-align: left;
}
.switcher-btn .ellipsis { flex: 1; }
.nav { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; border-top: 1px solid var(--border); margin-top: 4px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 6px; }
.nav-title { font-size: 12px; color: var(--muted); padding: 10px 10px 4px; font-weight: 500; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; border: 0; background: none;
  color: var(--text); font-weight: 450; width: 100%; text-align: left; opacity: 0.86;
}
.nav-item:hover { background: var(--hover); opacity: 1; }
.nav-item.active { background: var(--subtle); font-weight: 550; opacity: 1; }
:root[data-theme="dark"] .nav-item.active { background: #1f1f1f; }
.sidebar-bottom { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 1px; }
.content { flex: 1; min-width: 0; }
.page { max-width: 1160px; margin: 0 auto; padding: 20px 28px 48px; }
.page-title { font-size: 18px; font-weight: 600; }
.scrim { display: none; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--panel); font-weight: 500; font-size: 13.5px;
  box-shadow: var(--shadow); white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--hover); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.icon { width: 34px; padding: 0; }
.btn.block { width: 100%; height: 38px; }
.btn.start { align-self: flex-start; }
.btn.selected { border-color: var(--text); }
.btn.danger { color: #fff; background: var(--bad); border-color: var(--bad); }
.danger-text { color: var(--bad); }
.btn-group { display: inline-flex; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; border: 0; background: none; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.bordered { border: 1px solid var(--border); }
.link-btn { border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; }
.input {
  height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel);
  outline: none; min-width: 0;
}
.input:focus { border-color: var(--chart); box-shadow: 0 0 0 3px var(--bar); }
.input.sm { height: 30px; font-size: 13px; padding: 0 8px; }
select.input { padding-right: 6px; }
.field-label { font-size: 13px; font-weight: 500; margin-bottom: -4px; }
.form { display: flex; flex-direction: column; gap: 10px; }
.search-box {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
}
.search-box input { border: 0; outline: none; background: none; flex: 1; color: var(--text); min-width: 0; }
.search-box.sm { height: 34px; width: 260px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--subtle); border: 1px solid var(--border); }
.segmented button { border: 0; background: none; padding: 5px 11px; border-radius: 6px; font-size: 13px; color: var(--muted); font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.segmented button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.segmented .count { color: var(--muted); font-weight: 400; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--subtle); color: var(--muted); }
.pill.accent { background: var(--bar); color: var(--chart); }

.popover {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 220px; max-height: 360px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 4px;
}
.popover.right { left: auto; right: 0; }
.popover-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 6px; text-align: left; }
.popover-item:hover { background: var(--hover); }
.popover-item.selected { font-weight: 600; }
.popover-sep { height: 1px; background: var(--border); margin: 4px 0; }
.filter-pop { width: 290px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

/* ---------------------------------------------------------------- toolbar */
.toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 4px 0 10px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--border); font-size: 13px;
}
.chip button { border: 0; background: none; color: var(--muted); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; }
.chip button:hover { background: var(--hover); color: var(--text); }
.live { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 0 6px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.55); animation: ping 2s infinite; flex-shrink: 0; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

/* ---------------------------------------------------------------- cards */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.setup { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.setup p { margin: 0; }
.code { position: relative; background: var(--subtle); border: 1px solid var(--border); border-radius: 8px; }
.code { min-width: 0; }
.code pre { margin: 0; padding: 12px 44px 12px 14px; font: 12.5px/1.6 "JetBrains Mono", monospace; overflow-x: auto; white-space: pre-wrap; word-break: break-word; }
.settings > * { min-width: 0; }
.code-copy { position: absolute; top: 8px; right: 8px; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); margin-bottom: 12px; }
.kpi {
  border: 0; border-right: 1px solid var(--border); background: none; padding: 12px 14px 0; text-align: left;
  display: flex; flex-direction: column; gap: 2px; min-width: 0; transition: background .12s;
}
.kpi:last-child { border-right: 0; }
.kpi:hover { background: var(--hover); }
.kpi.active { background: var(--subtle); }
.kpi-label { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.kpi-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.spark { display: block; margin: 6px -14px 0; width: calc(100% + 28px); }
.delta { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { padding: 14px 16px; border-right: 1px solid var(--border); min-width: 0; }
.stat:last-child { border-right: 0; }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; display: inline-block; }
.stat-caption { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* chart */
.chart-card { margin-bottom: 12px; }
.chart-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 10px; }
.chart-head > :first-child { justify-self: start; }
.chart-head > :last-child { justify-self: end; }
.chart { position: relative; }

/* panels */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel { display: flex; flex-direction: column; min-height: 470px; padding: 14px 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.tabs { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; }
.tab {
  border: 0; background: none; padding: 4px 0 6px; color: var(--muted); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; font-size: 14px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.list-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 2px 0 6px; }
.list { display: flex; flex-direction: column; gap: 3px; }
.list-row {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 30px;
  padding: 0 8px; border-radius: 6px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.list-bar { position: absolute; inset: 0 auto 0 0; background: var(--bar); border-radius: 6px; transition: width .3s; }
.list-label { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.list-values { position: relative; display: flex; gap: 14px; align-items: center; }
.list-pct { font-size: 12px; color: var(--muted); opacity: 0; transition: opacity .12s; }
.list-row:hover .list-pct { opacity: 1; }
.list-row:hover .list-label { text-decoration: underline; text-underline-offset: 2px; }
.list-num { min-width: 44px; text-align: right; }
.flag { font-size: 15px; line-height: 1; }
.favicon { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.badge {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; color: #fff;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.empty { display: flex; gap: 6px; align-items: center; justify-content: center; color: var(--muted); padding: 40px 0; text-align: center; }
.skeleton-row { display: flex; justify-content: space-between; gap: 20px; height: 30px; align-items: center; }
.skel { height: 22px; border-radius: 5px; background: var(--subtle); animation: shimmer 1.4s infinite; }
.skel.short { width: 52px; }
.skeleton-block { height: 260px; border-radius: 8px; background: var(--subtle); animation: shimmer 1.4s infinite; }
@keyframes shimmer { 50% { opacity: .55; } }

/* heatmap */
.heatmap { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.heat-head, .heat-row { display: grid; grid-template-columns: 44px repeat(7, 1fr); gap: 3px; align-items: center; }
.heat-head span { text-align: center; }
.heat-cell { height: 13px; border-radius: 3px; }
.heat-hour { text-align: right; padding-right: 6px; white-space: nowrap; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s; }
.modal { width: min(460px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; }
.modal-scroll { overflow-y: auto; max-height: 60vh; }
@keyframes fade { from { opacity: 0; } }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px 14px; background: var(--subtle); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; max-width: 320px; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover, .table th.active { color: var(--text); }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--hover); }
.table tr.open td { background: var(--subtle); }
.table tr.detail td { background: var(--subtle); padding: 6px 20px 16px; }
.page-cell { position: relative; }
.page-cell span { position: relative; }
.cell-bar { position: absolute; left: 0; top: 4px; bottom: 4px; background: var(--bar); border-radius: 0 4px 4px 0; }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 10.5px; font-weight: 700; flex-shrink: 0; }
.device-icons { color: var(--muted); }
.entry-exit { display: flex; align-items: center; gap: 6px; max-width: 280px; }
.err-count { color: var(--bad); font-weight: 600; }
.sessions-table td:nth-child(8) .row { max-width: 170px; }

/* session timeline */
.timeline { list-style: none; margin: 8px 0 0; padding: 0 0 0 6px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.timeline li { position: relative; display: flex; gap: 10px; align-items: baseline; padding-left: 14px; flex-wrap: wrap; }
.tl-dot { position: absolute; left: -7px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--chart); border: 2px solid var(--subtle); }
.tl-custom_event .tl-dot { background: var(--accent); }
.tl-error .tl-dot { background: var(--bad); }
.tl-outbound .tl-dot { background: var(--chart-3); }
.tl-performance .tl-dot { background: var(--muted); }
.tl-time { font: 12px "JetBrains Mono", monospace; color: var(--muted); min-width: 48px; }
.tl-type { font-size: 12px; color: var(--muted); min-width: 90px; }
.tl-main { font-weight: 500; }
.tl-error .tl-main { color: var(--bad); }
.tl-props { font-size: 11.5px; }

/* goals */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.goal { display: flex; flex-direction: column; gap: 6px; }
.goal-rate { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-top: 8px; display: flex; align-items: baseline; gap: 8px; }
.meter { height: 6px; border-radius: 3px; background: var(--subtle); overflow: hidden; margin: 6px 0; }
.meter div { height: 100%; background: var(--accent); border-radius: 3px; }

/* funnels */
.step-input { display: flex; gap: 8px; align-items: center; }
.step-input select { width: 140px; }
.step-num { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--subtle); font-size: 12px; font-weight: 600; flex-shrink: 0; }
.funnel-summary { margin: 12px 0 18px; }
.funnel-bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(110px, 1fr); gap: 12px; overflow-x: auto; }
.fstep { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fstep-col { position: relative; height: 240px; background: var(--subtle); border-radius: 8px; overflow: hidden; }
.fstep-fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--chart); border-radius: 6px 6px 0 0; transition: height .4s; }
.fstep-lost {
  position: absolute; left: 0; right: 0;
  background: repeating-linear-gradient(135deg, var(--bar) 0 6px, transparent 6px 12px);
  border-top: 1px dashed var(--chart);
}
.fstep-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* journeys */
.journey-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.journey-row:last-child { border-bottom: 0; }
.journey-bar { position: absolute; inset: 0 auto 0 0; background: var(--bar); }
.journey-steps { position: relative; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.jstep { padding: 3px 9px; border-radius: 6px; background: var(--panel); border: 1px solid var(--border); font-size: 13px; }
.journey-num { position: relative; white-space: nowrap; }

/* errors */
.error-row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.error-row:hover { background: var(--hover); }
.error-row:last-child { border-bottom: 0; }
.error-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.error-msg { background: none; padding: 0; font-weight: 500; color: var(--text); word-break: break-word; }
.error-nums { display: flex; gap: 20px; text-align: right; }
.error-nums > div { display: flex; flex-direction: column; }
.stack { margin: 6px 0 0; padding: 8px 10px; background: var(--subtle); border-radius: 6px; font: 12px "JetBrains Mono", monospace; overflow-x: auto; }

/* performance */
.vitals { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.vital { text-align: left; display: flex; flex-direction: column; gap: 4px; transition: border-color .12s; }
.vital:hover { border-color: var(--border-strong); }
.vital.active { border-color: var(--chart); box-shadow: 0 0 0 3px var(--bar); }
.vital-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.good { color: var(--good); } .ok { color: var(--ok); } .poor { color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.good { background: var(--good); } .dot.ok { background: var(--ok); } .dot.poor { background: var(--bad); }
.vital-cell.good, .vital-cell.ok, .vital-cell.poor { font-weight: 500; }

/* settings */
.settings { display: grid; gap: 12px; margin-top: 12px; max-width: 760px; }
.settings h3 { margin-bottom: 4px; }
.settings p { margin: 4px 0 10px; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }

/* sites */
.sites-page { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.site-row { display: grid; grid-template-columns: minmax(200px, 1.4fr) minmax(120px, 1fr) 110px 110px; align-items: center; gap: 20px; padding: 18px 20px; transition: border-color .12s; }
.site-row:hover { border-color: var(--border-strong); }
.site-name b { font-size: 17px; }
.site-spark { display: flex; justify-content: center; }
.site-stat b { font-size: 20px; font-weight: 600; }

/* empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 16px; }
.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; color: var(--text); }
.empty-state .muted { max-width: 380px; }

/* login */
.login { display: grid; grid-template-columns: minmax(360px, 37%) 1fr; min-height: 100vh; }
.login-form { display: flex; flex-direction: column; justify-content: space-between; padding: 40px; }
.login-inner { display: flex; flex-direction: column; gap: 12px; width: min(380px, 100%); align-self: center; }
.login-inner p { margin: -6px 0 10px; }
.login-art {
  position: relative; margin: 12px; border-radius: 18px; overflow: hidden; isolation: isolate;
  background: #08080f; color: #e4e4e7;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 88px; padding: 64px 48px;
}
.art-grid {
  position: absolute; inset: 0; z-index: -1;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 30%, transparent 75%);
}
.art-glow { position: absolute; z-index: -2; border-radius: 50%; filter: blur(110px); opacity: .32; }
.art-glow.one { width: 520px; height: 520px; background: #4f46e5; top: 8%; left: 12%; animation: drift 14s ease-in-out infinite alternate; }
.art-glow.two { width: 420px; height: 420px; background: #a855f7; bottom: 6%; right: 10%; opacity: .22; animation: drift 18s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.08); } }

.art-stage { position: relative; width: min(560px, 78%); }
.art-window {
  border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, rgba(30,30,46,.92), rgba(18,18,28,.92));
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.02), inset 0 1px 0 rgba(255,255,255,.06);
  animation: rise .7s cubic-bezier(.2,.8,.2,1) both;
}
.art-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.art-bar i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.14); }
.art-url {
  margin: 0 auto; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: #a1a1aa;
  background: rgba(255,255,255,.05); padding: 3px 12px; border-radius: 6px;
}
.art-body { padding: 16px 18px 18px; }
.art-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.art-kpis > div { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.035); }
.art-kpis > div:first-child { background: rgba(129,140,248,.14); box-shadow: inset 0 0 0 1px rgba(129,140,248,.3); }
.art-kpis span { font-size: 10.5px; color: #a1a1aa; }
.art-kpis b { font-size: 18px; font-weight: 600; letter-spacing: -.02em; color: #fafafa; }
.art-kpis em { font-style: normal; font-size: 10.5px; font-weight: 600; }
.art-kpis em.up { color: #4ade80; }
.art-chart { width: 100%; height: 120px; display: block; overflow: visible; }
.art-gridline { stroke: rgba(255,255,255,.06); stroke-width: 1; }
.art-line { fill: none; stroke: #a5b4fc; stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s .3s cubic-bezier(.4,0,.2,1) forwards; }
.art-area { opacity: 0; animation: fadein .8s 1.2s forwards; }
.art-point { fill: #a5b4fc; stroke: #08080f; stroke-width: 3; opacity: 0; animation: fadein .3s 1.8s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.art-list { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.art-list-head { display: flex; justify-content: space-between; font-size: 10.5px; color: #71717a; padding: 0 8px 2px; }
.art-row { position: relative; display: flex; justify-content: space-between; font-size: 12px; padding: 5px 8px; border-radius: 5px; color: #d4d4d8; }
.art-row span { position: relative; }
.art-row-bar { position: absolute; inset: 0 auto 0 0; background: rgba(129,140,248,.13); border-radius: 5px; }

.art-float {
  position: absolute; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; font-size: 12.5px;
  background: rgba(24,24,36,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,.1); box-shadow: 0 20px 40px -12px rgba(0,0,0,.6);
  animation: rise .7s cubic-bezier(.2,.8,.2,1) both, bob 6s ease-in-out infinite alternate;
}
.art-float b { color: #fff; }
.art-float.live { top: -20px; right: -30px; animation-delay: .35s, 0s; }
.art-float.live b { font-variant-numeric: tabular-nums; font-size: 14px; }
.art-float.geo { flex-direction: column; align-items: stretch; gap: 4px; width: 210px; left: -96px; top: 34%; animation-delay: .5s, 1.2s; }
.art-float-title { font-size: 11px; color: #a1a1aa; margin-bottom: 2px; }
.art-geo-row { display: flex; align-items: center; gap: 8px; }
.art-geo-row .grow { color: #d4d4d8; }
.art-geo-bar { height: 3px; border-radius: 2px; background: rgba(255,255,255,.06); margin-bottom: 4px; overflow: hidden; }
.art-geo-bar div { height: 100%; border-radius: 2px; background: linear-gradient(90deg, #6366f1, #a78bfa); }
.art-float.privacy { right: -44px; bottom: -34px; color: #4ade80; animation-delay: .65s, 2.4s; }
.art-float.privacy div { display: flex; flex-direction: column; line-height: 1.25; }
.art-float.privacy span { color: #a1a1aa; font-size: 11px; }
@keyframes bob { to { translate: 0 -8px; } }

.art-copy { text-align: center; max-width: 460px; animation: rise .7s .2s cubic-bezier(.2,.8,.2,1) both; }
.art-copy h2 {
  font-size: 26px; font-weight: 600; letter-spacing: -.025em; line-height: 1.2; margin-bottom: 16px;
  background: linear-gradient(180deg, #fff, #c7c7d1); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.art-copy ul { list-style: none; margin: 0; padding: 0; display: inline-flex; flex-direction: column; gap: 8px; text-align: left; }
.art-copy li { display: flex; align-items: center; gap: 10px; color: #a1a1aa; font-size: 14px; }
.art-copy li svg { color: #818cf8; flex-shrink: 0; }

@media (max-width: 1180px) {
  .art-float.live { right: -10px; } .art-float.privacy { right: -14px; } .art-float.geo { left: -20px; }
}
/* Scale the illustration up on large monitors instead of leaving it tiny */
@media (min-width: 1700px) { .art-stage, .art-copy { zoom: 1.15; } }
@media (min-width: 2100px) { .art-stage, .art-copy { zoom: 1.35; } }
@media (min-width: 2500px) { .art-stage, .art-copy { zoom: 1.55; } }
@media (prefers-reduced-motion: reduce) {
  .login-art *, .login-art { animation: none !important; }
  .art-line { stroke-dashoffset: 0; } .art-area, .art-point { opacity: 1; }
}

.input-wrap { position: relative; display: flex; }
.input-wrap .input { flex: 1; padding-right: 40px; }
.input-icon { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; background: none; color: var(--muted); border-radius: 6px; }
.input-icon:hover { color: var(--text); background: var(--hover); }
.login-inner .input, .login-inner .btn.block { height: 42px; }
.login-inner h1 { font-size: 26px; font-weight: 600; color: var(--text); letter-spacing: -.02em; }
.logo { flex-shrink: 0; }

/* auth & members */
.boot { min-height: 100vh; display: grid; place-items: center; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.center { text-align: center; }
.legal-note { margin: -4px 0 0; }
.login-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.login-foot a { color: var(--muted); }
.login-foot a:hover { color: var(--text); }
.legal-note a { font-weight: 400 !important; text-decoration: underline; }
.login-inner a { color: var(--accent); font-weight: 500; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 4px; min-width: 0; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; object-fit: cover;
}
.user-avatar.dashed { background: none; border: 1px dashed var(--border-strong); color: var(--muted); }
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.members { display: flex; flex-direction: column; }
.member { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.icon-spacer { width: 28px; }

/* billing */
.plan-banner { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 9px 16px; font-size: 13.5px;
  background: var(--accent-soft); border-bottom: 1px solid var(--border); text-align: center; }
.plan-banner.bad { background: color-mix(in srgb, var(--bad) 12%, var(--panel)); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.billing { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.billing h3 { margin: 0; }
.current-plan { display: flex; flex-direction: column; gap: 16px; }
.plan-name { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; text-transform: none; }
.usage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.usage .meter { height: 8px; margin-top: 8px; }
.meter.warn div { background: var(--ok); }
.meter.over div { background: var(--bad); }
.notice { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; }
.notice.warn { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--text); }
.segmented .save { font-size: 11px; color: var(--good); font-weight: 600; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 22px; }
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.plan.current { background: var(--subtle); }
.plan-badge { position: absolute; top: -10px; left: 20px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.plan-price { display: flex; align-items: baseline; gap: 4px; margin-top: 6px; }
.plan-price b { font-size: 34px; letter-spacing: -0.03em; }
.plan-sub { margin-bottom: 8px; }
.plan-features { list-style: none; padding: 0; margin: 4px 0 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; font-size: 14px; }
.plan-features li { display: flex; gap: 8px; align-items: center; }
.plan-features svg { color: var(--accent); }
@media (max-width: 860px) { .plans, .usage-grid { grid-template-columns: 1fr; } }

/* palette, guides, settings */
.search-trigger { display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 10px; margin-bottom: 6px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted); font-size: 13.5px; }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger:hover { border-color: var(--border-strong); color: var(--text); }
kbd { font: 11px "JetBrains Mono", monospace; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--subtle); color: var(--muted); }
.palette-backdrop { place-items: start center; padding-top: 12vh; }
.palette { width: min(560px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.palette-input input { flex: 1; border: 0; outline: none; background: none; font-size: 15px; color: var(--text); }
.palette-list { max-height: 360px; overflow-y: auto; padding: 6px; }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; }
.palette-item.on { background: var(--hover); }
.popover-title { font-size: 12px; color: var(--muted); padding: 6px 10px 4px; }
.install-guide { display: flex; flex-direction: column; gap: 10px; }
.platforms { display: flex; flex-wrap: wrap; gap: 6px; }
.platform { border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 5px 10px; font-size: 13px; }
.platform:hover { border-color: var(--border-strong); }
.platform.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.guide-steps { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13.5px; display: flex; flex-direction: column; gap: 3px; }
.switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.toggle-row { padding: 6px 0; }
.exclusions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.exclusion { display: flex; flex-direction: column; gap: 5px; }
.exclusion textarea { height: auto; padding: 8px 10px; font: 13px "JetBrains Mono", monospace; resize: vertical; }
.notes { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; }
.note { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.public-site { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.nav-item.powered { color: var(--muted); font-size: 12.5px; }
.col { display: flex; flex-direction: column; }
.gap-m { gap: 12px; }
@media (max-width: 860px) { .exclusions { grid-template-columns: 1fr; } }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-weight: 500; transition: all .2s; z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(3n) { border-right: 0; }
  .kpi:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
  .vitals { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .mobile-only { display: inline-flex !important; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; background: var(--panel); }
  .menu-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .mobile-bar { display: flex !important; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 20; }
  .page { padding: 16px 16px 40px; }
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi { border-bottom: 1px solid var(--border); }
  .kpi:nth-child(3n) { border-right: 1px solid var(--border); }
  .kpi:nth-child(2n) { border-right: 0; }
  .stat { border-bottom: 1px solid var(--border); }
  .vitals { grid-template-columns: repeat(2, 1fr); }
  .site-row { grid-template-columns: 1fr auto auto; }
  .site-spark { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .search-box.sm { width: 100%; }
  .chart-head { grid-template-columns: 1fr auto; }
  .chart-head > span:empty { display: none; }
}

/* ---------- Users, retention, replay ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.profile-grid > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.profile-grid b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.traits { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.trait { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-sessions { display: flex; flex-direction: column; max-height: 50vh; overflow: auto; }
.user-session { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.user-session:last-child { border-bottom: 0; }
.user-link { font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replay-btn { padding: 0 8px; height: 24px; color: var(--accent); }
.notice-card { border-color: var(--accent); background: var(--accent-soft); }
.notice-card p { margin: 4px 0 10px; }
.table.retention td, .table.retention th { text-align: center; }
.table.retention td:first-child, .table.retention th:first-child { text-align: left; }
.ret-cell { font-variant-numeric: tabular-nums; font-size: 12px; border-left: 2px solid var(--panel); }
.plan-chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.upsell { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); font-size: 13px; }
.replay-stage { min-height: 300px; display: flex; justify-content: center; }
.replay-stage .rr-player { box-shadow: none; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.modal.wide:has(.replay-stage) { max-width: min(1160px, 96vw); width: 96vw; }
@media (max-width: 720px) { .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- API & MCP ---------- */
.api-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.api-grid .card { min-width: 0; }
.empty-keys { display: flex; gap: 12px; align-items: center; padding: 22px 20px; }
.pill-warn { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.danger-ghost { color: var(--bad); }
.form-error { color: var(--bad); font-size: 13px; }
.examples { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.endpoints { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.endpoint { display: grid; grid-template-columns: 46px minmax(0, auto) 1fr; gap: 10px; align-items: baseline; font-size: 13px; }
.endpoint code { font-family: 'JetBrains Mono', monospace; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.method { font: 600 10px/1 'JetBrains Mono', monospace; padding: 3px 0; text-align: center; border-radius: 4px; background: rgba(16, 185, 129, 0.14); color: #047857; }
.method.post { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 900px) { .api-grid { grid-template-columns: minmax(0, 1fr); } .endpoint { grid-template-columns: 46px minmax(0, 1fr); } .endpoint .muted { grid-column: 2; } }
