/* Tools HQ: one calm dark screen. Text wears text tokens; colour marks carry
   identity (product colours checked for colour blind readers on this surface). */
:root {
    color-scheme: dark;
    --bg: #0c0c0f;
    --surface: #16161a;
    --surface-2: #1d1d22;
    --line: rgba(255, 255, 255, 0.07);
    --line-2: rgba(255, 255, 255, 0.12);
    --text: #f2f2f5;
    --muted: #a3a3ad;
    --faint: #6f6f7a;
    --brand: #7b5cff;
    --good: #34d399;
    --warn: #f5b04c;
    --bad: #fb7185;
    --grid: rgba(255, 255, 255, 0.06);
    --sans: "Geist", "Segoe UI", system-ui, sans-serif;
    --mono: "Geist Mono", Consolas, monospace;
    --nav-h: 64px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: #c7b8ff; text-decoration: none; }
.boot { padding: 40px; color: var(--muted); }

/* Shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 18px 12px; border-right: 1px solid var(--line); background: #0e0e12; display: flex; flex-direction: column; gap: 4px; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.logo i { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, #7b5cff, #d95926); display: inline-block; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.on { color: var(--text); background: var(--surface-2); }
.nav-link svg { flex: none; }
.side .grow { flex: 1; }
.side small { padding: 0 12px; color: var(--faint); font-size: 12px; }
.main { min-width: 0; padding: 0 28px 60px; }
.top { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 16px 0 14px;
    background: rgba(12, 12, 15, 0.86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.top h1 { margin: 0 auto 0 0; font-size: 22px; letter-spacing: -0.03em; }
.chips { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.bottom { display: none; }

/* Blocks */
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; min-width: 0; }
.card h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: -0.02em; }
.card .sub { margin: 0 0 14px; color: var(--faint); font-size: 13px; }
.section-title { margin: 26px 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi b { display: block; font-size: 28px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 13px; }
.empty { color: var(--faint); font-size: 14px; padding: 8px 0; }
.err { color: var(--bad); font-size: 13px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* Needs you */
.attn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.attn + .attn { margin-top: 8px; }
.attn .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 14px; }
.attn.act .ic { background: rgba(123, 92, 255, 0.16); color: #b9a8ff; }
.attn.warn .ic { background: rgba(245, 176, 76, 0.14); color: var(--warn); }
.attn.info .ic { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.attn p { margin: 0; flex: 1; font-size: 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
    background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: rgba(255, 255, 255, 0.22); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Funnel */
.funnels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.step { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.step:first-of-type { border-top: 0; }
.step .label { font-size: 14px; }
.step .num { font-size: 18px; font-weight: 650; text-align: right; letter-spacing: -0.02em; }
.step .bar { grid-column: 1 / -1; height: 8px; border-radius: 0 4px 4px 0; background: var(--grid); overflow: hidden; }
.step .bar i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.step .meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 10px; color: var(--faint); font-size: 12px; }
.step .pct { color: var(--muted); font-weight: 600; }
.step.zero .num { color: var(--faint); }

/* Chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.tip { position: fixed; z-index: 100; pointer-events: none; padding: 8px 10px; border-radius: 9px; background: #222228; border: 1px solid var(--line-2);
    font-size: 12.5px; line-height: 1.45; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); max-width: 240px; }
.rows .row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; }
.rows .row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .row .hb { flex: 0 0 38%; height: 8px; border-radius: 0 4px 4px 0; background: var(--grid); }
.rows .row .hb i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--brand); }
.rows .row b { min-width: 36px; text-align: right; font-weight: 600; }

/* Lists */
.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; padding: 13px 4px; border-top: 1px solid var(--line); align-items: flex-start; }
.item:first-child { border-top: 0; }
.item.tap { cursor: pointer; border-radius: 10px; }
.item.tap:hover { background: rgba(255, 255, 255, 0.025); }
.item .body { flex: 1; min-width: 0; }
.item .t1 { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .t2 { color: var(--muted); font-size: 13px; }
.item .side-r { text-align: right; color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.badge.good { background: rgba(52, 211, 153, 0.12); color: var(--good); }
.badge.warn { background: rgba(245, 176, 76, 0.12); color: var(--warn); }
.badge.bad { background: rgba(251, 113, 133, 0.12); color: var(--bad); }
.badge.brand { background: rgba(123, 92, 255, 0.16); color: #c1b3ff; }
.src { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: none; font-size: 12px; font-weight: 700; color: var(--muted); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); margin-top: 2px; flex: none; }
.bar-actions { position: sticky; top: 64px; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.bar-actions span { flex: 1; font-size: 13.5px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12.5px; padding: 0 8px 8px 0; }
td { padding: 9px 8px 9px 0; border-top: 1px solid var(--line); }
td.n, th.n { text-align: right; }
.table-wrap { overflow-x: auto; }

/* Reels */
.reels { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.reel { display: grid; grid-template-columns: 74px 1fr; gap: 12px; }
.reel img { width: 74px; height: 120px; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.reel .cap { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; margin-top: 8px; font-size: 12.5px; }
.stats b { display: block; font-size: 15px; color: var(--text); font-weight: 650; }
.stats span { color: var(--faint); }
.camp { margin-top: 10px; padding: 9px 10px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; color: var(--muted); }
.camp b { color: var(--text); }

/* Drawer (a visitor's journey) */
.drawer { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.6); display: flex; justify-content: flex-end; }
.drawer .panel { width: min(520px, 100%); height: 100%; overflow-y: auto; background: #111115; border-left: 1px solid var(--line-2); padding: 20px 20px 80px; }
.drawer .close { float: right; }
.timeline { margin-top: 14px; border-left: 2px solid var(--line-2); padding-left: 16px; }
.tl { position: relative; padding: 0 0 14px; }
.tl::before { content: ""; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2); border: 2px solid #111115; box-shadow: 0 0 0 2px var(--line-2); }
.tl.act::before { background: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.tl .when { color: var(--faint); font-size: 12px; }
.tl .what { font-size: 14px; }

/* Sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 26px; }
.login h1 { margin: 10px 0 4px; font-size: 22px; letter-spacing: -0.03em; }
.login input { width: 100%; height: 48px; margin: 14px 0 10px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: #0f0f12; font-size: 16px; }
.login input:focus { outline: none; border-color: var(--brand); }
.login .btn { width: 100%; height: 46px; }

/* Phones */
@media (max-width: 860px) {
    .shell { display: block; }
    .side { display: none; }
    .main { padding: 0 14px calc(var(--nav-h) + 30px); }
    .top { padding: calc(10px + env(safe-area-inset-top)) 0 10px; gap: 8px; }
    .top h1 { font-size: 19px; flex-basis: 100%; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi b { font-size: 24px; }
    .cols-2 { grid-template-columns: minmax(0, 1fr); }
    .funnels { grid-template-columns: minmax(0, 1fr); }
    .bottom { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom); background: rgba(14, 14, 18, 0.94); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
    .bottom button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--faint); font-size: 11px; font-weight: 600; }
    .bottom button.on { color: var(--text); }
    .bar-actions { top: 100px; }
    .drawer .panel { width: 100%; border-left: 0; }
}
