@font-face {
  font-family: 'Public Sans';
  src: url('/vendor/font.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #eef2f1;
  --surface: #ffffff;
  --surface-2: #f6f8f8;
  --ink: #17262e;
  --muted: #5a6b73;
  --faint: #8a9aa1;
  --line: #d7dfe0;
  --line-soft: #e6ecec;
  --tide: #0f6e73;
  --tide-soft: #d9ecec;
  --tide-bar: #cfe6e5;
  --amber: #b8770f;
  --amber-soft: #f6ead3;
  --rose: #b4474f;
  --rose-soft: #f6e1e2;
  --good: #2e7d4f;
  --focus: #1b8fd6;
  --shadow: 0 1px 0 rgba(23, 38, 46, .04), 0 8px 24px -14px rgba(23, 38, 46, .25);
  --radius-l: 14px;
  --radius-s: 7px;
  --sidebar: 236px;
  font-family: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  font-feature-settings: 'tnum' 1;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f171b;
    --surface: #162126;
    --surface-2: #1b282e;
    --ink: #e2eaec;
    --muted: #98a9b0;
    --faint: #6c7f87;
    --line: #26363d;
    --line-soft: #203036;
    --tide: #4fb3ae;
    --tide-soft: #183a3b;
    --tide-bar: #1d4446;
    --amber: #e0a93e;
    --amber-soft: #3a2e17;
    --rose: #e07a82;
    --rose-soft: #3c2125;
    --good: #5fc08a;
    --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 10px 28px -16px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--tide); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.02rem; }
h3 { font-size: .92rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 14px 18px; border-right: 1px solid var(--line);
  background: var(--surface-2); display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; padding: 0 6px; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.site-pick select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); font-weight: 600;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin: 10px 0 2px; padding: 0 10px; font-size: .78rem; color: var(--faint); font-weight: 600; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: var(--radius-s);
  color: var(--ink); text-decoration: none; font-size: .93rem;
}
.nav a:hover { background: var(--line-soft); }
.nav a[aria-current="page"] { background: var(--tide-soft); color: var(--tide); font-weight: 650; }
.nav .badge { font-size: .75rem; color: var(--good); font-weight: 600; }
.side-foot { margin-top: auto; font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: 6px; padding: 0 6px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--tide); cursor: pointer; text-align: left; }

.main { min-width: 0; padding: calc(18px + env(safe-area-inset-top, 0px)) 28px 60px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar h1 { margin-right: auto; }
.ctl.menu-btn { display: none; }

.ctl {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface); cursor: pointer; font-size: .9rem; min-height: 36px;
}
.ctl:hover { border-color: var(--faint); }
select.ctl { padding-right: 26px; }
.ctl.primary { background: var(--tide); color: #fff; border-color: var(--tide); font-weight: 600; }
@media (prefers-color-scheme: dark) { .ctl.primary { color: #08201f; } }
.ctl.danger { color: var(--rose); }
.ctl[disabled] { opacity: .5; cursor: default; }
.dates { display: none; gap: 6px; align-items: center; }
.dates.on { display: inline-flex; }
.dates input { padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 16px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 11px; border-radius: 999px;
  background: var(--tide-soft); color: var(--tide); font-size: .85rem; font-weight: 550;
}
.chip button { border: 0; background: none; color: inherit; cursor: pointer; width: 22px; height: 22px; border-radius: 50%; font-size: 1rem; line-height: 1; }
.chip button:hover { background: rgba(0, 0, 0, .08); }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; flex-wrap: wrap; }
.panel-head h2 { margin-right: auto; }
.panel-body { padding: 4px 18px 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side-wide { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.tabs { display: inline-flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-s); padding: 2px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 4px 10px; border-radius: 5px; cursor: pointer; font-size: .84rem; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* ---------- Signature: figure strip fused to the chart ---------- */
.instrument { overflow: hidden; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); border-bottom: 1px solid var(--line); }
.figure {
  text-align: left; border: 0; background: none; cursor: pointer; padding: 16px 18px 14px; position: relative;
  border-right: 1px solid var(--line-soft); min-width: 0;
}
.figure:last-child { border-right: 0; }
.figure .label { font-size: .82rem; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.figure .value { font-size: 1.65rem; font-weight: 680; letter-spacing: -.02em; display: block; margin-top: 2px; }
.figure .delta { font-size: .8rem; font-weight: 600; }
.figure .delta.up { color: var(--good); }
.figure .delta.down { color: var(--rose); }
.figure .delta.flat { color: var(--faint); }
.figure[aria-pressed="true"] { background: linear-gradient(var(--tide-soft), transparent 140%); }
.figure[aria-pressed="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--tide); }
.figure:hover:not([aria-pressed="true"]) { background: var(--surface-2); }
.chart-wrap { position: relative; height: 290px; padding: 14px 16px 10px; }
.chart-meta { display: flex; gap: 14px; align-items: center; padding: 0 18px 12px; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.swatch { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; background: var(--tide); }
.swatch.cmp { background: repeating-linear-gradient(90deg, var(--amber) 0 5px, transparent 5px 8px); }
.chart-meta .spacer { margin-left: auto; }

/* ---------- Bar tables ---------- */
.bt { width: 100%; border-collapse: collapse; font-size: .9rem; }
.bt th { text-align: right; font-weight: 600; color: var(--muted); font-size: .78rem; padding: 6px 8px; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.bt th:first-child { text-align: left; padding-left: 0; }
.bt td { padding: 0 8px; height: 34px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.bt tr:last-child td { border-bottom: 0; }
.bt td.key { text-align: left; padding: 0; width: 60%; max-width: 0; position: relative; }
.bt .bar { position: absolute; inset: 4px auto 4px 0; background: var(--tide-bar); border-radius: 4px; }
.bt .bar.rose { background: var(--rose-soft); }
.bt .k { position: relative; display: flex; align-items: center; gap: 7px; padding: 0 8px; overflow: hidden; }
.bt .k span.t { overflow: hidden; text-overflow: ellipsis; }
.bt tr.click { cursor: pointer; }
.bt tr.click:hover .k span.t { text-decoration: underline; }
.bt .sub { color: var(--faint); font-size: .8rem; }
.bt .chg { font-size: .76rem; margin-left: 4px; }
.bt .chg.up { color: var(--good); } .bt .chg.down { color: var(--rose); }
.flag { font-size: 1.05rem; line-height: 1; }
.empty { padding: 26px 4px; color: var(--muted); font-size: .9rem; }
.table-scroll { overflow-x: auto; }
.more { display: block; margin: 8px 0 0; font-size: .85rem; }
.search { padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); min-width: 180px; }

/* ---------- Real-time ---------- */
.live-hero { display: flex; align-items: flex-end; gap: 28px; padding: 22px 22px 10px; flex-wrap: wrap; }
.live-count { font-size: 4rem; font-weight: 720; letter-spacing: -.04em; line-height: .95; }
.pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--good); margin-right: 8px; box-shadow: 0 0 0 0 rgba(46, 125, 79, .5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(46, 125, 79, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 125, 79, 0); } }
.feed { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: max-content 1fr auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: .88rem; align-items: baseline; }
.feed li.new { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: var(--tide-soft); } to { background: transparent; } }
.feed .when { color: var(--faint); font-size: .8rem; white-space: nowrap; }
.feed .what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .who { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.tag { display: inline-block; font-size: .72rem; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-soft); }
.tag.bot { background: var(--rose-soft); color: var(--rose); border-color: transparent; }
.tag.ev { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.tag.ok { background: var(--tide-soft); color: var(--tide); border-color: transparent; }

/* ---------- Journeys ---------- */
.sankey { width: 100%; overflow-x: auto; }
.sankey svg { display: block; min-width: 760px; }
.sankey .node rect { fill: var(--tide); }
.sankey .node.other rect { fill: var(--faint); }
.sankey .node.exit rect { fill: var(--rose); }
.sankey .node text { font-size: 12px; fill: var(--ink); }
.sankey .node text.v { fill: var(--muted); font-size: 11px; }
.sankey .link { fill: none; stroke: var(--tide); stroke-opacity: .16; }
.sankey .link.exit { stroke: var(--rose); stroke-opacity: .12; }
.sankey .link:hover { stroke-opacity: .42; }

/* ---------- Heatmaps ---------- */
.hm-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.hm-pages { max-height: 640px; overflow-y: auto; }
.hm-pages button { display: flex; justify-content: space-between; width: 100%; gap: 8px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; font-size: .88rem; }
.hm-pages button:hover { background: var(--surface-2); }
.hm-pages button[aria-pressed="true"] { background: var(--tide-soft); color: var(--tide); font-weight: 600; }
.hm-stage { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.hm-canvas-wrap { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 620px; background:
  repeating-linear-gradient(0deg, var(--surface-2) 0 1px, transparent 1px 100px), var(--surface); }
.hm-canvas-wrap canvas { display: block; }
.hm-fold { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--amber); font-size: .72rem; color: var(--amber); padding-left: 6px; pointer-events: none; }
.scroll-bars { display: flex; flex-direction: column; gap: 3px; min-width: 240px; flex: 1; }
.scroll-bars .row { display: grid; grid-template-columns: 44px 1fr 48px; gap: 8px; align-items: center; font-size: .82rem; }
.scroll-bars .track { height: 14px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.scroll-bars .fill { height: 100%; background: var(--tide); }

/* ---------- Replays ---------- */
.replay-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.sess-list { list-style: none; margin: 0; padding: 0; max-height: 720px; overflow-y: auto; }
.sess-list li button { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line-soft); background: none; padding: 11px 16px; cursor: pointer; }
.sess-list li button:hover { background: var(--surface-2); }
.sess-list li button[aria-pressed="true"] { background: var(--tide-soft); }
.sess-list .l1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: .9rem; }
.sess-list .l2 { color: var(--muted); font-size: .8rem; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.player-host { background: var(--surface-2); border-radius: 10px; padding: 10px; overflow: hidden; }
.player-host .rr-player { box-shadow: none !important; background: var(--surface) !important; max-width: 100%; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.timeline li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); }
.timeline .ts { color: var(--faint); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .86rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- Funnels ---------- */
.funnel { display: flex; flex-direction: column; gap: 14px; }
.fstep { display: grid; grid-template-columns: 28px minmax(140px, 220px) 1fr; gap: 12px; align-items: center; }
.fstep .n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--tide-soft); color: var(--tide); font-weight: 700; font-size: .82rem; }
.fbar { position: relative; height: 36px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.fbar .fill { position: absolute; inset: 0 auto 0 0; background: var(--tide-bar); border-left: 4px solid var(--tide); border-radius: 6px; }
.fbar .txt { position: relative; z-index: 1; padding: 0 10px; line-height: 36px; font-weight: 650; font-size: .88rem; color: var(--ink); mix-blend-mode: normal; }
.fdrop { grid-column: 3; font-size: .82rem; color: var(--muted); margin-top: -8px; }
.fdrop strong { color: var(--rose); font-weight: 650; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-size: .86rem; font-weight: 600; }
.form label .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number], .form select, .form textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); font-weight: 400;
}
.form input[type=number] { max-width: 240px; }
.form textarea { min-height: 70px; resize: vertical; font-size: .86rem; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: flex !important; align-items: center; gap: 8px; grid-template-columns: none !important; font-weight: 500 !important; }
.err { color: var(--rose); font-size: .86rem; min-height: 1.2em; }
pre.code { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-s); padding: 10px 12px; overflow-x: auto; font-size: .82rem; font-family: ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.step-edit { display: grid; grid-template-columns: 120px 1fr 1fr 34px; gap: 8px; align-items: center; }

/* ---------- Popover ---------- */
.pop { position: absolute; z-index: 50; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .3); padding: 14px; width: 320px; }
.toast { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: .9rem; z-index: 100; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .panel { width: min(400px, 100%); padding: 28px; }
.auth h1 { margin: 14px 0 4px; }
.auth p { margin: 0 0 18px; color: var(--muted); }

.loading { color: var(--faint); padding: 30px 4px; font-size: .9rem; }
.note { font-size: .85rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--radius-s); padding: 10px 12px; }
.note.warn { background: var(--amber-soft); border-color: transparent; color: var(--ink); }
.split { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.bignum { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; }
.spark { width: 120px; height: 30px; display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .replay-layout, .hm-layout, .grid.side-wide { grid-template-columns: 1fr; }
  .hm-pages { max-height: 220px; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 60; inset: 0 auto 0 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .side.open { transform: none; }
  .ctl.menu-btn { display: inline-flex; }
  .main { padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 60px; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .figure .value { font-size: 1.35rem; }
  .figure { padding: 12px 12px 10px; }
  .chart-wrap { height: 230px; }
  .live-count { font-size: 3rem; }
  .bt td.key { width: 50%; min-width: 130px; }
  .topbar h1 { flex: 1 1 calc(100% - 60px); font-size: 1.35rem; }
  .topbar select.ctl, .topbar > .ctl:not(.menu-btn) { flex: 1 1 140px; }
  .fstep { grid-template-columns: 26px 1fr; }
  .fstep .fbar, .fdrop { grid-column: 1 / -1; }
}

/* rrweb-player controls in the Beacon palette */
.player-host .rr-controller { background: var(--surface) !important; }
.player-host .rr-controller__btns button { color: var(--ink) !important; }
.player-host .rr-controller__btns button.active { background: var(--tide) !important; color: #fff !important; }
.player-host .rr-progress { background: var(--line) !important; }
.player-host .rr-progress__step { background: var(--tide-bar) !important; }
.player-host .rr-progress__handler { background: var(--tide) !important; }
.player-host .rr-timeline__time { color: var(--muted) !important; }
.player-host .switch input[type=checkbox]:checked + label:before { background: var(--tide) !important; }
.player-host .rr-controller__btns svg { fill: var(--ink); }
