:root {
  --bg: #fafafa;
  --card: #ffffff;
  --border: #ececec;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #5b21b6;
  --accent-soft: #ede9fe;
  --bar: #e5e1f6;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

/* ----------- topbar ----------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.brand-sub { color: var(--muted); font-weight: 400; }

/* ----- live visitors badge ----- */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #d1fae5;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  margin-left: 4px;
}
.live-badge:hover { background: #d1fae5; border-color: #a7f3d0; }
.live-badge.is-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }
.live-badge.is-active .live-dot { background: var(--accent); }
.live-badge.is-active .live-dot::after { background: var(--accent); }
.live-label { color: inherit; font-weight: 400; opacity: 0.85; }

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  position: relative;
  flex-shrink: 0;
}
.live-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: #22c55e;
  opacity: 0.5;
  animation: live-pulse 1.6s ease-out infinite;
}
@keyframes live-pulse {
  0%   { transform: scale(0.6); opacity: 0.55; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ----- per-account topbar bits (logo link + account switcher) ----- */
.logo-link { display: inline-flex; align-items: center; flex-shrink: 0; }
.site-favicon { border-radius: 4px; flex-shrink: 0; }

.account-switcher { position: relative; }
.account-switcher-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.account-switcher-trigger:hover { border-color: var(--accent); background: var(--accent-soft); }
.account-switcher-trigger .chevron {
  font-size: 10px;
  color: var(--muted);
  line-height: 1;
  transition: transform 0.15s ease;
}
.account-switcher.is-open .chevron { transform: rotate(180deg); }
.account-switcher-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account-switcher-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  min-width: 220px;
  max-width: calc(100vw - 24px);
  max-height: 70vh;
  overflow-y: auto;
  z-index: 50;
  padding: 4px;
  display: none;
  flex-direction: column;
}
.account-switcher.is-open .account-switcher-popover { display: flex; }
.account-switcher-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
}
.account-switcher-item:hover { background: rgba(0, 0, 0, 0.04); }
.account-switcher-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.account-switcher-favicon { border-radius: 4px; flex-shrink: 0; }
.account-switcher-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-switcher-all { color: var(--muted); font-weight: 500; justify-content: center; }
.account-switcher-all:hover { color: var(--text); }

/* ----- mobile burger (hidden on desktop) ----- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 36px;
  padding: 0 9px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.nav-toggle-bar { display: block; height: 2px; background: var(--text); border-radius: 1px; }

/* ----------- accounts index page ----------- */
.accounts { max-width: 980px; margin: 0 auto; padding: 32px 24px; }
.accounts-head { margin-bottom: 20px; }
.accounts-head h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.accounts-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.account-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  transform: translateY(-1px);
}
.account-favicon { border-radius: 6px; flex-shrink: 0; }
.account-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-name { font-weight: 600; font-size: 15px; }
.account-url {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.accounts-empty { margin-top: 40px; }
.accounts-empty code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* edit affordance — revealed on card hover/focus */
.account-card-wrap { position: relative; }
.account-edit {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.account-card-wrap:hover .account-edit,
.account-edit:focus { opacity: 1; }
.account-edit:hover { color: var(--accent); border-color: var(--accent); }

/* "+ Add a site" card */
.account-add {
  justify-content: center;
  gap: 8px;
  border-style: dashed;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.account-add:hover { background: var(--accent-soft); }
.account-add-icon { font-size: 20px; line-height: 1; }

/* create/edit modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.4);
}
.modal-overlay[hidden],
.modal-field[hidden] { display: none; }
.modal-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.modal-card h2 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-card label,
.modal-field { display: flex; flex-direction: column; gap: 6px; }
.modal-card label > span,
.modal-field > span { font-size: 12px; font-weight: 500; color: var(--muted); }
.modal-card input {
  width: 100%;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.modal-card input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.modal-card input[readonly] { background: #f3f4f6; color: var(--muted); }
.kk-id-field { display: flex; gap: 8px; }
.kk-id-field input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.modal-field small { color: var(--muted); font-size: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ----- realtime mode selector (replaces the date picker) ----- */
.realtime-selector { position: relative; }

.realtime-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ecfdf5;
  border: 1px solid #d1fae5;
  color: #047857;
  border-radius: var(--radius);
  padding: 5px 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.realtime-trigger:hover { background: #d1fae5; border-color: #a7f3d0; }
.realtime-trigger .chevron {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.15s ease;
  line-height: 1;
}
.realtime-selector.is-open .chevron { transform: rotate(180deg); }

.realtime-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  min-width: 180px;
  z-index: 50;
  padding: 4px;
  display: none;
  flex-direction: column;
}
.realtime-selector.is-open .realtime-popover { display: flex; }

.realtime-item {
  display: block;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
}
.realtime-item:hover { background: rgba(0,0,0,0.04); }
.realtime-item.active {
  background: #ecfdf5;
  color: #047857;
  font-weight: 500;
}
.realtime-item.realtime-exit { color: var(--muted); }
.realtime-item.realtime-exit:hover { color: var(--text); }

.popover-separator { height: 1px; background: var(--border); margin: 4px 4px; }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.date-range {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  min-width: 200px;
}
.date-range:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* ----- date-range presets (left panel of the flatpickr calendar) ----- */
.flatpickr-calendar.has-presets.open { display: flex; width: auto; }
.fp-presets {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-right: 1px solid var(--border);
  min-width: 132px;
}
.fp-preset {
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 4px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.fp-preset:hover { background: rgba(0, 0, 0, 0.04); }
.fp-preset.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* ----- add-filter popover ----- */
.add-filter { position: relative; }
.add-filter-btn {
  background: var(--card);
  border: 1px dashed #c8c4d4;
  color: var(--accent);
  border-radius: var(--radius);
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.add-filter-btn:hover { border-color: var(--accent); background: var(--accent-soft); }

.add-filter-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  padding: 12px;
  min-width: 280px;
  z-index: 50;
  display: none;             /* hidden by default — class toggle reveals it */
  flex-direction: column;
  gap: 10px;
}
.add-filter-popover.is-open { display: flex; }

.popover-row { display: flex; flex-direction: column; gap: 4px; }
.popover-row label { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; }
.popover-row select,
.popover-row input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 8px;
  font-size: 13px;
  width: 100%;
  font-family: inherit;
}
.popover-row select:disabled,
.popover-row input:disabled { background: #f3f4f6; color: var(--muted); }
.popover-actions { display: flex; justify-content: flex-end; gap: 6px; }
.btn-primary, .btn-ghost {
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: #4c1d95; }
.btn-ghost:hover { background: rgba(0,0,0,0.03); }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
}
.filter-chip .x { cursor: pointer; opacity: 0.6; }
.filter-chip .x:hover { opacity: 1; }

/* ----------- layout ----------- */
.dashboard {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ----------- KPI ----------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 900px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .kpi-row { grid-template-columns: 1fr; } }

.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: #c8c4d4; }
.kpi.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.kpi.active .kpi-value { color: var(--accent); }
.kpi-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ----------- chart ----------- */
.chart-card { padding: 20px; }
.chart-wrap { height: 280px; position: relative; }
.chart-wrap-tall { height: 340px; }

/* Loading overlay: dim the existing chart and float a centered label on top.
   Used while a refresh is in flight; the canvas keeps its previous render so
   the user retains context until the new data arrives. */
.chart-wrap.is-loading > canvas { opacity: 0.35; transition: opacity 120ms; }
.chart-wrap.is-loading::after {
  content: "Loading…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--muted);
  pointer-events: none;
}

.chart-type-select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.chart-type-select:hover { color: var(--text); border-color: #c8c4d4; }
.chart-type-select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.tabs { display: flex; gap: 4px; }
.tab {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.tab.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }

/* ----- breakdown card tabs (inside .card-head) ----- */
.card-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tab-btn {
  background: transparent;
  border: none;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.tab-btn:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.tab-btn.active { background: var(--accent-soft); color: var(--accent); }

.breakdown-card .card-head {
  align-items: flex-start;
  gap: 12px;
}
.breakdown-card .card-title { flex-shrink: 0; }

/* ----------- breakdown grid ----------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

.top-list-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 200px;
}
.top-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
}
.top-row:hover { background: rgba(0,0,0,0.02); }
.top-row .bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--bar);
  z-index: 0;
}
.top-row .label,
.top-row .value {
  position: relative;
  z-index: 1;
  font-size: 13px;
}
.top-row .label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 12px;
  max-width: 80%;
}
.top-row .value { color: var(--muted); font-variant-numeric: tabular-nums; }

.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 0; }

/* ----- world map (Countries breakdown) ----- */
/* Bleed past the card's 18px horizontal padding so the map fills edge to edge. */
.world-map {
  height: 280px;
  width: calc(100% + 36px);
  margin-left: -18px;
  margin-right: -18px;
}
.jvm-tooltip {
  background: #1f2937 !important;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ----- user menu dropdown ----- */
.user-menu {
  position: relative;
  padding-left: 10px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
}
.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  padding: 5px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.user-menu-trigger:hover { background: rgba(0,0,0,0.04); }
.user-menu-trigger .chevron {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.15s ease;
  line-height: 1;
}
.user-menu.is-open .user-menu-trigger { background: rgba(0,0,0,0.04); }
.user-menu.is-open .chevron { transform: rotate(180deg); }
.user-name { color: inherit; }

.user-menu-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  min-width: 160px;
  z-index: 50;
  padding: 4px;
  display: none;
  flex-direction: column;
}
.user-menu.is-open .user-menu-popover { display: flex; }

.user-menu-item {
  display: block;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
}
.user-menu-item:hover { background: rgba(0,0,0,0.04); }

/* ----------- login page ----------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 360px;
  max-width: 92vw;
  box-shadow: 0 4px 20px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.login-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.login-card input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  text-transform: none;
  color: var(--text);
  letter-spacing: normal;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.login-card button[type="submit"] {
  margin-top: 6px;
  padding: 9px 12px;
  font-size: 14px;
}
.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
}

/* ===================================================================
   Responsive — mobile header
   On narrow screens the topbar wraps: brand (logo + live badge +
   switcher) and the burger stay on the first row; the controls collapse
   into a full-width panel revealed by the burger (#navToggle). Popovers
   inside that panel go static + full-width so they never clip off-screen
   (fixes the "+ Filter" popover that was cut off on the left).
   =================================================================== */
@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 8px; }

  .brand { flex: 1 1 auto; min-width: 0; gap: 8px; }
  .logo { width: 44px; height: auto; }
  .live-label { display: none; }                 /* keep just the dot + count */
  .account-switcher { min-width: 0; }
  .account-switcher-trigger { max-width: 42vw; }

  .nav-toggle { display: flex; }

  /* Controls collapse behind the burger and stack full-width when open. */
  .controls {
    display: none;
    flex-basis: 100%;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .controls.is-open { display: flex; }

  .filters { width: 100%; }
  .add-filter,
  .add-filter-btn,
  .date-range,
  .realtime-selector,
  .realtime-trigger,
  .user-menu,
  .user-menu-trigger { width: 100%; }
  .date-range { min-width: 0; }
  .add-filter-btn,
  .realtime-trigger { justify-content: center; }
  .user-menu {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }
  .user-menu-trigger { justify-content: space-between; border-color: var(--border); }

  /* Inline the in-panel popovers so they expand the panel instead of
     overflowing the viewport. */
  .add-filter-popover,
  .user-menu-popover,
  .realtime-popover {
    position: static;
    width: 100%;
    min-width: 0;
    box-shadow: none;
    margin-top: 4px;
  }

  /* The switcher stays in the brand row, so clamp its popover to the viewport. */
  .account-switcher-popover { min-width: 180px; max-width: calc(100vw - 32px); }

  /* Flatpickr presets stack above the calendar so the picker fits a phone. */
  .flatpickr-calendar.has-presets.open { flex-direction: column; }
  .fp-presets {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-width: 0;
  }
}
.top-list-body {
    width: 100%;
    height: 100%; /* Or calc(100% - header_height) */
    position: relative;
    display: flex;
    flex-direction: column;
}

/* If the library injects an <svg> tag, make it responsive */
.top-list-body svg {
    width: 100%;
    height: 100%;
}
