:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --sunken: #f0efec;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --border: rgba(11, 11, 11, .10);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-soft: #e6f0fc;
  --on-accent: #ffffff;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s1-track: #cde2fb;
  --good: #006300;
  --good-soft: #e4f4e4;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --warn-ink: #7a4b00;
  --warn-soft: #fdf0cf;
  --shadow: 0 1px 2px rgba(11, 11, 11, .04), 0 8px 24px rgba(11, 11, 11, .05);
  --pop-shadow: 0 12px 40px rgba(11, 11, 11, .18);
  --heat: 42, 120, 214;
  --phone: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --sunken: #242423; --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
    --border: rgba(255, 255, 255, .10); --grid: #2c2c2a; --axis: #383835;
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #15273f; --on-accent: #ffffff;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s1-track: #1b3250;
    --good: #0ca30c; --good-soft: #10291a; --bad: #e66767; --bad-soft: #351a1a; --warn-ink: #fab219; --warn-soft: #33290f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --pop-shadow: 0 12px 40px rgba(0, 0, 0, .6);
    --heat: 57, 135, 229; --phone: #111110;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --sunken: #242423; --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
  --border: rgba(255, 255, 255, .10); --grid: #2c2c2a; --axis: #383835;
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-soft: #15273f; --on-accent: #ffffff;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s1-track: #1b3250;
  --good: #0ca30c; --good-soft: #10291a; --bad: #e66767; --bad-soft: #351a1a; --warn-ink: #fab219; --warn-soft: #33290f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --pop-shadow: 0 12px 40px rgba(0, 0, 0, .6);
  --heat: 57, 135, 229; --phone: #111110;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 14.5px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.t2 { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row > .grow { min-width: 0; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack > * { min-width: 0; }
.grid > * { min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 18px 12px; display: flex; flex-direction: column; gap: 6px;
  border-right: 1px solid var(--border); background: var(--surface);
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; }
.logo-mark i { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px rgba(255, 255, 255, .35); }
.appsw {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; margin-bottom: 10px; text-align: left;
  border: 1px solid var(--border); border-radius: 12px; background: var(--page);
}
.appsw:hover { border-color: var(--axis); }
.mono-badge { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.mono-badge.plain { background: var(--sunken); color: var(--text-2); font-weight: 500; font-size: 18px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500;
}
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: var(--sunken); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.side-foot .nav { border-top: 1px solid var(--grid); padding-top: 8px; }
.main { padding: 26px 32px 60px; min-width: 0; max-width: 1320px; width: 100%; }
.top { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.top h1 { font-size: 26px; letter-spacing: -.02em; line-height: 1.15; }
.top .sub { color: var(--text-2); margin-top: 4px; max-width: 60ch; }
.top > .grow { flex: 1 1 420px; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; max-width: 100%; min-width: 0; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .logo { padding: 0 6px; } .logo span { display: none; }
  .appsw { width: auto; margin: 0; padding: 6px 10px; }
  .nav { display: flex; overflow-x: auto; width: 100%; order: 5; gap: 2px; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .side-foot .nav { width: auto; order: 0; border: 0; padding: 0; }
  .side-foot .nav a span { display: none; }
  .main { padding: 18px 16px 48px; }
  .filters { margin-left: 0; }
  .top > .grow { flex-basis: 100%; }
  .side { min-width: 0; }
  .nav { min-width: 0; }
  .card { padding: 16px; }
  .fhero .big { font-size: 40px; }
  .select { max-width: 100%; }
}

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--axis); background: var(--sunken); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.big { min-height: 48px; padding: 0 20px; font-size: 16px; border-radius: 12px; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--sunken); gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.input, .select {
  min-height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); width: 100%;
}
textarea.input { padding: 10px 12px; min-height: 76px; resize: vertical; }
.select { width: auto; padding-right: 28px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-weight: 600; font-size: 13.5px; }
.field .help { color: var(--muted); font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* ---------- cards & tiles ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h h3 { font-size: 16px; letter-spacing: -.01em; }
.card-h .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-h > .grow { flex: 1 1 260px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: 100%; min-width: 0; }
.grid { display: grid; gap: 16px; }
.g-tiles { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.g-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1560px) { .g-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 720px) { .g-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.g-2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.g-3 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.g-22 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .g-22 { grid-template-columns: minmax(0, 1fr); } }
.g-side { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
@media (max-width: 1080px) { .g-side { grid-template-columns: minmax(0, 1fr); } }
.tile { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.tile .lbl { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-2); font-size: 13.5px; }
.tile .lbl .em { font-size: 16px; }
.tile .val { font-size: 30px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin-top: 6px; }
.tile .hint { color: var(--muted); font-size: 12.5px; }
.tile .foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 8px; min-height: 28px; }
.delta { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.delta.up { background: var(--good-soft); color: var(--good); }
.delta.down { background: var(--bad-soft); color: var(--bad); }
.delta.flat { background: var(--sunken); color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; background: var(--sunken); color: var(--text-2); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.good { background: var(--good-soft); color: var(--good); }
.em-badge { width: 38px; height: 38px; border-radius: 11px; background: var(--sunken); display: grid; place-items: center; font-size: 20px; flex: none; }
.em-badge.lg { width: 52px; height: 52px; border-radius: 15px; font-size: 28px; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: var(--sunken); }
.table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }

/* ---------- bar list ---------- */
.barlist { display: flex; flex-direction: column; gap: 10px; }
.bl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 2px 6px; margin: 0 -6px; border-radius: 8px; }
.bl-row.click { cursor: pointer; }
.bl-row.click:hover, .bl-row.on { background: var(--sunken); }
.bl-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bl-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.bl-sub { color: var(--muted); font-weight: 400; margin-left: 6px; font-size: 12.5px; }
.bl-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.bl-fill { height: 100%; border-radius: 0 3px 3px 0; background: var(--s1); min-width: 2px; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; color: var(--text-2); font-size: 13px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 7px; vertical-align: middle; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 11px; box-shadow: var(--pop-shadow); font-size: 13px; white-space: nowrap; min-width: 120px;
}
.tip .tt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tip .tr { display: flex; align-items: center; gap: 8px; }
.tip .tr i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tip .tr b { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; }
.spark { display: block; }

/* ---------- popovers, modal, toast ---------- */
.pop {
  position: absolute; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--pop-shadow); padding: 8px; min-width: 240px; max-height: 420px; overflow: auto;
}
.pop .item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 9px; text-align: left; }
.pop .item:hover, .pop .item.kb { background: var(--sunken); }
.pop .item.on { background: var(--accent-soft); }
.pop .grp { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pop .sep { height: 1px; background: var(--grid); margin: 6px 0; }
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 20px; overflow: auto; }
.modal { background: var(--surface); border-radius: 20px; padding: 24px; width: min(520px, 100%); box-shadow: var(--pop-shadow); display: flex; flex-direction: column; gap: 16px; }
.modal h2 { font-size: 20px; letter-spacing: -.01em; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 99; background: var(--text); color: var(--page); padding: 10px 16px; border-radius: 12px; font-weight: 500; box-shadow: var(--pop-shadow); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-grid button { border: 0; background: transparent; font-size: 20px; padding: 6px; border-radius: 8px; }
.emoji-grid button:hover { background: var(--sunken); }

/* ---------- empty & skeleton ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty .em { font-size: 44px; line-height: 1; margin-bottom: 12px; }
.empty h3 { font-size: 17px; color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 46ch; margin: 0 auto 16px; }
.skel { border-radius: 16px; min-height: 120px; background: linear-gradient(90deg, var(--sunken), var(--surface), var(--sunken)); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 28px; display: flex; flex-direction: column; gap: 16px; text-align: center; }
.login .logo { justify-content: center; padding: 0; font-size: 22px; }
.err { color: var(--bad); font-size: 13.5px; min-height: 20px; }

/* ---------- funnels ---------- */
.fcard { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .12s, border-color .12s; }
.fcard:hover { border-color: var(--axis); transform: translateY(-1px); }
.fcard .conv { font-size: 30px; font-weight: 650; letter-spacing: -.02em; }
.fsteps-mini { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; color: var(--text-2); font-size: 13px; }
.fsteps-mini .arrow { color: var(--muted); }
.fcard.new { border-style: dashed; align-items: center; justify-content: center; min-height: 170px; color: var(--text-2); box-shadow: none; background: transparent; }
.builder { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1080px) { .builder { grid-template-columns: minmax(0, 1fr); } }
.bstep { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border); border-radius: 13px; background: var(--page); }
.bstep.drag { opacity: .4; }
.bstep.over { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.bstep .n { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; margin-top: 6px; cursor: grab; }
.bstep .pick { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-align: left; }
.bstep .pick:hover { border-color: var(--axis); }
.bstep .tools { display: flex; flex-direction: column; gap: 2px; }
.bstep .cond { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.bstep .cond .select, .bstep .cond .input { min-height: 30px; font-size: 13px; width: auto; flex: 1; min-width: 90px; }
.link { border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 600; font-size: 13px; }
.link:hover { text-decoration: underline; }
.add-step { border: 1.5px dashed var(--axis); background: transparent; border-radius: 13px; padding: 12px; font-weight: 600; color: var(--accent-ink); width: 100%; }
.add-step:hover { background: var(--accent-soft); border-color: var(--accent); }
.fhero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.fhero .big { font-size: 52px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.fhero .say { color: var(--text-2); max-width: 46ch; }
.fhero .say b { color: var(--text); }
.frow { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.frow .n { width: 26px; height: 26px; border-radius: 50%; background: var(--sunken); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--text-2); }
.frow .name { display: flex; gap: 8px; align-items: center; min-width: 0; font-weight: 600; }
.frow .cnt { text-align: right; font-weight: 650; font-size: 17px; font-variant-numeric: tabular-nums; }
.frow .cnt small { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.frow .bar { grid-column: 2 / 4; height: 22px; border-radius: 5px; background: var(--s1-track); overflow: hidden; }
.frow .bar i { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; min-width: 3px; transition: width .35s ease; }
.fdrop { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 8px 42px; padding-left: 12px; border-left: 2px solid var(--grid); color: var(--text-2); font-size: 13px; min-height: 30px; }
@media (prefers-reduced-motion: reduce) { .frow .bar i, .fcard { transition: none; } }

/* ---------- events ---------- */
.dcard { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--page); display: flex; flex-direction: column; gap: 12px; }
.kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 620px) { .kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kind { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 11px; background: var(--surface); }
.kind:hover { border-color: var(--axis); }
.kind.on { border-color: var(--accent); background: var(--accent-soft); }
.kind b { font-size: 14px; }
.kind span { font-size: 12.5px; color: var(--muted); }
.kind.on span { color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 500; }
.chip button { border: 0; background: transparent; color: var(--muted); padding: 0 4px; font-size: 12px; }
.chip button:hover { color: var(--text); }
.codekey { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.input.bad { border-color: var(--bad); outline: 2px solid var(--bad-soft); }
.ev-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ev-name .ti { font-weight: 600; }
.code { position: relative; background: var(--sunken); border-radius: 12px; padding: 14px 16px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; line-height: 1.55; white-space: pre; overflow-x: auto; }
.code .copy { position: absolute; top: 8px; right: 8px; }
.kv { display: flex; flex-wrap: wrap; gap: 6px; }
.kv span { background: var(--sunken); border-radius: 7px; padding: 2px 8px; font-size: 12.5px; color: var(--text-2); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv span b { color: var(--text); font-weight: 600; }

/* ---------- retention ---------- */
.ret { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.ret .box { background: var(--page); border-radius: 12px; padding: 12px 14px; }
.ret .box .v { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.ret .box .m { height: 6px; border-radius: 3px; background: var(--s1-track); margin-top: 8px; overflow: hidden; }
.ret .box .m i { display: block; height: 100%; background: var(--s1); border-radius: 0 3px 3px 0; }
.cohort td, .cohort th { padding: 5px 6px; font-size: 12.5px; text-align: center; border: 0; white-space: nowrap; }
.cohort td.c { border-radius: 5px; min-width: 38px; }
.cohort td:first-child, .cohort th:first-child { text-align: left; }

/* ---------- one person ---------- */
.cal { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 4px; }
.cal i { height: 36px; border-radius: 6px; background: var(--sunken); }
.cal i.pre { background: transparent; border: 1px dashed var(--grid); }
.cb { font-weight: 650; }
.cb.good { color: var(--good); }
.cb.bad { color: var(--bad); }
.fold > summary { cursor: pointer; font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 10px; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold > summary .muted { font-weight: 400; font-size: 13px; }
@media (max-width: 720px) { .cal { gap: 2px; } .cal i { height: 28px; border-radius: 4px; } }

/* ---------- taps ---------- */
.phone { width: 240px; aspect-ratio: 20 / 44; border-radius: 34px; border: 6px solid var(--text); background: var(--phone); position: relative; overflow: hidden; margin: 0 auto; flex: none; }
.phone canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.phone .notch { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 72px; height: 20px; border-radius: 12px; background: var(--text); z-index: 2; }
.heat-scale { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 12px; color: var(--muted); font-size: 12.5px; }
.heat-scale i { width: 110px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, rgba(var(--heat), .08), rgba(var(--heat), 1)); }

/* ---------- users, timeline, live ---------- */
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--sunken); display: grid; place-items: center; font-size: 20px; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 30px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 18px; }
.facts div small { display: block; color: var(--muted); font-size: 12.5px; }
.facts div b { font-weight: 600; }
.sess { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.sess-h { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--page); font-weight: 600; flex-wrap: wrap; }
.tl-row { display: grid; grid-template-columns: 64px 30px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 14px; border-top: 1px solid var(--grid); }
.tl-row .time { color: var(--muted); font-size: 12.5px; padding-top: 3px; font-variant-numeric: tabular-nums; }
.tl-row .em { font-size: 17px; text-align: center; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(12, 163, 12, .5); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(12, 163, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); } }
.live-row { animation: slidein .35s ease; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .live-dot, .live-row { animation: none; } }

/* ---------- setup ---------- */
.step-n { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.keybox { display: flex; gap: 8px; align-items: center; background: var(--sunken); border-radius: 10px; padding: 8px 8px 8px 14px; }
.keybox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.note { background: var(--warn-soft); color: var(--warn-ink); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; }
.note.info { background: var(--accent-soft); color: var(--accent-ink); }
.demo-banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); margin-bottom: 16px; font-weight: 500; }
