/* ============= TOKENS ============= */
:root {
  --bg: #0A0A12;
  --card: #13131F;
  --hover: #1B1B2B;
  --sidebar: #0C0C16;
  --text: #F2F2F5;
  --muted: #8B8E9C;
  --dim: #5A5C68;
  --border: #22223A;
  --border-soft: #1A1A2A;
  --accent: #0028F5;
  --accent-light: #5BB3FF;
  --accent-bg: rgba(0, 40, 245, 0.16);
  --accent-bg-soft: rgba(0, 40, 245, 0.08);
  --green: #10b981;
  --red: #ef4444;
  --orange: #f59e0b;
  --cyan: #5BB3FF;
  --r: 12px;
  --r-sm: 8px;
  --r-lg: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  --shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 1px 2px rgba(0,0,0,0.4);
  --shadow-lift: 0 8px 30px rgba(0, 40, 245, 0.12), 0 1px 0 rgba(255,255,255,0.04) inset;
}

[data-theme="light"] {
  --bg: #F2F2F5;
  --card: #FFFFFF;
  --hover: #F6F6FA;
  --sidebar: #FFFFFF;
  --text: #0A0A12;
  --muted: #5A5C68;
  --dim: #8B8E9C;
  --border: #E4E4EC;
  --border-soft: #EFEFF4;
  --accent: #0028F5;
  --accent-light: #1f6fe5;
  --accent-bg: rgba(0, 40, 245, 0.10);
  --accent-bg-soft: rgba(0, 40, 245, 0.04);
  --shadow: 0 1px 2px rgba(15, 20, 60, 0.06);
  --shadow-lift: 0 12px 32px rgba(0, 40, 245, 0.10);
}

/* ============= BASE ============= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
.num, .tabnum { font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  width: 100vw;
}

/* ============= SIDEBAR ============= */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}
.sb-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sb-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
  font-size: 16px; letter-spacing: -0.02em;
  box-shadow: 0 0 24px rgba(0, 40, 245, 0.4);
  position: relative;
}
.sb-mark::after {
  content: "";
  position: absolute; inset: 6px;
  border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,0.5);
}
.sb-brand-title {
  font-weight: 600; font-size: 13.5px; color: var(--text);
  letter-spacing: -0.01em; line-height: 1.1;
  white-space: nowrap;
}
.sb-brand > div:last-child { min-width: 0; flex: 1; }
.sb-brand-sub {
  font-size: 9.5px;
  color: var(--accent-light);
  letter-spacing: 0.14em;
  font-weight: 600;
  margin-top: 3px;
  text-transform: uppercase;
}
.sb-nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.sb-group {
  font-size: 10px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  padding: 14px 12px 6px;
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  margin: 1px 0;
  transition: background 120ms ease, color 120ms ease;
  user-select: none;
}
.sb-item:hover { background: var(--hover); color: var(--text); }
.sb-item.active {
  background: var(--accent-bg);
  color: var(--accent-light);
  font-weight: 500;
}
.sb-item.active svg { color: var(--accent-light); }
.sb-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--dim); }
.sb-item:hover svg { color: var(--muted); }
.sb-item-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ============= MAIN ============= */
.main { display: flex; flex-direction: column; height: 100vh; overflow: hidden; min-width: 0; }
.header {
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
}
.header h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header h1 .crumb { color: var(--muted); font-weight: 400; margin-right: 8px; }
.header h1 .crumb::after { content: "/"; margin-left: 8px; color: var(--dim); }
.h-controls { display: flex; align-items: center; gap: 8px; }
.date-picker {
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--muted);
  height: 32px;
}
.date-picker input {
  background: transparent; border: none; color: var(--text);
  font-size: 12.5px; width: 80px; outline: none;
  font-variant-numeric: tabular-nums;
}
.date-picker .sep { color: var(--dim); }
.seg {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  height: 32px;
}
.seg button {
  padding: 0 10px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 6px;
  font-weight: 500;
  transition: all 120ms ease;
}
.seg button.on {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 1px var(--accent), 0 0 16px rgba(0,40,245,0.4);
}
.seg button:not(.on):hover { color: var(--text); }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 120ms ease;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.danger { color: var(--red); }
.icon-btn.danger:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); }

.content { flex: 1; overflow-y: auto; padding: 24px; min-height: 0; }
.content.no-pad { padding: 0; }
.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
  font-weight: 600;
  margin: 0 0 12px;
}

/* ============= CARDS ============= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  position: relative;
}
.card-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-title {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0;
  flex: 1;
}
.card-body { padding: 16px 18px; }
.card-sub { font-size: 11.5px; color: var(--muted); margin: 2px 0 0; }

/* ============= KPI ============= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
  opacity: 0;
  transition: opacity 200ms ease;
}
.kpi:hover {
  transform: translateY(-2px);
  border-color: rgba(91, 179, 255, 0.3);
  box-shadow: var(--shadow-lift);
}
.kpi:hover::before { opacity: 0.6; }
.kpi-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.kpi-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}
.kpi-icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent-bg);
  color: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
}
.kpi-icon svg { width: 14px; height: 14px; }
.kpi-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  display: flex; align-items: center; gap: 6px;
}
.kpi-delta { font-variant-numeric: tabular-nums; font-weight: 500; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.row { display: flex; gap: 16px; }
.stack-16 > * + * { margin-top: 16px; }
.stack-20 > * + * { margin-top: 20px; }

/* ============= TABLES ============= */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.search {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  max-width: 320px;
}
.search input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 13px;
}
.search svg { width: 14px; height: 14px; color: var(--dim); }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  transition: all 120ms ease;
  height: 32px;
}
.btn:hover { background: var(--hover); }
.btn svg { width: 13px; height: 13px; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { box-shadow: 0 0 24px rgba(0,40,245,0.4); }
.btn.danger {
  color: var(--red);
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.06);
}
.btn.danger:hover { background: rgba(239,68,68,0.12); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--hover); }

.table-scroll { overflow-x: auto; max-height: 100%; }
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.t thead th {
  position: sticky; top: 0;
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  z-index: 1;
  white-space: nowrap;
}
table.t tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
table.t tbody tr { transition: background 100ms ease; }
table.t tbody tr:hover { background: var(--hover); }
table.t .num { font-variant-numeric: tabular-nums; }
table.t .id { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 12px; }
table.t .muted { color: var(--muted); }
table.t .row-action {
  color: var(--dim);
  width: 24px; height: 24px;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
table.t .row-action:hover { color: var(--red); background: rgba(239,68,68,0.1); }

.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  color: var(--muted);
}
.pager-controls { display: flex; align-items: center; gap: 4px; }
.pager-controls button {
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--muted);
}
.pager-controls button:hover { background: var(--hover); color: var(--text); }
.pager-page { padding: 0 10px; font-variant-numeric: tabular-nums; }

/* ============= BADGES ============= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--hover);
  color: var(--muted);
}
.badge.accent { background: var(--accent-bg); color: var(--accent-light); }
.badge.green { background: rgba(16,185,129,0.12); color: var(--green); }
.badge.red { background: rgba(239,68,68,0.12); color: var(--red); }
.badge.orange { background: rgba(245,158,11,0.12); color: var(--orange); }
.badge.cyan { background: rgba(91,179,255,0.12); color: var(--cyan); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============= CHARTS ============= */
.chart-canvas { width: 100%; height: 300px; position: relative; border-radius: 8px; }
.chart-canvas.small { height: 200px; }
.chart-canvas.tall { height: 360px; }

.chart-grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--border-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border-soft) 1px, transparent 1px);
  background-size: 12.5% 25%;
  opacity: 0.5;
}
.chart-axis-y, .chart-axis-x {
  position: absolute;
  font-size: 10.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.chart-axis-y { left: 4px; top: 0; bottom: 24px; display: flex; flex-direction: column; justify-content: space-between; }
.chart-axis-x { left: 40px; right: 4px; bottom: 4px; display: flex; justify-content: space-between; }

.bar-chart {
  position: absolute;
  left: 36px; right: 8px;
  top: 8px; bottom: 28px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}
.bar-chart .bar {
  flex: 1;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--accent) 100%);
  border-radius: 4px 4px 0 0;
  position: relative;
  min-height: 3px;
  transition: opacity 120ms ease;
}
.bar-chart .bar:hover { opacity: 0.85; }

.line-chart-svg { position: absolute; inset: 8px 8px 28px 36px; }

/* Doughnut */
.doughnut-wrap { display: flex; align-items: center; gap: 20px; padding: 8px 0; }
.doughnut { width: 160px; height: 160px; position: relative; flex-shrink: 0; }
.doughnut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.doughnut-total {
  font-size: 24px; font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.doughnut-total-label {
  font-size: 10px; text-transform: uppercase;
  color: var(--muted); letter-spacing: 0.1em; font-weight: 600;
  margin-top: 2px;
}
.legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
}
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-name { color: var(--text); }
.legend-pct { color: var(--muted); font-variant-numeric: tabular-nums; width: 38px; text-align: right; }
.legend-val { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 500; }

.cell-bar { display: flex; align-items: center; gap: 8px; }
.cell-bar-track {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--border);
  overflow: hidden;
  max-width: 80px;
}
.cell-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; }

/* ============= FORM ============= */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}
.input, .select, .textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 40, 245, 0.15);
}
.textarea { min-height: 100px; resize: vertical; font-family: inherit; line-height: 1.5; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B8E9C' stroke-width='2'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}

/* ============= LOGIN ============= */
.login-page {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.login-page::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 600px 400px at 50% 40%, rgba(0,40,245,0.18), transparent 70%);
  pointer-events: none;
}
.login-page::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(34,34,58,0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34,34,58,0.4) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 700px 500px at 50% 50%, black 40%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 700px 500px at 50% 50%, black 40%, transparent 75%);
  opacity: 0.5;
  pointer-events: none;
}
.login-card {
  width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px 28px;
  position: relative;
  z-index: 1;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.02) inset;
}
.login-mark {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
  font-size: 22px; letter-spacing: -0.04em;
  box-shadow: 0 0 36px rgba(0,40,245,0.55);
  margin: 0 auto 18px;
  position: relative;
}
.login-mark::after {
  content: "";
  position: absolute; inset: 9px;
  border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,0.6);
}
.login-title {
  text-align: center;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}
.login-sub {
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 28px;
}
.login-sub b { color: var(--accent-light); font-weight: 500; }
.login-page .field { margin-bottom: 16px; }
.login-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 11px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: box-shadow 160ms ease, transform 160ms ease;
}
.login-btn:hover { box-shadow: 0 0 32px rgba(0,40,245,0.5); }
.login-foot {
  text-align: center;
  margin-top: 22px;
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ============= FUNNEL horizontal ============= */
.funnel { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.funnel-row {
  display: grid;
  grid-template-columns: 200px 1fr 100px 80px 90px;
  gap: 16px;
  align-items: center;
  padding: 6px 0;
}
.funnel-label { font-size: 13px; font-weight: 500; }
.funnel-bar-track {
  height: 28px;
  border-radius: 6px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.funnel-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: 6px;
  box-shadow: 0 0 24px rgba(0,40,245,0.3);
}
.funnel-val { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.funnel-drop { font-size: 12px; color: var(--red); font-variant-numeric: tabular-nums; text-align: right; }
.funnel-cr { font-size: 12px; color: var(--green); font-variant-numeric: tabular-nums; text-align: right; font-weight: 500; }

/* ============= VFUNNEL ============= */
.vfunnel {
  display: flex; align-items: flex-end; gap: 12px;
  height: 280px;
  padding: 28px 4px 8px;
}
.vfunnel-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.vfunnel-bar-wrap { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.vfunnel-val {
  font-size: 17px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.vfunnel-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--accent) 100%);
  border-radius: 8px 8px 0 0;
  position: relative;
  min-height: 30px;
  box-shadow: 0 0 30px rgba(0,40,245,0.25);
}
.vfunnel-bar .cr {
  position: absolute;
  top: -22px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--green);
  font-variant-numeric: tabular-nums; font-weight: 600;
  background: rgba(16,185,129,0.12);
  padding: 2px 6px; border-radius: 4px;
  white-space: nowrap;
}
.vfunnel-label {
  font-size: 11.5px; color: var(--muted); text-align: center;
  line-height: 1.3;
  margin-top: 8px;
}

/* ============= HEATMAP ============= */
.heatmap {
  display: grid;
  grid-template-columns: 40px repeat(24, 1fr);
  gap: 3px;
  padding: 4px;
}
.heatmap-h {
  font-size: 9.5px; color: var(--dim);
  text-align: center; font-variant-numeric: tabular-nums;
  padding: 2px 0;
}
.heatmap-d {
  font-size: 10.5px; color: var(--muted);
  display: flex; align-items: center; padding-right: 6px;
}
.heatmap-cell {
  height: 24px;
  border-radius: 4px;
  background: rgba(0, 40, 245, 0.03);
  border: 1px solid var(--border-soft);
  transition: transform 80ms ease;
  cursor: pointer;
}
.heatmap-cell:hover { transform: scale(1.18); border-color: var(--accent-light); }

.heatmap-legend {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--muted);
  padding: 12px 4px 0;
}
.heatmap-legend-scale { display: flex; gap: 3px; }
.heatmap-legend-cell {
  width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid var(--border-soft);
}

/* ============= CHAT ============= */
.chat-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
}
.ws-status {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 24px;
  font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--border-soft);
  background: var(--card);
}
.ws-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.5);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); }
  70% { box-shadow: 0 0 0 6px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.chat-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
@media (max-width: 1100px) {
  .chat-grid { grid-template-columns: 260px minmax(0, 1fr); }
}
.chat-list {
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  background: var(--card);
  overflow-y: auto;
}
.chat-list-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.chat-list-title { font-weight: 600; font-size: 14px; }
.chat-user {
  display: flex; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 100ms;
  position: relative;
}
.chat-user:hover { background: var(--hover); }
.chat-user.active { background: var(--accent-bg-soft); border-left: 2px solid var(--accent-light); padding-left: 14px; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #0028F5);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 13px;
  flex-shrink: 0;
}
.avatar.green { background: linear-gradient(135deg, #10b981, #5BB3FF); }
.avatar.orange { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar.cyan { background: linear-gradient(135deg, #5BB3FF, #0028F5); }
.chat-user-body { flex: 1; min-width: 0; }
.chat-user-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 2px;
}
.chat-user-name { font-size: 13px; font-weight: 600; }
.chat-user-time { font-size: 11px; color: var(--dim); }
.chat-user-prev { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-user-badge {
  position: absolute; right: 16px; bottom: 12px;
  background: var(--accent);
  color: #fff; font-size: 10px; font-weight: 600;
  border-radius: 10px; padding: 1px 6px; min-width: 18px; text-align: center;
}
.chat-main {
  display: flex; flex-direction: column;
  background: var(--bg);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.chat-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
}
.chat-header-name { font-weight: 600; font-size: 14px; flex: 1; }
.takeover {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
}
.toggle {
  width: 36px; height: 20px;
  border-radius: 10px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  transition: background 160ms;
  flex-shrink: 0;
}
.toggle::after {
  content: "";
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px; left: 3px;
  transition: left 160ms;
}
.toggle.on { background: var(--accent); }
.toggle.on::after { left: 19px; }
.chat-stream {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.bubble {
  max-width: 60%;
  width: fit-content;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}
.bubble-user {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.bubble-bot {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent) 0%, #1f4dff 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,40,245,0.25);
}
.bubble-admin {
  align-self: flex-end;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bubble-meta { font-size: 10.5px; opacity: 0.7; margin-top: 4px; }
.bubble-author {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 600; opacity: 0.85;
  margin-bottom: 2px;
}
.chat-input-bar {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
  background: var(--card);
}
.chat-input-bar input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--text); font-size: 13px;
  outline: none;
}
.chat-input-bar input:focus { border-color: var(--accent); }

/* ============= LEADS ============= */
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 120ms;
}
.pill:hover { color: var(--text); }
.pill.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent-light);
  font-weight: 500;
}
.pill .count {
  font-size: 11px;
  background: var(--bg);
  padding: 0 6px; border-radius: 8px;
  font-variant-numeric: tabular-nums;
}
.pill.active .count { background: var(--accent); color: #fff; }

/* ============= MESSENGER ============= */
.msg-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
}
.health-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--card);
  overflow-x: auto;
}
.health-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11.5px;
  white-space: nowrap;
}
.health-chip .status-dot { width: 6px; height: 6px; border-radius: 50%; }
.health-chip.healthy .status-dot { background: var(--green); }
.health-chip.warning .status-dot { background: var(--orange); }
.health-chip.error .status-dot { background: var(--red); }
.health-chip.warning { border-color: rgba(245,158,11,0.4); }
.health-chip.error { border-color: rgba(239,68,68,0.4); }
.health-chip .name { color: var(--text); font-weight: 500; }
.health-chip .meta { color: var(--muted); font-variant-numeric: tabular-nums; }
.msg-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 260px;
  height: 100%;
  min-height: 0;
}
@media (max-width: 1280px) {
  .msg-grid { grid-template-columns: 260px minmax(0, 1fr) 240px; }
}
@media (max-width: 1100px) {
  .msg-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .msg-side.right { display: none; }
}
.msg-side { border-right: 1px solid var(--border); overflow-y: auto; background: var(--card); }
.msg-side.right { border-right: none; border-left: 1px solid var(--border); }

.profile-pane { padding: 20px; }
.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #0028F5);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 600; color: #fff;
  margin: 0 auto 12px;
}
.profile-name { font-size: 15px; font-weight: 600; text-align: center; margin-bottom: 2px; }
.profile-sub { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 16px; }
.profile-stat { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 12.5px; }
.profile-stat .k { color: var(--muted); }
.profile-stat .v { font-variant-numeric: tabular-nums; }

/* ============= MODAL ============= */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5, 5, 10, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 540px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center;
}
.modal-header h3 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-soft);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ============= SKELETON ============= */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--card) 0%, var(--hover) 50%, var(--card) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: 6px;
}
.skel-line { height: 10px; margin: 8px 0; }

/* ============= UTILS ============= */
.text-muted { color: var(--muted); }
.text-dim { color: var(--dim); }
.text-accent { color: var(--accent-light); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.fw-600 { font-weight: 600; }

@keyframes fadeUp {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { /* visual fade disabled — was causing render issues in some hosts */ }

.type-tag {
  display: inline-flex; align-items: center;
  font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; font-weight: 600;
  color: var(--muted);
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
}
