/* Stats Hub: tokens first, then layout. Light is the base; dark redefines the same tokens. */
:root {
  color-scheme: light;
  --bg: #eef0f4;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e1e2e6;
  --grid: #ebeae6;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #6f6e69;
  --accent: #2a78d6;
  --tiktok: #0f97a8;      /* validated pair (light): CVD ΔE ≥ 8, contrast ≥ 3:1 */
  --instagram: #b8327b;
  --good: #006300;
  --bad: #b42323;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.05), 0 4px 16px rgb(16 24 40 / 0.06);
  --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95;
  /* decorative headline cards (white text, all ≥ 4.5:1) */
  --g1: linear-gradient(135deg, #4f46e5, #7c3aed);
  --g2: linear-gradient(135deg, #1d4ed8, #0369a1);
  --g3: linear-gradient(135deg, #0f766e, #047857);
  --g4: linear-gradient(135deg, #be185d, #9d174d);
  --g5: linear-gradient(135deg, #c2410c, #9a3412);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1012;
    --surface-1: #1a1b1e;
    --surface-2: #25262a;
    --border: #2d2e33;
    --grid: #2a2b2f;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --accent: #3987e5;
    --tiktok: #17a6b8;    /* validated pair (dark) */
    --instagram: #bd3580;
    --good: #4cc24c;
    --bad: #f07272;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --seq-1: #104281; --seq-2: #184f95; --seq-3: #256abf; --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #9ec5f4;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1012; --surface-1: #1a1b1e; --surface-2: #25262a; --border: #2d2e33; --grid: #2a2b2f;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #9a998f;
  --accent: #3987e5; --tiktok: #17a6b8; --instagram: #bd3580; --good: #4cc24c; --bad: #f07272;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  --seq-1: #104281; --seq-2: #184f95; --seq-3: #256abf; --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #9ec5f4;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overscroll-behavior-y: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
h1, h2, h3 { letter-spacing: -0.01em; }
button, select { touch-action: manipulation; }

/* ---------- platform logos (Simple Icons, CC0), tinted with the platform color ---------- */
.pi {
  display: inline-block; width: 16px; height: 16px; flex: none; vertical-align: -3px; margin-right: 6px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
.pi.tiktok { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@16.33.0/icons/tiktok.svg"); color: var(--tiktok); }
.pi.instagram { --icon: url("https://cdn.jsdelivr.net/npm/simple-icons@16.33.0/icons/instagram.svg"); color: var(--instagram); }
.badge { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; }
.badge.tiktok { background: var(--tiktok); }
.badge.instagram { background: var(--instagram); }
.badge .pi { color: #fff; margin: 0; width: 18px; height: 18px; }
.badge.sm { width: 26px; height: 26px; border-radius: 8px; }
.badge.sm .pi { width: 14px; height: 14px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: calc(10px + var(--sat)) 24px 10px; background: var(--surface-1); border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--g1); }
.logo svg { width: 18px; height: 18px; fill: #fff; }
.tabs { display: flex; gap: 4px; }
.tabs a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--text-secondary); white-space: nowrap; }
.tabs a:hover { background: var(--surface-2); }
.tabs a.on { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sync { color: var(--text-muted); font-size: 12px; }
.lang { padding: 4px 8px; font-size: 12px; font-weight: 600; }

.banner {
  margin: 16px 24px 0; padding: 10px 14px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-secondary); border: 1px dashed var(--border);
}
.banner strong { color: var(--text-primary); }
.banner.warn { border-style: solid; border-left: 3px solid var(--bad); }
.banner.warn p { margin: 2px 0; }
.banner.offline { border-style: solid; border-left: 3px solid var(--text-muted); }
.link-btn { font: inherit; color: var(--accent); background: none; border: 0; padding: 0 0 0 8px; cursor: pointer; }
.link-btn:disabled { color: var(--text-muted); cursor: default; }
.link-btn svg { width: 20px; height: 20px; fill: currentColor; vertical-align: middle; }
#view.loading { opacity: 0.55; transition: opacity 0.15s; }

/* ---------- filters ---------- */
.filters { display: flex; gap: 12px; flex-wrap: wrap; padding: 16px 24px 0; }
.seg { display: inline-flex; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; padding: 3px; flex: none; }
.seg button {
  display: inline-flex; align-items: center; border: 0; background: none; color: var(--text-secondary); font: inherit;
  padding: 5px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.seg button .pi { margin-right: 6px; }
.seg button.on { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }
select {
  font: inherit; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 10px; padding: 5px 10px; max-width: 100%;
}

/* ---------- layout ---------- */
main { padding: 16px 24px 48px; display: grid; gap: 16px; max-width: 1440px; }
.card {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px 18px; min-width: 0; box-shadow: var(--shadow);
}
.card h2 { font-size: 15px; margin: 0 0 2px; }
.card .sub { color: var(--text-muted); font-size: 12px; margin: 0 0 12px; }
.row2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.chart { position: relative; height: 240px; }
.chart.small { height: 150px; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head h1 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 10px; }
.back { text-decoration: none; color: var(--text-secondary); font-size: 13px; }
.muted { color: var(--text-muted); }
.up { color: var(--good); }
.down { color: var(--bad); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; }

/* ---------- headline cards ---------- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi {
  position: relative; overflow: hidden; border-radius: 16px; padding: 16px 18px 14px; color: #fff; min-height: 128px;
  box-shadow: var(--shadow);
}
.kpi:nth-child(1) { background: var(--g1); }
.kpi:nth-child(2) { background: var(--g2); }
.kpi:nth-child(3) { background: var(--g3); }
.kpi:nth-child(4) { background: var(--g4); }
.kpi:nth-child(5) { background: var(--g5); }
.kpi .label { font-size: 13px; opacity: 0.92; }
.kpi .value { font-size: 30px; font-weight: 750; letter-spacing: -0.02em; margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kpi .delta { font-size: 12px; opacity: 0.92; }
.kpi .delta b { font-weight: 700; }
.kpi svg.spark { position: absolute; right: 12px; top: 12px; opacity: 0.85; }
.pill {
  display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: 0; padding: 2px 8px; border-radius: 99px;
  background: rgb(255 255 255 / 0.2); color: #fff; vertical-align: middle;
}
.card .pill { background: var(--surface-2); color: var(--text-secondary); }
.card .pill.up { color: var(--good); }
.card .pill.down { color: var(--bad); }

/* ---------- platform panels ---------- */
.platform { border-top: 3px solid var(--pf); }
.platform.tiktok { --pf: var(--tiktok); }
.platform.instagram { --pf: var(--instagram); }
.platform .head { margin-bottom: 12px; }
.platform h2 { font-size: 16px; }
.minis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.mini { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.mini .v { font-size: 20px; font-weight: 700; }
.mini .l { font-size: 11px; color: var(--text-muted); }
.mini .d { font-size: 11px; }

/* ---------- goals (Creator Rewards) ---------- */
.goal-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.goal { display: block; color: inherit; text-decoration: none; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.goal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.goal-head small { color: var(--text-muted); }
.goal-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 12px; margin-top: 6px; }
.goal-row .goal-num { color: var(--text-secondary); }
.goal-row .track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--surface-1); overflow: hidden; }
.goal-row .track i { display: block; height: 100%; border-radius: 4px; background: var(--tiktok); }
.chip.ok { background: var(--good); color: #fff; }

/* ---------- channels ---------- */
.channels { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.channel-card h3 { margin: 0; font-size: 15px; }
.channel-card .total { color: var(--text-muted); font-size: 12px; margin-bottom: 8px; }
.acc-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 8px; margin: 0 -8px; border-radius: 10px; cursor: pointer; text-decoration: none;
}
.acc-row:hover { background: var(--surface-2); }
.who { min-width: 0; }
.who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--text-muted); }
.num { text-align: right; }
.num b { display: block; }
.num small { font-size: 11px; }

/* ---------- ranking (phone) ---------- */
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 22px auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--grid); cursor: pointer; }
.rank li:last-child { border-bottom: 0; }
.rank .n { color: var(--text-muted); font-weight: 600; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
th { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
th.sort { cursor: pointer; user-select: none; }
th.sort:hover { color: var(--text-primary); }
th.sort.on::after { content: " ↓"; }
th.sort.on.asc::after { content: " ↑"; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--surface-2); }
td.title { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.acc { display: inline-flex; align-items: center; gap: 2px; }
.acc small { color: var(--text-muted); margin-left: 4px; }
.chip { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-secondary); white-space: nowrap; }

/* top posts: cover + bar */
.post-cell { display: flex; align-items: center; gap: 10px; }
.thumb {
  width: 36px; height: 48px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface-2);
  display: inline-grid; place-items: center;
}
.thumb.lg { width: 52px; height: 70px; border-radius: 8px; }
.thumb.xl { width: 72px; height: 96px; border-radius: 10px; }
.thumb .pi { margin: 0; }
.bar { display: flex; align-items: center; gap: 8px; }
.bar .track { width: 84px; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; flex: none; }
.bar .track i { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.bar .track i.tiktok { background: var(--tiktok); }
.bar .track i.instagram { background: var(--instagram); }

/* post cards (phone) */
.post-cards { display: grid; gap: 10px; }
.post-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px; margin: 0 -6px; border-radius: 14px; cursor: pointer;
}
.post-card:active { background: var(--surface-2); }
.pc-main { min-width: 0; }
.pc-title { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pc-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pc-stats { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.pc-stats span { display: inline-flex; align-items: center; gap: 4px; }
.pc-stats svg { width: 13px; height: 13px; fill: currentColor; opacity: 0.8; }
.pc-views { text-align: right; }
.pc-views b { display: block; font-size: 17px; }
.pc-views small { color: var(--text-muted); font-size: 11px; }

/* ---------- post sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / 0.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  position: relative; width: 100%; max-width: 600px; max-height: 92vh; overflow-y: auto; background: var(--surface-1);
  border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + var(--sab)); box-shadow: 0 -8px 40px rgb(0 0 0 / 0.25);
  animation: sheet-up 0.22s ease-out;
}
@keyframes sheet-up { from { transform: translateY(24px); } to { transform: none; } }
.sheet-close {
  position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: var(--surface-2); color: var(--text-primary); font-size: 22px; line-height: 1; cursor: pointer;
}
.sheet-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; padding-right: 36px; }
.sheet-head h3 { margin: 0 0 4px; font-size: 16px; }
.sheet-head .meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.metrics .mini .v { font-size: 17px; }
.sheet .chart { height: 180px; }
.sheet .btn { width: 100%; text-align: center; text-decoration: none; display: block; margin-top: 12px; }
@media (min-width: 721px) {
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: 20px; max-height: 86vh; }
}

/* ---------- legend ---------- */
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin: -4px 0 8px; }
.legend span { display: inline-flex; align-items: center; }

/* ---------- heatmap ---------- */
.heat { display: grid; gap: 2px; font-size: 11px; color: var(--text-muted); overflow-x: auto; }
.heat .cell { height: 30px; border-radius: 4px; background: var(--surface-2); }
.heat .h { text-align: center; }
.heat .d { padding-right: 6px; align-self: center; }
.scale { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); margin-top: 10px; flex-wrap: wrap; }
.scale i { width: 22px; height: 10px; border-radius: 2px; display: inline-block; }
.callout { font-size: 13px; color: var(--text-secondary); margin: 0 0 12px; }
.callout b { color: var(--text-primary); }

/* ---------- settings ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 560px; }
.switch-row small { display: block; color: var(--text-muted); font-size: 12px; }
.switch {
  position: relative; flex: none; width: 44px; height: 26px; padding: 0; border: 0; border-radius: 99px;
  background: var(--border); cursor: pointer; transition: background 0.15s;
}
.switch span {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.15s;
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.channel { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--grid); }
.channel:last-child { border-bottom: 0; }
.channel .name { font-weight: 600; min-width: 140px; }
.channel .accs { display: flex; gap: 14px; flex-wrap: wrap; flex: 1; }
.form { display: grid; gap: 14px; max-width: 520px; }
.form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.form label span { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.form input {
  font: inherit; font-weight: 400; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; width: 100%;
}
.form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn {
  font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 9px 16px; cursor: pointer;
  background: var(--accent); color: #fff; justify-self: start;
}
a.btn { text-decoration: none; display: inline-block; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.ghost { background: none; color: var(--text-secondary); border: 1px solid var(--border); font-weight: 400; padding: 5px 12px; }
.btn.ghost:hover { color: var(--text-primary); border-color: var(--text-muted); }
.btn.ghost.danger:hover { color: var(--bad); border-color: var(--bad); }
.msg { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.msg.err { border-left: 3px solid var(--bad); }
.msg.ok { border-left: 3px solid var(--good); }
.help { color: var(--text-secondary); font-size: 13px; margin: 0 0 14px; }
ol.help { padding-left: 20px; }
ol.help li { margin-bottom: 4px; }
.phone-url {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0;
}
.phone-url code { background: var(--surface-2); padding: 6px 10px; border-radius: 8px; font-size: 13px; word-break: break-all; }
.qr { display: inline-block; background: #fff; padding: 10px; border-radius: 12px; line-height: 0; margin: 6px 0 12px; }
.qr svg { width: 180px; height: 180px; }
.steps { display: grid; gap: 8px; }
.phone-grid { display: grid; gap: 18px; grid-template-columns: auto minmax(0, 1fr); align-items: start; }

/* ---------- online version: password screen ---------- */
body.locked .filters, body.locked .bottom-nav, body.locked .tabs, body.locked .top-right,
body.locked #demo-banner, body.locked #sync-errors { display: none !important; }
.unlock { max-width: 420px; width: 100%; margin: 32px auto 0; padding: 28px 24px; }
.unlock h2 { font-size: 20px; margin: 14px 0 4px; }
.logo.big { width: 52px; height: 52px; border-radius: 15px; }
.logo.big svg { width: 30px; height: 30px; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form label.check input { width: auto; }

.empty { text-align: center; padding: 48px 16px; color: var(--text-secondary); }
.empty code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

.tip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; box-shadow: 0 4px 16px rgb(0 0 0 / 0.12);
}

/* ---------- pull to refresh ---------- */
.ptr { position: fixed; top: calc(8px + var(--sat)); left: 50%; z-index: 30; transform: translate(-50%, -60px); transition: transform 0.15s; pointer-events: none; }
.ptr-spinner {
  display: block; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent);
  background: var(--surface-1); box-shadow: var(--shadow);
}
.ptr.busy .ptr-spinner { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- bottom navigation (phone) ---------- */
.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  grid-template-columns: repeat(4, 1fr); background: var(--surface-1); border-top: 1px solid var(--border);
  padding: 6px 0 calc(6px + var(--sab));
}
.bottom-nav a { display: grid; justify-items: center; gap: 2px; text-decoration: none; color: var(--text-muted); font-size: 11px; padding: 4px 0; min-height: 44px; }
.bottom-nav svg { width: 22px; height: 22px; fill: currentColor; }
.bottom-nav a.on { color: var(--accent); font-weight: 600; }

@media (min-width: 721px) { .only-phone { display: none !important; } }
@media (max-width: 720px) {
  .only-desktop { display: none !important; }
  .top { padding: calc(10px + var(--sat)) 16px 10px; gap: 10px; }
  .tabs { display: none; }
  .top-right { margin-left: auto; gap: 6px; }
  .sync { display: inline-flex; align-items: center; font-size: 11px; }
  .link-btn { padding: 8px; }
  .banner { margin: 12px 16px 0; }
  .filters { padding: 12px 16px 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  main { padding: 12px 16px calc(84px + var(--sab)); }
  .row2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { min-height: 112px; padding: 14px 14px 12px; }
  .kpi .value { font-size: 24px; }
  .kpi svg.spark { display: none; }
  .minis { grid-template-columns: 1fr 1fr; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .channels { grid-template-columns: 1fr; }
  .goal-grid { grid-template-columns: 1fr; }
  .bottom-nav { display: grid; }
  .toolbar h2.grow { flex: 1 1 100%; }
  #post-cat { flex: 1 1 100%; min-width: 0; }  /* long category names: the menu takes its own line */
  .phone-grid { grid-template-columns: 1fr; }
  .qr { margin: 0 auto 12px; display: block; width: max-content; }
}
