/* MoonCloud partner cabinet. Same tokens as the web admin (graphite ramp, teal accent). */
:root, html[data-theme="dark"] {
  color-scheme: dark;
  --side: #0f0f10;
  --bg: #121213;
  --card: #19191b;
  --raised: #222224;
  --input: #0f0f10;
  --line: rgba(237, 237, 237, .08);
  --line-strong: rgba(237, 237, 237, .14);
  --text: #ededed;
  --text-2: #a1a1a6;
  --text-3: #85858b;
  --accent: #2fc1b3;
  --accent-soft: rgba(47, 193, 179, .12);
  --accent-fill: rgba(47, 193, 179, .16);
  --primary: #2fc1b3;
  --on-primary: #08201e;
  --positive: #4cc38a;
  --negative: #e5484d;
  --t1: #2fc1b3; --t2: #5b8def; --t3: #a78bfa; --t4: #f0a63a; --t5: #4cc38a; --t6: #ef6b7b;
  --hero: radial-gradient(120% 140% at 0% 0%, rgba(47, 193, 179, .2), transparent 60%), #17191a;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --radius: 12px;
  --radius-lg: 18px;
  --top-h: 60px;
}
html[data-theme="light"] {
  color-scheme: light;
  --side: #f4f4f5;
  --bg: #f7f7f8;
  --card: #ffffff;
  --raised: #f1f1f3;
  --input: #ffffff;
  --line: rgba(23, 23, 23, .08);
  --line-strong: rgba(23, 23, 23, .14);
  --text: #171717;
  --text-2: #525252;
  --text-3: #737373;
  --accent: #0f8a80;
  --accent-soft: rgba(15, 138, 128, .1);
  --accent-fill: rgba(15, 138, 128, .12);
  --primary: #0f8a80;
  --on-primary: #ffffff;
  --positive: #16a34a;
  --negative: #dc2626;
  --t1: #0f8a80; --t2: #2f6fe0; --t3: #7c5ce6; --t4: #c77a0b; --t5: #16a34a; --t6: #d9475b;
  --hero: radial-gradient(120% 140% at 0% 0%, rgba(15, 138, 128, .14), transparent 60%), #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px; line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: 0; }
h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.01em; }
h2 { font-size: 17px; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.35; }
p { margin: 0; }
strong { font-weight: 500; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; padding: 1px 6px; border-radius: 6px; background: var(--raised); color: var(--accent); }
svg { flex: none; }
hr { border: 0; border-top: 1px solid var(--line); margin: 8px 10px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:where(a, button, input, select, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }
.nav svg, .icon-btn svg, .search svg, .seg svg, .select-caret, .caret, .kpi-more svg, .breakdown-head svg, .scroll-hint svg, .token-field svg, .empty-box svg, .support-card svg {
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.nav svg, .icon-btn svg { width: 18px; height: 18px; }
.eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }

/* tones for series */
.t1 { --tone: var(--t1); } .t2 { --tone: var(--t2); } .t3 { --tone: var(--t3); }
.t4 { --tone: var(--t4); } .t5 { --tone: var(--t5); } .t6 { --tone: var(--t6); }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); min-width: 0; }
.brand strong { font-size: 16px; font-weight: 600; }
.brand small { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.mark { color: var(--text); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top-pill {
  display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--card); font-weight: 500; white-space: nowrap;
}
.top-pill:hover { border-color: var(--accent); }
.avatar-pill { width: 34px; padding: 0; justify-content: center; color: var(--accent); }
.account { position: relative; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 240px;
  display: grid; gap: 2px; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--card); box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
}
.account-menu small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
.account-menu strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu form { margin: 0; }
.menu-item { width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--text-2); }
.menu-item:hover { background: var(--raised); color: var(--text); }
.staff-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 16px 0;
  padding: 10px 12px; border-radius: var(--radius); background: var(--accent-soft); color: var(--text-2); font-size: 13px;
}
.staff-note form { margin: 0; }
.staff-note select { height: 34px; width: auto; max-width: 100%; }

/* ---------- sidebar ---------- */
.side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: 264px;
  display: flex; flex-direction: column; gap: 16px; overflow-y: auto;
  padding: 16px 12px; background: var(--side); border-right: 1px solid var(--line);
  transform: translateX(-100%); transition: transform .25s var(--ease);
}
.side.open { transform: none; }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .2s; }
.side.open + .scrim { opacity: 1; pointer-events: auto; }
.main { min-width: 0; }
.nav { display: grid; gap: 2px; }
.nav a, .nav-btn {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; width: 100%;
  border: 0; border-radius: 12px; background: transparent; color: var(--text-2); cursor: pointer; text-align: left;
  transition: background .15s, color .15s;
}
.nav a:hover, .nav-btn:hover { background: var(--raised); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--text); }
.nav a.on svg { color: var(--accent); }
.nav a.nav-sub { min-height: 38px; padding-left: 30px; font-size: 13px; }
.nav a.nav-sub.on { background: transparent; }
.side-foot { margin-top: auto; display: flex; gap: 8px; padding: 0 4px; }
.side-foot form { margin: 0; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; flex: none;
  border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--text-2);
}
.icon-btn:hover, .icon-btn.on { color: var(--text); background: var(--raised); }
.icon-btn.on { border-color: var(--accent); color: var(--accent); }

/* ---------- page ---------- */
.content { padding: 24px 16px 40px; max-width: 1120px; }
.page-head { display: grid; gap: 6px; margin-bottom: 18px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.kicker::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.foot {
  display: grid; justify-items: center; gap: 12px; padding: 28px 16px 36px; margin-top: 12px;
  border-top: 1px solid var(--line); color: var(--text-2); text-align: center;
}
.foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.foot nav a:hover { color: var(--text); }
.foot small { color: var(--text-3); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-quiet { border-color: var(--line-strong); background: transparent; color: var(--text); }
.btn-quiet:hover { background: var(--raised); }
.btn-wide { width: 100%; height: 48px; }
input, select {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--input); color: var(--text);
}
select { cursor: pointer; }
input:disabled { opacity: .6; cursor: not-allowed; }

.section-pick { position: relative; margin-bottom: 12px; }
.section-pick select {
  appearance: none; -webkit-appearance: none; height: 56px; padding: 0 48px 0 18px;
  border-radius: var(--radius-lg); background: var(--card); font-size: 17px; font-weight: 500;
}
.select-caret { position: absolute; right: 18px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--text-2); pointer-events: none; }

.period { display: grid; gap: 12px; margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
.period-row { display: flex; align-items: center; gap: 8px; }
.chips { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; height: 34px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 10px; color: var(--text-2); white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.period-row .icon-btn { width: 36px; height: 36px; border-radius: 10px; }
.range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.range[hidden] { display: none; }
.range label { display: grid; gap: 4px; font-size: 12px; color: var(--text-3); }
.range input { height: 40px; }
.range .btn { grid-column: 1 / -1; }
.period-foot { display: flex; align-items: center; gap: 10px; }
.period-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; flex: 1; min-width: 0; padding-bottom: 6px; border-bottom: 1px solid var(--accent); }
.period-line .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.period-line strong { color: var(--accent); }
.period-line .sep { color: var(--text-3); }
.period-dates { color: var(--text-2); font-size: 13px; }

/* ---------- hero ---------- */
.hero {
  display: grid; gap: 14px; margin-bottom: 14px; padding: 20px; border: 1px solid var(--line);
  border-radius: 22px; background: var(--hero); min-width: 0; overflow: hidden;
}
.hero-value { font-size: 44px; line-height: 1; letter-spacing: -.02em; font-weight: 500; overflow-wrap: anywhere; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; background: color-mix(in srgb, var(--raised) 80%, transparent); font-size: 13px; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
.flow { display: grid; gap: 8px; }
.flow-row { display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--card) 70%, transparent); }
.flow-row b { font-size: 18px; font-weight: 500; min-width: 56px; }
.flow-row span { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.flow-row.up b { color: var(--positive); }
.flow-row.down b { color: var(--negative); }
.retention { display: flex; align-items: center; gap: 12px; padding: 4px 2px; }
.retention b { font-weight: 500; }
.bar { position: relative; flex: 1; height: 4px; border-radius: 4px; background: var(--raised); overflow: hidden; display: block; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--accent); }
.trend { display: grid; gap: 12px; padding-top: 6px; }
.trend-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; align-items: start; }
.kpi { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
.kpi > summary { display: grid; justify-items: center; gap: 8px; padding: 16px 14px 8px; text-align: center; }
.kpi-top { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px; }
.kpi-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.kpi-value { font-size: 26px; line-height: 1.1; letter-spacing: -.01em; overflow-wrap: anywhere; }
.kpi .spark { width: 100%; height: 40px; display: block; }
.kpi-rule { display: block; width: 100%; height: 2px; margin: 19px 0; border-radius: 2px; background: var(--tone); opacity: .8; }
.kpi-more { display: grid; place-items: center; height: 18px; color: var(--text-3); }
.kpi-more svg { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.kpi[open] .kpi-more svg { transform: rotate(180deg); }
.kpi-body { display: grid; gap: 10px; padding: 0 12px 14px; }
.kpi-body p { font-size: 13px; color: var(--text-2); text-align: center; }
.kpi-body .facts { grid-template-columns: 1fr; margin: 0; }
.delta { flex: none; padding: 1px 7px; border-radius: 999px; font-size: 11px; color: var(--text-2); background: var(--raised); }
.delta.up { color: var(--positive); background: color-mix(in srgb, var(--positive) 13%, transparent); }
.delta.down { color: var(--negative); background: color-mix(in srgb, var(--negative) 13%, transparent); }
.spark-line { fill: none; stroke: var(--tone, var(--accent)); stroke-width: 1.8; }
.spark-area { fill: var(--tone, var(--accent)); opacity: .12; stroke: none; }

/* ---------- panels and charts ---------- */
.panel {
  margin-bottom: 14px; padding: 18px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card);
  min-width: 0; overflow: hidden;
}
.panel-head { display: grid; gap: 4px; margin-bottom: 14px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 16px; }
.facts-3 { margin: 0; }
.fact { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); min-width: 0; }
.fact dt { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.fact dd { margin: 2px 0 0; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.fact.max { border-color: color-mix(in srgb, var(--positive) 45%, transparent); background: color-mix(in srgb, var(--positive) 8%, var(--card)); }
.fact.max dd { color: var(--positive); }
.fact.min { border-color: color-mix(in srgb, var(--negative) 45%, transparent); background: color-mix(in srgb, var(--negative) 8%, var(--card)); }
.fact.min dd { color: var(--negative); }
.chart-box { display: flex; gap: 8px; min-width: 0; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; padding: 4px 0 26px; font-size: 11px; color: var(--text-3); text-align: right; min-width: 24px; }
.chart-plot { position: relative; flex: 1; min-width: 0; }
.chart-plot > .chart { display: block; width: 100%; height: 180px; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .base { stroke: var(--line-strong); }
.chart-line { fill: none; stroke: var(--tone, var(--accent)); stroke-width: 2.2; stroke-linejoin: round; }
.chart-area { fill: var(--tone, var(--accent)); opacity: .12; }
.chart .col { fill: var(--tone); }
.chart-hits { position: absolute; left: 0; right: 0; top: 0; height: 180px; }
.hit { position: absolute; top: 0; bottom: 0; left: var(--x); width: 24px; transform: translateX(-50%); outline: none; }
.hit i {
  position: absolute; left: 50%; top: var(--y); width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--card); border: 2px solid var(--tone, var(--accent)); opacity: 0; transition: opacity .12s;
}
.hit b {
  position: absolute; left: 50%; bottom: calc(100% - var(--y) + 12px); transform: translateX(-50%); z-index: 2;
  padding: 4px 8px; border-radius: 8px; background: var(--text); color: var(--bg);
  font-size: 12px; font-weight: 500; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s;
}
.hit:first-child b { transform: none; }
.hit:last-child b { left: auto; right: 50%; transform: none; }
.hit:hover i, .hit:hover b, .hit:focus i, .hit:focus b { opacity: 1; }
.hit:hover::before, .hit:focus::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 4px; border-left: 1px dashed var(--line-strong); }
.ticks { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--text-3); }

/* ---------- breakdown ---------- */
.breakdown { margin-bottom: 14px; min-width: 0; }
.breakdown-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.breakdown-head h2 { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 15px; }
.breakdown-head h2 svg { width: 16px; height: 16px; color: var(--text-3); }
.columns { position: relative; }
.columns-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: 8px; min-width: 200px;
  padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
}
.columns-menu label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.columns-menu input { width: 16px; height: 16px; accent-color: var(--accent); }
.scroll-hint { display: flex; justify-content: flex-end; align-items: center; gap: 2px; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.scroll-hint svg { width: 14px; height: 14px; }
.breakdown .table-wrap { margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
.breakdown .table th:first-child, .breakdown .table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); padding-left: 14px; border-right: 1px solid var(--line); }
.breakdown .table th:last-child, .breakdown .table td:last-child { padding-right: 14px; }
.breakdown .table th { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.table th { color: var(--text-3); font-weight: 400; font-size: 12px; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .num { text-align: right; }
.table .strong { color: var(--text); font-weight: 500; }
.table tfoot td { border-bottom: 0; color: var(--text-2); font-weight: 500; }
.cell-title { display: block; color: var(--text); }
.table td small { display: block; margin-top: 2px; color: var(--text-3); font-size: 12px; }
.empty { color: var(--text-3); padding: 12px 0; text-align: center; }
.empty[hidden] { display: none; }
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 36px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); text-align: center; }
.empty-state p { color: var(--text-2); max-width: 420px; }
.empty-state .btn { margin-top: 8px; }

/* ---------- sales and traffic ---------- */
.tiles { display: grid; gap: 8px; margin-bottom: 16px; }
.tile { display: grid; gap: 2px; padding: 14px; border-radius: 12px; background: var(--raised); }
.tile strong { font-size: 20px; }
.tile span { color: var(--accent); font-size: 13px; }
.products { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.products li { display: grid; gap: 6px; }
.product-top { display: flex; justify-content: space-between; gap: 12px; }
.product-top b { font-weight: 500; white-space: nowrap; }
.products small { color: var(--text-3); }
.donut-wrap { display: grid; justify-items: center; gap: 18px; }
.donut { width: min(240px, 70vw); height: auto; }
.donut-hole { fill: none; stroke: var(--raised); stroke-width: 5; }
.donut-slice { fill: none; stroke: var(--tone); stroke-width: 5; }
.donut-num { fill: var(--text); font-size: 6px; font-weight: 500; text-anchor: middle; }
.donut-cap { fill: var(--text-3); font-size: 2.6px; text-anchor: middle; letter-spacing: .05em; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; width: 100%; }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--tone); }
.legend span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.legend b { font-weight: 500; }

/* ---------- bots ---------- */
.search { position: relative; display: block; margin-bottom: 10px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--text-3); }
.search input { padding-left: 42px; border-radius: 999px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.mini-select { display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; min-width: 0; }
.mini-select select { border: 0; height: 40px; padding: 0; background: transparent; min-width: 0; font-weight: 500; }
.bot-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bot-row { display: grid; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); min-width: 0; }
.bot-row[hidden] { display: none; }
.bot-row-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bot-avatar { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.bot-name { display: grid; min-width: 0; }
.bot-name strong, .bot-name a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-name a { color: var(--accent); font-size: 13px; }
.status { margin-left: auto; flex: none; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.status.ok { color: var(--positive); background: color-mix(in srgb, var(--positive) 12%, transparent); }
.status.off { color: var(--text-3); background: var(--card); }
.bot-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin: 0; }
.bot-facts dt { color: var(--text-3); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.bot-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.bot-facts dd.strong { color: var(--accent); font-weight: 500; }

/* ---------- connect, offers, faq, soon ---------- */
.serif { font-size: 22px; margin: 22px 0 14px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; margin: -18px -16px 0; border-bottom: 1px solid var(--line); }
.seg a { display: flex; align-items: center; justify-content: center; gap: 8px; height: 52px; color: var(--text-2); letter-spacing: .04em; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.seg a.on { color: var(--text); border-bottom-color: var(--accent); }
.count { padding: 0 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.token-field { position: relative; margin-bottom: 10px; }
.token-field input { height: 54px; padding-right: 48px; }
.token-field svg { position: absolute; right: 16px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--text-3); }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; }
.steps li { counter-increment: step; position: relative; display: grid; gap: 8px; padding: 0 0 22px 52px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -4px; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--accent); font-weight: 500;
}
.steps li::after { content: ""; position: absolute; left: 17px; top: 36px; bottom: 4px; border-left: 1px solid var(--line-strong); }
.steps li:last-child::after { display: none; }
.steps p { color: var(--text-2); }
.steps a { color: var(--accent); }
.empty-box { display: grid; justify-items: center; gap: 12px; padding: 36px 16px; border-radius: 14px; background: var(--raised); color: var(--text-3); text-align: center; }
.empty-box svg { width: 44px; height: 44px; }
.offer { display: grid; gap: 16px; padding: 20px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
.offer-head { display: flex; gap: 14px; align-items: flex-start; }
.offer-head .muted { margin-top: 4px; }
.offer-facts { display: grid; gap: 14px; margin: 0; }
.offer-facts dt { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.offer-facts dd { margin: 3px 0 0; font-size: 15px; }
.offer-facts a { color: var(--accent); }
.offer .btn { justify-self: start; }
.offer-more { margin: 18px 4px; color: var(--text-2); font-style: italic; }
.offer-more a { color: var(--accent); font-style: normal; }
.faq { display: grid; gap: 10px; }
.faq-group { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); overflow: hidden; }
.faq-group > summary { display: flex; align-items: center; gap: 14px; padding: 16px; }
.faq-icon { width: 40px; height: 40px; border-radius: 50%; flex: none; background: color-mix(in srgb, var(--tone) 16%, transparent); position: relative; }
.faq-icon::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: var(--tone); }
.faq-icon.t1 { --tone: var(--t4); } .faq-icon.t2 { --tone: var(--t5); } .faq-icon.t3 { --tone: var(--t1); } .faq-icon.t4 { --tone: var(--t2); }
.faq-title { display: grid; flex: 1; }
.faq-title strong { font-size: 16px; }
.faq-title small { color: var(--text-3); }
.caret { width: 18px; height: 18px; color: var(--text-3); transition: transform .2s var(--ease); }
details[open] > summary > .caret { transform: rotate(180deg); }
.faq-item { margin: 0 16px; border-top: 1px solid var(--line); }
.faq-item:last-child { margin-bottom: 6px; }
.faq-item > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; font-weight: 500; }
.faq-item p { padding: 0 0 16px; color: var(--text-2); }
.support-card { display: grid; gap: 6px; padding: 20px; border-radius: var(--radius-lg); background: var(--accent-soft); margin-top: 6px; }
.support-card svg { width: 26px; height: 26px; color: var(--accent); }
.support-card strong { font-size: 18px; }
.support-card span { color: var(--text-2); }
.soon { display: grid; gap: 12px; justify-items: start; padding: 24px 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.soon a { color: var(--accent); }
.soon-badge { padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 500; }

/* ---------- onboarding tour ---------- */
.tour { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.tour[hidden], .tour-done[hidden] { display: none; }
.tour-card {
  position: fixed; left: 12px; right: 12px; bottom: 16px; pointer-events: auto; overflow: hidden;
  display: grid; gap: 10px; padding: 18px 16px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background: var(--card); box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.tour-progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--raised); }
.tour-progress i { display: block; height: 100%; background: var(--accent); transition: width .25s var(--ease); }
.tour-head { display: flex; align-items: center; gap: 10px; }
.tour-head strong { flex: 1; font-size: 16px; }
.tour-head span { color: var(--text-3); font-size: 13px; }
.tour-x { border: 0; background: transparent; color: var(--text-3); font-size: 20px; cursor: pointer; line-height: 1; padding: 0 4px; }
.tour-card p { color: var(--text-2); }
.tour-actions { display: flex; gap: 8px; justify-content: space-between; }
.tour-actions .btn { height: 40px; padding: 0 14px; }
.tour-actions [data-tour-next] { margin-left: auto; }
.tour-lit { position: relative; z-index: 45; box-shadow: 0 0 0 2px var(--accent), 0 0 0 9999px rgba(0, 0, 0, .55); border-radius: 12px; }
.tour-done { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .6); }
.tour-done-card { width: min(420px, 100%); display: grid; justify-items: center; gap: 14px; padding: 28px 22px; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--card); text-align: center; }
.tour-done-card p { color: var(--text-2); }

/* ---------- login ---------- */
.login-body { min-height: 100vh; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); display: grid; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-brand div { display: grid; line-height: 1.25; }
.login-brand strong { font-size: 16px; font-weight: 600; }
.login-brand small { color: var(--text-3); }
.login-lead, .login-foot { color: var(--text-2); }
.login-foot { font-size: 13px; color: var(--text-3); margin-top: 8px; }
.login-form { display: grid; gap: 12px; margin-top: 4px; }
.login-form label { display: grid; gap: 6px; color: var(--text-2); font-size: 13px; }
.login-form .btn { height: 46px; margin-top: 4px; }
.alert { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--negative) 12%, transparent); color: var(--negative); }

/* ---------- wider screens ---------- */
@media (min-width: 720px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .facts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chart-plot > .chart { height: 220px; }
  .chart-hits { height: 220px; }
  .content { padding: 32px 28px 48px; }
  .top { padding: 0 28px; }
  .staff-note { margin: 16px 28px 0; }
  .hero { padding: 26px; }
  .flow { grid-template-columns: 1fr 1fr; }
  .retention { grid-column: 1 / -1; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .donut-wrap { grid-template-columns: 240px 1fr; align-items: center; justify-items: start; }
  .bot-facts { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .range { grid-template-columns: 1fr 1fr auto; }
  .range .btn { grid-column: auto; }
  .offer { padding: 24px; }
  .offer-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tour-card { left: auto; right: 24px; bottom: 24px; width: 380px; }
}
@media (min-width: 1024px) {
  .side { top: var(--top-h); transform: none; z-index: 20; }
  .scrim, .menu-btn { display: none; }
  .main { margin-left: 264px; }
  .staff-note { margin: 16px 40px 0 304px; }
  .content { padding: 36px 40px 48px; }
  .top { padding: 0 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- small phones and long tables ---------- */
.breakdown .table-wrap { max-height: 460px; overflow: auto; }
.breakdown .table thead th { position: sticky; top: 0; z-index: 2; background: var(--card); }
.breakdown .table thead th:first-child { z-index: 3; }
@media (max-width: 479px) {
  .brand small { display: none; }
  .filters { grid-template-columns: 1fr; }
}

/* ---------- reference look: night grid, glow at the top, mono figures, serif headings ---------- */
:root, html[data-theme="dark"] {
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, "Roboto Mono", monospace;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --bg: #101213;
  --card: #161a1b;
  --raised: #1f2425;
  --grid-line: rgba(237, 237, 237, .035);
  --glow: rgba(47, 193, 179, .16);
}
html[data-theme="light"] {
  --grid-line: rgba(23, 23, 23, .04);
  --glow: rgba(15, 138, 128, .1);
}
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(90% 60% at 0% 0%, var(--glow), transparent 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
  background-attachment: fixed;
}
.top { background: color-mix(in srgb, var(--bg) 80%, transparent); }
.side { background: color-mix(in srgb, var(--side) 92%, transparent); }

h1 { font-size: 30px; font-weight: 600; }
.kpi-value, .hero-value, .fact dd, .top-pill, .table td.num, .table tfoot td, .flow-row b,
.retention b, .bot-facts dd, .tile strong, .legend b, .period-dates, .ticks, .chart-axis, .product-top b, .count {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.kpi-value { font-size: 30px; font-weight: 500; letter-spacing: -.02em; }
.hero-value { font-size: 52px; font-weight: 500; }
.hero-value, .kpi-value { white-space: nowrap; }
@media (max-width: 479px) { .kpi-value { font-size: 24px; } .hero-value { font-size: 40px; } }

.section-pick select { background: #0b0d0e; border-color: var(--line); }
html[data-theme="light"] .section-pick select { background: var(--card); }

.kpi, .panel, .period, .hero, .bot-row, .offer, .faq-group { border-radius: 20px; }
.kpi > summary { padding: 20px 16px 8px; }
.kpi .spark { height: 44px; margin-top: 8px; }
.spark-area { opacity: .1; }
.delta { font-family: var(--mono); }
.delta.up::before { content: "↑ "; }
.delta.down::before { content: "↓ "; }
.delta.up, .delta.down { white-space: nowrap; }

.serif, .connect h2.serif, .offer h2, .tour-done-card h2 { font-family: var(--serif); font-weight: 400; letter-spacing: 0; }
.serif { font-size: 26px; }

/* FAQ in light cards, like the reference */
html[data-theme="dark"] .faq-group { background: #f4f4f5; color: #171717; border-color: transparent; }
html[data-theme="dark"] .faq-group .faq-title small, html[data-theme="dark"] .faq-group .caret { color: #737373; }
html[data-theme="dark"] .faq-group .faq-item { border-top-color: rgba(23, 23, 23, .08); }
html[data-theme="dark"] .faq-group .faq-item p { color: #525252; }
html[data-theme="dark"] .faq-group .faq-icon::after { box-shadow: none; }

/* KPI cards: one fixed structure so every card in a row has the same height */
.kpis { align-items: stretch; }
.kpi { display: flex; flex-direction: column; }
.kpi > summary { flex: 1; grid-template-rows: auto auto auto 1fr auto; align-content: start; }
.kpi-top { flex-direction: column; flex-wrap: nowrap; gap: 6px; width: 100%; }
.kpi-title { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-top .delta, .kpi-top .delta-none { height: 20px; line-height: 18px; }
.delta-none { display: block; }
.kpi .spark, .kpi-rule { align-self: end; }
.kpi-rule { height: 44px; margin: 8px 0 0; background: none; border-bottom: 2px solid var(--tone); opacity: .8; }
