/* ──────────────────────────────────────────────────────────────────
   Statly App — electric tech dark theme.
   Matches landing: Geist sans throughout, indigo/violet accent,
   mono-tabular numbers for data, sharp lines, no serif anywhere.
   ────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700;800&family=Geist+Mono:wght@400;500&display=swap');

:root {
  --bg:           #06060a;
  --bg-1:         #0b0b12;
  --bg-2:         #11111a;
  --surface:      #14141d;
  --surface-hi:   #1c1c28;
  --surface-2:    #22222e;

  --line:         rgba(255, 255, 255, 0.06);
  --line-strong:  rgba(255, 255, 255, 0.10);
  --line-hi:      rgba(255, 255, 255, 0.18);

  --text:         #ffffff;
  --text-muted:   #a0a0ad;
  --text-dim:     #5e5e6e;

  --accent:       #6366f1;
  --accent-hi:    #818cf8;
  --accent-deep:  #4f46e5;
  --accent-glow:  rgba(99, 102, 241, 0.55);
  --accent-soft:  rgba(99, 102, 241, 0.12);

  --live:         #10b981;
  --warn:         #f59e0b;
  --danger:       #ef4444;

  /* Compat shims for class names used in app.js / legacy CSS */
  --brand:        #6366f1;
  --primary:      #6366f1;
  --brand-lt:     rgba(99, 102, 241, 0.14);
  --dark:         #ffffff;
  --muted:        #a0a0ad;
  --muted2:       #5e5e6e;
  --border:       rgba(255, 255, 255, 0.08);
  --surface-color:#14141d;
  --white:        #14141d;
  --green:        #10b981;
  --red:          #ef4444;

  --radius:       10px;
  --sidebar-w:    240px;
  --shadow-sm:    0 1px 0 rgba(255, 255, 255, 0.02);
  --shadow:       0 24px 60px -28px rgba(0, 0, 0, 0.7);

  --sans:  'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:  'Geist Mono', ui-monospace, SFMono-Regular, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: var(--text); }
input::placeholder { color: var(--text-dim); }
code, pre { font-family: var(--mono); font-size: 0.85em; }

::selection { background: var(--accent); color: #fff; }

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ──────────────────────────────────────────────────────────────────
   AUTH
   ────────────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(ellipse 700px 400px at 50% 10%, var(--accent-soft), transparent 70%),
    var(--bg);
}

.auth-logo {
  margin-bottom: 2.5rem;
  display: flex; justify-content: center;
  align-items: center; gap: 9px;
}
.auth-logo svg { display: none; }
.auth-logo::before {
  content: '';
  width: 18px; height: 18px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  position: relative;
  box-shadow: 0 0 14px var(--accent-glow);
}
.auth-logo::after {
  content: 'Statly';
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--text);
}

.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.auth-form { padding: 2rem 2rem 1.75rem; display: flex; flex-direction: column; gap: 1.1rem; }

.auth-card-intro { margin-bottom: 0.5rem; text-align: center; }
.auth-card-intro h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.022em;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.auth-card-intro p { font-size: 0.875rem; color: var(--text-muted); }

.auth-sent-icon { font-size: 2.5rem; text-align: center; }
.auth-form h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  text-align: center;
}
.auth-form > p {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.55;
}
.auth-hint { font-size: 0.78rem; color: var(--text-dim) !important; }

/* ──────────────────────────────────────────────────────────────────
   form fields
   ────────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.field input {
  width: 100%; padding: 0.7rem 0.9rem;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-submit {
  padding: 0.72rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: all 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 0 0 1px var(--accent-deep), 0 6px 18px -6px var(--accent-glow);
}
.btn-submit:hover {
  background: var(--accent-hi);
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px var(--accent-deep), 0 8px 22px -6px var(--accent-glow);
}
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-text { display: inline-flex; align-items: center; gap: 0.4rem; }
.btn-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg, .auth-err {
  font-size: 0.82rem;
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.20);
  border-radius: 7px;
  padding: 0.55rem 0.75rem;
  line-height: 1.5;
}

.link-btn {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none; padding: 0;
}
.link-btn:hover { color: var(--text); }

/* ──────────────────────────────────────────────────────────────────
   ONBOARDING
   ────────────────────────────────────────────────────────────────── */
.ob-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem 1.25rem;
}

.ob-step {
  width: 100%; max-width: 560px;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 2.25rem;
  box-shadow: var(--shadow);
}

.ob-step-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.ob-step h2 {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.ob-step > p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.ob-tip {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 0 7px 7px 0;
  padding: 0.75rem 0.9rem;
  margin-top: 1rem;
  line-height: 1.55;
}
.ob-tip strong { color: var(--text); font-weight: 500; }

/* ──────────────────────────────────────────────────────────────────
   snippet / code
   ────────────────────────────────────────────────────────────────── */
.snippet-wrap { position: relative; }
.code-snippet {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.65;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}

.copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: var(--surface-hi);
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  font-size: 0.72rem;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  transition: all 0.15s;
}
.copy-btn:hover { background: var(--accent); color: #fff; }
.copy-btn.copied { background: var(--live); color: #fff; }

/* ──────────────────────────────────────────────────────────────────
   DASHBOARD layout
   ────────────────────────────────────────────────────────────────── */
#screen-dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 1.5rem 1rem 1.5rem 1.5rem;
}

.sidebar-top { display: flex; flex-direction: column; gap: 1.25rem; }
.sidebar-bottom {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 0.6rem;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 0.5rem;
}
.sidebar-logo svg { display: none; }
.sidebar-logo::before {
  content: '';
  width: 18px; height: 18px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  box-shadow: 0 0 10px var(--accent-glow);
}
.sidebar-logo::after {
  content: 'Statly';
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--text);
}

.add-site-btn {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  text-align: left;
  padding: 0.55rem 0.7rem;
  color: var(--text-muted);
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  transition: all 0.15s;
}
.add-site-btn:hover {
  color: var(--accent-hi);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.site-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 0.5rem; }

.site-item {
  display: flex; align-items: center; gap: 9px;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  font-size: 0.86rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.site-item:hover { background: var(--surface); color: var(--text); }
.site-item.active { background: var(--surface); color: var(--text); }
.site-item.active .site-dot { background: var(--accent); box-shadow: 0 0 6px var(--accent); }

.site-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.user-email {
  font-size: 0.78rem;
  color: var(--text-dim);
  word-break: break-all;
  font-family: var(--mono);
}

.dash-main {
  flex: 1;
  padding: 2rem 2.25rem 4rem;
  min-width: 0;
}

/* ──────────────────────────────────────────────────────────────────
   topbar
   ────────────────────────────────────────────────────────────────── */
.dash-topbar { margin-bottom: 1.5rem; }
.dash-title-row {
  display: flex; flex-direction: column;
  align-items: flex-start; gap: 0.4rem;
}

.dash-title {
  font-size: clamp(2rem, 3vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.028em;
  line-height: 1.05;
  color: var(--text);
}

.dash-subtitle { font-size: 0.82rem; color: var(--text-muted); }
.dash-subtitle-row { display: flex; align-items: center; gap: 0.7rem; }

.script-status {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: opacity 0.15s;
}
.script-status:hover { opacity: 0.75; }
.script-status::before {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
}
.script-status.status-active   { color: var(--live);     border-color: rgba(16, 185, 129, 0.25); background: rgba(16, 185, 129, 0.06); }
.script-status.status-inactive { color: var(--warn);     border-color: rgba(245, 158, 11, 0.25); background: rgba(245, 158, 11, 0.06); }
.script-status.status-none     { color: var(--text-dim); border-color: var(--line); }

.dash-empty-status { margin: 0.25rem 0 0.75rem; pointer-events: none; }

/* ──────────────────────────────────────────────────────────────────
   primary tabs
   ────────────────────────────────────────────────────────────────── */
.dash-tabs {
  display: flex; gap: 0; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.dash-tab {
  position: relative;
  padding: 0.7rem 1rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  transition: color 0.15s;
}
.dash-tab:first-child { padding-left: 0; }
.dash-tab:hover { color: var(--text-muted); }
.dash-tab.active { color: var(--text); }
.dash-tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 1rem;
  bottom: -1px;
  height: 1.5px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.dash-tab:first-child.active::after { left: 0; }

.tab-panel { width: 100%; }
.tab-section {
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 2rem 2.25rem;
  max-width: 760px;
}
.tab-intro {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.tab-intro code {
  background: var(--bg-2);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.86em;
  color: var(--accent);
}

#range-picker-wrap { margin-bottom: 1.75rem; }

.range-tabs {
  display: inline-flex; gap: 2px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px;
}
.range-tab {
  font-family: var(--mono);
  padding: 0.35rem 0.75rem;
  border-radius: 5px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  transition: all 0.15s;
}
.range-tab:hover { color: var(--text-muted); }
.range-tab.active { background: var(--surface-hi); color: var(--text); }
.range-tab-cal { padding: 0.35rem 0.55rem; line-height: 0; }

.range-picker { position: relative; }

.custom-range-popover {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 200;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1rem;
  min-width: 280px;
}
.crp-row { display: flex; align-items: flex-end; gap: 0.5rem; margin-bottom: 0.75rem; }
.crp-sep { color: var(--text-dim); padding-bottom: 0.45rem; }
.crp-field { flex: 1; }
.crp-field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}
.crp-field input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
}
.crp-field input:focus { outline: none; border-color: var(--accent); }
.crp-field input::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

.crp-apply-btn {
  width: 100%;
  padding: 0.55rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 0 0 1px var(--accent-deep);
}
.crp-apply-btn:hover { background: var(--accent-hi); }

/* ──────────────────────────────────────────────────────────────────
   states
   ────────────────────────────────────────────────────────────────── */
.dash-loading {
  display: flex; justify-content: center; align-items: center;
  min-height: 40vh;
}
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.dash-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 40vh; text-align: center; gap: 0.85rem;
  padding: 2rem;
}
.empty-icon { font-size: 2.5rem; filter: grayscale(1) opacity(0.5); }
.dash-empty h3 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.dash-empty p { color: var(--text-muted); font-size: 0.92rem; max-width: 420px; }

.dash-cap-notice {
  margin: 0 0 1.25rem; padding: 0.7rem 0.95rem;
  background: rgba(245, 158, 11, 0.08);
  color: var(--warn);
  border: 1px solid rgba(245, 158, 11, 0.20);
  border-radius: 8px;
  font-size: 0.85rem; line-height: 1.45;
}

/* ──────────────────────────────────────────────────────────────────
   KPI cards — tighter, denser
   ────────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 8px;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.9rem 1rem;
  position: relative;
  transition: border-color 0.2s;
  overflow: hidden;
}
.kpi-card:hover { border-color: var(--line-strong); }
.kpi-card:first-child {
  border-color: rgba(99, 102, 241, 0.25);
}
.kpi-card:first-child::before {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.kpi-label {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.45rem;
}

.kpi-val {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.022em;
  color: var(--text);
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.kpi-card:first-child .kpi-val { color: var(--accent-hi); }

.kpi-val-row { display: flex; align-items: baseline; gap: 0.3rem; }
.kpi-unit {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 400;
}

.kpi-subtext {
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.kpi-subtext .bot-dot {
  display: inline-block;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-dim);
  vertical-align: middle; margin-right: 0.4rem;
}

.live-dot {
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--live);
  margin-right: 0.4rem; vertical-align: middle;
  position: relative;
  box-shadow: 0 0 6px var(--live);
  animation: live-pulse-dot 2.5s ease-in-out infinite;
}
.live-dot::after {
  content: ''; position: absolute; inset: -3px;
  border-radius: 50%;
  background: var(--live); opacity: 0.3;
  animation: live-pulse-ring 2.5s ease-in-out infinite;
}
@keyframes live-pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}
@keyframes live-pulse-ring {
  0%   { transform: scale(0.5); opacity: 0.4; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* ──────────────────────────────────────────────────────────────────
   chart card
   ────────────────────────────────────────────────────────────────── */
.chart-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.2rem 1.3rem 1rem;
  margin-bottom: 1.25rem;
}

.chart-legend { display: flex; gap: 0.25rem; margin-bottom: 1rem; }
.chart-metric {
  font-family: var(--mono);
  padding: 0.3rem 0.7rem;
  border-radius: 5px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  transition: all 0.15s;
}
.chart-metric:hover { color: var(--text-muted); }
.chart-metric.active { color: var(--accent-hi); background: var(--accent-soft); }

.chart-container { width: 100%; position: relative; }
.chart-container svg { width: 100%; display: block; }

.chart-labels {
  display: flex; justify-content: space-between;
  margin-top: 0.5rem; padding: 0 2px;
}
.chart-labels span {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--text-dim);
}

/* ──────────────────────────────────────────────────────────────────
   shared panel chrome
   ────────────────────────────────────────────────────────────────── */
.panel-title {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.panel-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 0.9rem;
}

/* ──────────────────────────────────────────────────────────────────
   AI Insights — compact inline card on Statistik
   ────────────────────────────────────────────────────────────────── */
.insights-inline {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 9px;
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: border-color 0.2s;
}
.insights-inline:hover { border-color: var(--line-strong); border-left-color: var(--accent); }

.insights-inline-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 0.95rem 0.7rem 0.85rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.insights-inline-title {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.88rem; font-weight: 500;
  color: var(--text);
}
.ai-glyph {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  box-shadow: 0 0 8px var(--accent-glow);
  position: relative;
  flex-shrink: 0;
}
.ai-glyph::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 2px;
}
.insights-inline-meta {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 1;
  text-align: right;
  padding-right: 0.5rem;
}
.insights-inline-actions { display: flex; gap: 0.5rem; }

.insights-inline-notice {
  margin: 0 0.95rem 0.85rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 6px;
  line-height: 1.5;
}
.insights-inline-notice.is-stale   { background: rgba(245, 158, 11, 0.08); color: var(--warn);   border: 1px solid rgba(245, 158, 11, 0.2); }
.insights-inline-notice.is-error   { background: rgba(239, 68, 68, 0.08);  color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.insights-inline-notice.is-pending { background: rgba(16, 185, 129, 0.08); color: var(--live);   border: 1px solid rgba(16, 185, 129, 0.2); }

.insights-inline-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
  line-height: 1.65;
  color: var(--text);
  font-size: 0.9rem;
  max-width: 820px;
}
.insights-inline-body h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  margin: 1.4rem 0 0.55rem;
  color: var(--text);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}
.insights-inline-body h2:first-child { margin-top: 0; }
.insights-inline-body h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1rem 0 0.4rem;
}
.insights-inline-body p { margin: 0 0 0.8rem; }
.insights-inline-body ul,
.insights-inline-body ol { margin: 0 0 0.85rem 1.25rem; }
.insights-inline-body li { margin-bottom: 0.35rem; }
.insights-inline-body strong { font-weight: 600; color: var(--text); }
.insights-inline-body em { font-style: italic; color: var(--accent-hi); }
.insights-inline-body code {
  background: var(--bg-2);
  padding: 0.05em 0.35em;
  border-radius: 4px;
  color: var(--accent-hi);
}

/* ──────────────────────────────────────────────────────────────────
   Dashboard split: LEFT = aggregate, RIGHT = sticky live column
   ────────────────────────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}
.dash-left  { min-width: 0; }

/* 50/50 row used for KPI+Insights and Chart+Heatmap pairs */
.split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 1.25rem;
  align-items: stretch;
}
.split-row > * { margin-bottom: 0 !important; min-width: 0; }

/* When KPI grid is squeezed into half-width, fit 2 columns of compact cards */
.split-row .kpi-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 0;
  align-content: start;
}
.split-row .kpi-card-wide { grid-column: span 2; }

/* Insights collapses head into stacked layout in half-width context */
.split-row .insights-inline-head { gap: 0.5rem; }
.split-row .insights-inline-meta { text-align: left; padding: 0; flex: 0 0 auto; }

/* Heatmap squeezes — shrink the day label column for narrower cells */
.split-row .heatmap-card { padding: 0.95rem 1rem; }
.split-row .heatmap { grid-template-columns: 48px repeat(24, minmax(0, 1fr)); gap: 2px; }
.split-row .heatmap .hm-day { padding-right: 5px; font-size: 0.58rem; gap: 0.2rem; }
.split-row .heatmap .hm-hour { font-size: 0.55rem; }
.dash-right {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
}

/* Floating glass overlay sits above the map */
.live-overlay {
  position: relative;
  z-index: 5;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.live-overlay > * { pointer-events: auto; }

/* Translucent "Live" counter card floating on the map */
.live-counter-card {
  background: rgba(11, 11, 18, 0.45);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 2px solid var(--accent);
  border-radius: 10px;
  padding: 0.85rem 1rem 0.9rem;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
}
.live-counter-head {
  display: flex; align-items: center; gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}
.live-counter-row {
  display: flex; align-items: baseline; gap: 0.55rem;
}
.live-counter-num {
  font-family: var(--mono);
  font-size: 2.1rem;
  font-weight: 500;
  letter-spacing: -0.028em;
  color: var(--accent-hi);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.live-counter-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

/* Sidor-i-fokus list — same translucent glass treatment as counter */
.live-pages-card {
  background: rgba(11, 11, 18, 0.45);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.8rem 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 240px;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
}
.live-pages-card .panel-title { margin-bottom: 0.6rem; }
.live-pages-card .live-pages li {
  background: rgba(255, 255, 255, 0.04);
}

.live-pages {
  list-style: none;
  display: flex; flex-direction: column; gap: 3px;
  max-height: 160px;
  overflow-y: auto;
}
.live-pages::-webkit-scrollbar { width: 4px; }
.live-pages::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
.live-pages li {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.4rem 0.55rem;
  border-radius: 5px;
  background: var(--bg-2);
  font-size: 0.8rem;
  font-family: var(--mono);
}
.live-pages li .lp-page {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text);
}
.live-pages li .lp-count {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent-hi);
  background: var(--accent-soft);
  border-radius: 99px;
  padding: 0.05rem 0.45rem;
  font-variant-numeric: tabular-nums;
}
.live-pages-empty {
  color: var(--text-dim) !important;
  font-size: 0.82rem;
  font-family: var(--sans) !important;
  background: transparent !important;
  padding: 0.25rem 0 !important;
}

/* Naked map — fills the entire sticky right column as the base layer */
.live-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  z-index: 1;
}

/* ──────────────────────────────────────────────────────────────────
   Leaflet — Carto Dark Matter, blended into the bg
   ────────────────────────────────────────────────────────────────── */
.leaflet-container {
  background: var(--bg) !important;
  font-family: var(--sans);
}
.leaflet-tile {
  /* Invert light Positron tiles: ocean → near-black (matches bg),
     land → contrasting medium gray. hue-rotate keeps colors neutral. */
  filter: invert(1) hue-rotate(180deg) brightness(0.95) saturate(0.65) contrast(0.9);
}
/* Hidden — user-requested clean look. Attribution is moved to footer of the page if needed. */
.leaflet-control-attribution { display: none !important; }
.leaflet-control-container { display: none !important; }

.statly-marker-tooltip {
  background: var(--text) !important;
  color: var(--bg) !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 0.35rem 0.55rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  font-family: var(--sans) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45) !important;
}
.statly-marker-tooltip::before { display: none !important; }

/* ──────────────────────────────────────────────────────────────────
   heatmap — its own card, full-width row
   ────────────────────────────────────────────────────────────────── */
.heatmap-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.25rem;
}
.heatmap {
  display: grid;
  grid-template-columns: 60px repeat(24, minmax(0, 1fr));
  gap: 3px;
  font-size: 0.6rem;
  color: var(--text-dim);
}
.heatmap .hm-corner { grid-column: 1; }
.heatmap .hm-hour {
  text-align: center;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  padding-bottom: 2px;
}
.heatmap .hm-day {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 0.3rem;
  padding-right: 8px; font-size: 0.62rem;
  color: var(--text-muted);
  font-family: var(--mono);
}
.heatmap .hm-day-name { font-weight: 500; }
.heatmap .hm-day-date {
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.heatmap .hm-day-today .hm-day-name,
.heatmap .hm-day-today .hm-day-date { color: var(--accent-hi); }
.heatmap .hm-cell {
  aspect-ratio: 1 / 1;
  border-radius: 2px;
  background: var(--bg-2);
  transition: transform 0.1s;
}
.heatmap .hm-cell:hover { transform: scale(1.3); outline: 1px solid var(--accent); }

.heatmap-scale {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-dim);
}
.heatmap-scale-bar {
  width: 64px; height: 4px; border-radius: 3px;
  background: linear-gradient(to right, var(--bg-2), var(--accent));
}

/* ──────────────────────────────────────────────────────────────────
   sections + tables
   ────────────────────────────────────────────────────────────────── */
.section-heading {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 2rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.section-heading:first-of-type { margin-top: 1.5rem; }

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.table-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.3rem 1rem;
  overflow: hidden;
  transition: border-color 0.2s;
}
.table-card:hover { border-color: var(--line-strong); }
.table-title {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.85rem;
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}
.data-table th:last-child, .data-table td:last-child { text-align: right; }
.data-table td {
  padding: 0.55rem 0;
  font-size: 0.85rem;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table td .bar-wrap { display: flex; align-items: center; gap: 0.5rem; }
.data-table td .bar {
  height: 3px; border-radius: 99px;
  background: var(--line-strong);
  flex-shrink: 0;
  transition: width 0.3s ease;
}
.data-table td .bar-fill {
  height: 100%; border-radius: 99px;
  background: var(--accent);
  box-shadow: 0 0 4px var(--accent-glow);
}
.data-table td .td-num {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.td-page {
  display: inline-block; vertical-align: middle;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ──────────────────────────────────────────────────────────────────
   verify install
   ────────────────────────────────────────────────────────────────── */
.btn-outline-sm {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  transition: all 0.15s;
}
.btn-outline-sm:hover { border-color: var(--accent); color: var(--accent-hi); }

.verify-row {
  display: flex; align-items: center; gap: 0.75rem;
  flex-wrap: wrap; margin-top: 1rem;
}
.verify-result {
  flex: 1; min-width: 200px;
  font-size: 0.85rem; line-height: 1.5;
  padding: 0.6rem 0.8rem;
  border-radius: 7px;
}
.verify-result.is-ok    { background: rgba(16, 185, 129, 0.08);  color: var(--live);   border: 1px solid rgba(16, 185, 129, 0.2); }
.verify-result.is-fail  { background: rgba(239, 68, 68, 0.08);   color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.verify-result.is-warn  { background: rgba(245, 158, 11, 0.08);  color: var(--warn);   border: 1px solid rgba(245, 158, 11, 0.2); }
.verify-result.is-busy  { background: var(--bg-2); color: var(--text-muted); border: 1px solid var(--line); }
.verify-result code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.05em 0.35em;
  border-radius: 4px;
}

/* ──────────────────────────────────────────────────────────────────
   modal (snippet)
   ────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
}
.modal-card {
  position: relative; z-index: 1;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 2rem;
  width: 100%; max-width: 580px;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.modal-close {
  color: var(--text-dim);
  font-size: 1rem;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--surface-hi); color: var(--text); }

/* ──────────────────────────────────────────────────────────────────
   topbar buttons
   ────────────────────────────────────────────────────────────────── */
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; }
.btn-api-access {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-api-access:hover { border-color: var(--accent); color: var(--accent-hi); }

/* ──────────────────────────────────────────────────────────────────
   API tab
   ────────────────────────────────────────────────────────────────── */
.api-modal-card { max-width: none; max-height: none; }
.api-section { margin-bottom: 0.5rem; }
.api-section-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}
.api-hint { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 0.85rem; line-height: 1.55; }

.api-key-row {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.55rem 0.8rem;
  margin-bottom: 0.6rem;
}
.api-key-code {
  font-family: var(--mono);
  font-size: 0.8rem;
  flex: 1;
  word-break: break-all;
  color: var(--text);
  user-select: all;
}
.api-key-btns { display: flex; gap: 0.5rem; margin-bottom: 0.85rem; }

.btn-sm {
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  transition: all 0.15s;
  box-shadow: 0 0 0 1px var(--accent-deep), 0 4px 12px -4px var(--accent-glow);
}
.btn-sm:hover { background: var(--accent-hi); transform: translateY(-1px); }
.btn-sm:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-sm-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}
.btn-sm-ghost:hover { border-color: var(--accent); color: var(--accent-hi); background: transparent; box-shadow: none; }
.btn-sm-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
  box-shadow: none;
}
.btn-sm-danger:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: var(--danger);
}

.api-lang-tabs { display: flex; gap: 0.2rem; margin: 0.25rem 0 0.6rem; }
.api-lang-tab {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.7rem;
  border-radius: 5px;
  color: var(--text-dim);
}
.api-lang-tab:hover { background: var(--bg-2); color: var(--text-muted); }
.api-lang-tab.active { background: var(--bg-2); color: var(--text); }

.api-example-heading {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.api-code { margin-bottom: 0; }

.api-params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.api-params-table td {
  padding: 0.4rem 0.5rem;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.api-params-table td:first-child { white-space: nowrap; padding-right: 0.85rem; }
.api-params-table td code {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.08em 0.4em;
  font-size: 0.78rem;
  color: var(--accent-hi);
}
.api-params-table tr:last-child td { border-bottom: none; }
.api-params-table td:last-child { color: var(--text-muted); }

/* ──────────────────────────────────────────────────────────────────
   goals
   ────────────────────────────────────────────────────────────────── */
.goals-list { list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
.goals-list li {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 7px;
}
.goals-list .gl-info { flex: 1; min-width: 0; overflow: hidden; }
.goals-list .gl-name {
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 0.1rem;
}
.goals-list .gl-pattern {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.goals-list .gl-delete {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--danger);
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
}
.goals-list .gl-delete:hover { background: rgba(239, 68, 68, 0.12); }
.goals-empty {
  color: var(--text-dim) !important;
  font-size: 0.88rem;
  padding: 0.25rem 0 !important;
  border: none !important;
  background: transparent !important;
}

.goals-form { display: flex; flex-direction: column; gap: 0.8rem; }
.goals-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.goals-form-row label { display: flex; flex-direction: column; gap: 0.35rem; }
.goals-form-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.goals-form input {
  padding: 0.6rem 0.75rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 0.88rem;
  width: 100%;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.goals-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.goals-form-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.goals-form-help code {
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 0.05em 0.35em;
  border-radius: 4px;
  color: var(--accent-hi);
}

@media (max-width: 640px) {
  .goals-form-row { grid-template-columns: 1fr; }
}

/* ──────────────────────────────────────────────────────────────────
   insights tab
   ────────────────────────────────────────────────────────────────── */
.insights-wrap {
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 2rem 2.25rem;
  max-width: 820px;
}
.insights-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.insights-title {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.15;
  margin-bottom: 0.25rem;
}
.insights-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.insights-notice {
  font-size: 0.85rem;
  padding: 0.65rem 0.9rem;
  border-radius: 7px;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.insights-notice.is-stale   { background: rgba(245, 158, 11, 0.08); color: var(--warn);   border: 1px solid rgba(245, 158, 11, 0.2); }
.insights-notice.is-error   { background: rgba(239, 68, 68, 0.08);  color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.insights-notice.is-pending { background: rgba(16, 185, 129, 0.08); color: var(--live);   border: 1px solid rgba(16, 185, 129, 0.2); }

.insights-body {
  line-height: 1.65;
  color: var(--text);
  font-size: 0.92rem;
}
.insights-body-empty {
  color: var(--text-dim);
  font-style: italic;
  padding: 2rem 0;
  text-align: center;
}
.insights-body h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  margin: 1.6rem 0 0.6rem;
  color: var(--text);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}
.insights-body h2:first-child { margin-top: 0; }
.insights-body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.1rem 0 0.4rem;
}
.insights-body p { margin: 0 0 0.95rem; }
.insights-body ul, .insights-body ol { margin: 0 0 0.95rem 1.25rem; }
.insights-body li { margin-bottom: 0.4rem; }
.insights-body strong { font-weight: 600; color: var(--text); }
.insights-body em { font-style: italic; color: var(--accent-hi); }
.insights-body code {
  background: var(--bg-2);
  padding: 0.05em 0.35em;
  border-radius: 4px;
  color: var(--accent-hi);
}

/* ──────────────────────────────────────────────────────────────────
   responsive
   ────────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }
  #screen-dashboard { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0;
    width: 100%; height: auto;
    flex-direction: row;
    z-index: 50;
    border-top: 1px solid var(--line);
    border-right: none;
    padding: 0.6rem 1rem;
    background: rgba(11, 11, 18, 0.92);
    backdrop-filter: blur(20px);
  }
  .sidebar-top {
    display: flex; flex-direction: row;
    align-items: center; gap: 0.75rem;
    overflow-x: auto; flex: 1;
  }
  .sidebar-logo, .add-site-btn { display: none; }
  .site-list { flex-direction: row; flex-wrap: nowrap; gap: 0.25rem; margin-bottom: 0; }
  .sidebar-bottom {
    padding: 0 0 0 0.75rem;
    margin-top: 0;
    border-top: none;
    border-left: 1px solid var(--line);
  }
  .user-email { display: none; }
  .dash-main { padding: 1.25rem 1rem 5.5rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .tables-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .split-row { grid-template-columns: 1fr; gap: 14px; }
  .split-row .heatmap { grid-template-columns: 52px repeat(24, minmax(0, 1fr)); }
  .dash-right {
    position: relative;
    height: auto;
    min-height: 420px;
    margin-top: 14px;
  }
  .live-map { position: absolute; min-height: 420px; }
  .live-overlay { padding: 10px; gap: 6px; }
  .live-pages-card { max-height: 180px; }
  .insights-inline-head { align-items: flex-start; }
  .insights-inline-meta { text-align: left; padding: 0; flex: 0; }
  .heatmap {
    grid-template-columns: 52px repeat(24, minmax(0, 1fr));
    font-size: 0.55rem; gap: 2px;
  }
  .heatmap .hm-day { padding-right: 5px; gap: 0.2rem; font-size: 0.58rem; }
}
