:root {
  --canvas: #F5F5F2;
  --side: #FAFAF8;
  --panel: #FFFFFF;
  --line: #E6E4DE;
  --line-2: #EFEDE8;
  --ink: #16171B;
  --ink-2: #3D3F46;
  --muted: #6B6E76;
  --faint: #9A9CA3;
  --blue: #2A78D6;
  --blue-50: #EEF4FC;
  --blue-100: #CDE2FB;
  --ios: #2A78D6;
  --android: #EB6834;
  --web: #1BAF7A;
  --good: #0F7B4A;
  --good-bg: #E5F3EB;
  --bad: #C23B3B;
  --bad-bg: #FBE9E7;
  --prev: #B9BBC1;
  --ui: var(--kit-grotesk);
  --mono: var(--kit-mono);
  --r: 12px;
  --shadow: 0 1px 2px rgb(22 23 27 / .04), 0 6px 18px -10px rgb(22 23 27 / .12);
  --ease: cubic-bezier(.2, .7, .1, 1);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; min-width: 1000px; overflow: hidden; background: var(--canvas); color: var(--ink); font: 400 13.5px/1.4 var(--ui); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; }

.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); height: 100vh; }

/* ------------------------------------------------------------ sidebar */
.side { display: flex; flex-direction: column; gap: 6px; padding: 16px 12px 14px; background: var(--side); border-right: 1px solid var(--line); min-height: 0; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 12px; font: 600 17px/1 var(--ui); letter-spacing: -0.02em; }
.brand svg { width: 24px; height: 24px; }
.ws { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-align: left; box-shadow: var(--shadow); transition: border-color .2s; }
.ws:hover { border-color: #D3D1CA; }
.ws__icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(145deg, #4F9A69, #2F7A4C); flex: none; }
.ws__icon svg { width: 18px; height: 18px; }
.ws__txt { display: flex; flex-direction: column; min-width: 0; }
.ws__txt b { font-weight: 600; font-size: 13.5px; }
.ws__txt small { font-size: 11.5px; color: var(--muted); }
.ws__chev { width: 14px; height: 14px; margin-left: auto; color: var(--faint); }
.snav { display: flex; flex-direction: column; gap: 1px; margin-top: 12px; }
.snav button { position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font-weight: 500; text-align: left; transition: background-color .15s, color .15s; }
.snav button svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.snav button:hover { background: #EFEEEA; color: var(--ink); }
.snav button.on { background: var(--panel); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(22 23 27 / .05); }
.snav button.on svg { color: var(--blue); }
.snav .count { margin-left: auto; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.snav .dot { width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: var(--web); box-shadow: 0 0 0 3px rgb(27 175 122 / .18); }
.saved { margin-top: 18px; }
.saved__h { margin: 0 0 6px; padding: 0 10px; font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: .02em; }
.saved button { display: flex; align-items: center; gap: 10px; width: 100%; height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); text-align: left; }
.saved button:hover { background: #EFEEEA; }
.saved button i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.usage { margin-top: auto; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.usage__top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.usage__top b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.usage__top small { color: var(--faint); font-weight: 500; }
.usage__bar { height: 5px; margin: 9px 0 7px; border-radius: 3px; background: #ECEBE7; overflow: hidden; }
.usage__bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #5598e7, #2A78D6); }
.usage p { margin: 0; font-size: 11.5px; color: var(--faint); }
.side__foot { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.sample { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; padding: 4px 9px 4px 7px; border-radius: 999px; background: #FFF4D6; color: #7A5A00; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.sample i { width: 6px; height: 6px; border-radius: 50%; background: #E0A100; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-top: 1px solid var(--line); }
.me__av { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #EB6834, #E0A100); color: #fff; font-size: 11.5px; font-weight: 600; flex: none; }
.me__txt { display: flex; flex-direction: column; min-width: 0; }
.me__txt b { font-weight: 600; font-size: 13px; }
.me__txt small { color: var(--muted); font-size: 11.5px; }

/* ------------------------------------------------------------ top + filters */
.main { display: grid; grid-template-rows: 58px 54px minmax(0, 1fr); min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--canvas); }
.top__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top h1 { margin: 0; font: 600 19px/1 var(--ui); letter-spacing: -0.02em; }
.top__sub { color: var(--muted); white-space: nowrap; }
.sample--chip { align-self: center; }
.top__end { display: flex; align-items: center; gap: 12px; }
.search { display: flex; align-items: center; gap: 8px; width: 250px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--muted); transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(42 120 214 / .14); }
.search svg { width: 15px; height: 15px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--ink); }
.search input::placeholder { color: var(--faint); }
.search kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; font: 500 11px/1.4 var(--mono); color: var(--faint); }
.live { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--good); }
.live i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--web); }
.live i::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--web); animation: ping 1.8s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
.live--sm { margin-right: 9px; }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border: 0; border-radius: 9px; font-weight: 500; transition: background-color .15s, transform .15s; }
.btn svg { width: 15px; height: 15px; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #2B2D33; }
.filters { position: relative; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--canvas); }
.fbtn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); box-shadow: 0 1px 1px rgb(22 23 27 / .03); white-space: nowrap; transition: border-color .15s, background-color .15s; }
.fbtn:hover, .fbtn.open { border-color: #CFCDC6; }
.fbtn svg { width: 15px; height: 15px; color: var(--muted); }
.fbtn span { color: var(--muted); }
.fbtn b { font-weight: 550; }
.fbtn .chev { width: 14px; height: 14px; }
.toggle { display: inline-flex; align-items: center; gap: 9px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__ui { position: relative; width: 30px; height: 18px; border-radius: 999px; background: #D9D8D3; transition: background-color .2s; flex: none; }
.toggle__ui::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .25s var(--ease); }
.toggle input:checked + .toggle__ui { background: var(--blue); }
.toggle input:checked + .toggle__ui::after { transform: translateX(12px); }
.toggle input:focus-visible + .toggle__ui { box-shadow: 0 0 0 3px rgb(42 120 214 / .25); }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: #ECEBE7; }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font-weight: 500; white-space: nowrap; transition: background-color .15s, color .15s, box-shadow .15s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgb(22 23 27 / .1), 0 0 0 1px rgb(22 23 27 / .04); }
.seg button i { width: 7px; height: 7px; border-radius: 50%; }
.seg--sm button { height: 26px; padding: 0 9px; font-size: 12.5px; }
.reset { margin-left: auto; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 500; }
.reset:hover { background: #ECEBE7; color: var(--ink); }

.pop-wrap { position: relative; }
.pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 16px 40px -12px rgb(22 23 27 / .22), 0 2px 6px rgb(22 23 27 / .06); opacity: 0; visibility: hidden; transform: translateY(-4px) scale(.98); transform-origin: top left; transition: opacity .16s, transform .2s var(--ease), visibility 0s .2s; }
.pop.open { opacity: 1; visibility: visible; transform: none; transition: opacity .16s, transform .2s var(--ease); }
.pop--range { display: grid; grid-template-columns: 150px 232px; gap: 6px; }
.pop--share { right: 0; left: auto; transform-origin: top right; width: 320px; }
.pop--share input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--canvas); font: 500 12px/1 var(--mono); color: var(--ink-2); outline: none; }
.presets { display: flex; flex-direction: column; gap: 2px; padding-right: 6px; border-right: 1px solid var(--line-2); }
.presets button, .pop--list button { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; white-space: nowrap; }
.presets button:hover, .pop--list button:hover { background: var(--canvas); }
.presets button.on, .pop--list button.on { background: var(--blue-50); color: #1C5CAB; font-weight: 550; }
.pop--list { min-width: 210px; }
.presets button svg, .pop--list button svg { width: 14px; height: 14px; flex: none; opacity: 0; }
.presets button.on svg, .pop--list button.on svg { opacity: 1; }
.cal { padding: 6px 6px 4px; }
.cal__h { display: flex; justify-content: space-between; margin: 2px 2px 8px; font-weight: 600; }
.cal__g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; }
.cal__g span { display: grid; place-items: center; height: 28px; }
.cal__g .wd { height: 22px; color: var(--faint); font-size: 11px; }
.cal__g .in { background: var(--blue-50); color: #1C5CAB; }
.cal__g .edge { background: var(--blue); color: #fff; border-radius: 7px; font-weight: 600; }
.cal__g .out { color: #C9CACF; }

/* ------------------------------------------------------------ content grid */
.content { display: grid; grid-template-columns: minmax(0, 1fr) clamp(290px, 25vw, 360px); grid-template-rows: auto minmax(280px, 1fr) auto; gap: 14px; padding: 16px 22px 18px; overflow: auto; min-height: 0; }
.kpis { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.card { position: relative; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); box-shadow: var(--shadow); min-width: 0; }
.card.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgb(42 120 214 / .35), var(--shadow); } }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 13px 16px 0; }
.card__head h2 { display: flex; align-items: center; margin: 0; font: 600 14px/1.2 var(--ui); letter-spacing: -0.01em; }
.card__sub { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.kpi { padding: 12px 16px 0; overflow: hidden; }
.kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi__label { color: var(--ink-2); font-weight: 500; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px 2px 4px; border-radius: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta svg { width: 12px; height: 12px; }
.delta.up { background: var(--good-bg); color: var(--good); }
.delta.down { background: var(--bad-bg); color: var(--bad); }
.delta.flat { background: #EFEEEA; color: var(--muted); }
.kpi__val { margin: 6px 0 1px; font: 600 27px/1 var(--ui); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi__note { color: var(--muted); font-size: 11.5px; }
.kpi__spark { height: 30px; margin: 4px -16px 0; }
.kpi__spark svg { width: 100%; height: 100%; overflow: visible; }

/* chart */
.chart { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; }
.chart .card__head h2 { font-size: 15px; }
.legend { display: flex; gap: 14px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; transition: opacity .2s; }
.legend .off { opacity: 0; }
.lg { width: 14px; height: 2px; border-radius: 1px; }
.lg--cur { background: var(--blue); height: 3px; }
.lg--prev { background: var(--prev); }
.chart__box { position: relative; flex: 1; min-height: 0; margin: 4px 6px 6px 0; }
.chart__box > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tip { position: absolute; top: 0; left: 0; z-index: 4; min-width: 172px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: rgb(255 255 255 / .96); box-shadow: 0 10px 28px -10px rgb(22 23 27 / .25); pointer-events: none; opacity: 0; transition: opacity .15s; font-size: 12px; }
.tip.show { opacity: 1; }
.tip__d { margin-bottom: 6px; color: var(--muted); font-weight: 500; }
.tip__r { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.tip__r i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tip__r b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.tip__r .delta { margin-left: 6px; }
.pulse { transform-box: fill-box; transform-origin: center; animation: pl 1.8s var(--ease) infinite; }
@keyframes pl { 0% { transform: scale(.4); opacity: .5; } 100% { transform: scale(1.5); opacity: 0; } }
.axis text { font: 500 11px var(--ui); fill: var(--faint); font-variant-numeric: tabular-nums; }

/* feed */
.feed { grid-column: 2; grid-row: 2 / span 2; display: flex; flex-direction: column; overflow: hidden; }
.ghost { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.ghost:hover { background: var(--canvas); }
.ghost svg { width: 13px; height: 13px; }
.feed__list { position: relative; flex: 1; margin: 10px 0 0; padding: 0; list-style: none; overflow: hidden; -webkit-mask-image: linear-gradient(#000 82%, transparent); mask-image: linear-gradient(#000 82%, transparent); }
.ev { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; height: 50px; padding: 0 16px; border-top: 1px solid var(--line-2); animation: evIn .55s var(--ease) both; }
.ev.fresh { animation: evIn .55s var(--ease) both, fresh 2.4s ease-out; }
@keyframes evIn { from { opacity: 0; transform: translateY(-14px); } }
@keyframes fresh { 0% { background: var(--blue-50); } 100% { background: transparent; } }
.ev__ic { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--canvas); }
.ev__ic svg { width: 16px; height: 16px; color: var(--ink-2); }
.ev__ic i { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--panel); }
.ev__main { min-width: 0; }
.ev__name { display: flex; align-items: baseline; gap: 6px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev__name code { font: 500 11px/1 var(--mono); font-variant-ligatures: none; color: var(--muted); }
.ev__meta { margin-top: 2px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev__meta b { font: 500 11px/1 var(--mono); font-variant-ligatures: none; color: var(--ink-2); }
.ev__t { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ev__t span { display: block; margin-top: 3px; font: 500 10.5px/1 var(--mono); color: var(--muted); }
.feed__empty { display: none; margin: 30px 16px; color: var(--muted); text-align: center; }
.feed.empty .feed__empty { display: block; }

/* bottom row */
.bottom { grid-column: 1; grid-row: 3; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.22fr); gap: 14px; min-height: 0; }
.big { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; white-space: nowrap; }
.big b { font: 600 20px/1 var(--ui); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.big small { color: var(--muted); font-size: 11.5px; }
.funnel__rows { padding: 8px 16px 12px; }
.fr { display: grid; grid-template-columns: 128px minmax(0, 1fr) 92px; align-items: center; gap: 10px; height: 30px; }
.fr__l { color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr__bar { position: relative; height: 18px; border-radius: 0 4px 4px 0; background: repeating-linear-gradient(135deg, #F1F0EC 0 4px, #F8F7F4 4px 8px); }
.fr__fill { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; transition: width .7s var(--ease); }
.fr__v { display: flex; justify-content: flex-end; align-items: baseline; gap: 7px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fr__v b { font-weight: 600; }
.fr__v span { width: 44px; text-align: right; color: var(--muted); font-size: 12px; }
.fr:hover .fr__fill { filter: brightness(1.08); }

.ret__t { width: calc(100% - 28px); margin: 6px 14px 12px; border-collapse: separate; border-spacing: 2px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.ret__t th { padding: 2px 4px 3px; color: var(--faint); font-weight: 500; text-align: center; }
.ret__t th:first-child, .ret__t td:first-child { text-align: left; }
.ret__t td { height: 18px; padding: 0 4px; text-align: center; border-radius: 3px; transition: background-color .4s, color .4s; }
.ret__t td.c { color: var(--ink-2); white-space: nowrap; }
.ret__t td.s { color: var(--muted); text-align: right; padding-right: 8px; }
.ret__t td.v { cursor: default; }
.ret__t td.v:hover { outline: 2px solid var(--ink); outline-offset: -1px; }
.ret__t td.e { background: repeating-linear-gradient(135deg, #F6F5F2 0 3px, #FFFFFF 3px 6px); }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 90; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 500; box-shadow: 0 12px 30px -10px rgb(0 0 0 / .4); opacity: 0; visibility: hidden; transform: translate(-50%, 10px); transition: opacity .2s, transform .3s var(--ease), visibility 0s .3s; }
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity .2s, transform .3s var(--ease); }

/* ------------------------------------------------------------ narrower windows */
@media (max-width: 1199px) {
  .app { grid-template-columns: 64px minmax(0, 1fr); }
  .usage { display: none; }
  .side__foot { margin-top: auto; }
  .brand span, .ws__txt, .ws__chev, .snav button span, .snav .count, .snav .dot, .saved, .side__foot .sample, .me__txt { display: none; }
  .brand { justify-content: center; padding: 4px 0 12px; }
  .ws { justify-content: center; padding: 6px; }
  .snav button { justify-content: center; padding: 0; }
  .me { justify-content: center; padding: 8px 0; }
  .search { width: 190px; }
  .top__sub { display: none; }
  .toggle span:last-child { display: none; }
  .bottom { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1099px) {
  .fbtn span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html:not(.is-capturing) *, html:not(.is-capturing) *::after { animation: none !important; transition: none !important; }
}
