:root {
  --bg: #0b0d10;
  --bg-deep: #07090b;
  --panel: #14171c;
  --panel-2: #1a1e24;
  --panel-3: #20252c;
  --border: #23272f;
  --border-soft: #1c2026;
  --text: #e6e8eb;
  --text-dim: #8a9099;
  --text-muted: #5b6168;
  --accent: #4fd1c5;
  --accent-dim: #2a7f78;
  --warn: #f59e0b;
  --warn-dim: #b45309;
  --danger: #f87171;
  --ok: #4ade80;
  --info: #60a5fa;
  --violet: #a78bfa;
  --pink: #f472b6;

  --cat-qualified: #4ade80;
  --cat-interested: #60a5fa;
  --cat-watch: #fbbf24;
  --cat-non-qualified: #6b7280;
  --cat-service: #c084fc;
  --cat-no-fit: #f87171;

  --status-active: #4ade80;
  --status-dormant: #fbbf24;
  --status-churned: #f87171;
  --status-vip: #f472b6;

  --origin-instagram: #ec4899;
  --origin-facebook: #3b82f6;
  --origin-website: #4ade80;
  --origin-callcenter: #fbbf24;
  --origin-whatsapp: #22c55e;
  --origin-other: #94a3b8;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
body {
  padding: 0;
  min-height: 100vh;
  padding-bottom: 60px;
}
a {
  color: inherit;
  text-decoration: none;
}

/* ─── Top bar ──────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 13, 16, 0.92);
  backdrop-filter: blur(8px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--info);
}
.brand-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topnav {
  display: flex;
  gap: 4px;
}
.topnav a {
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
}
.topnav a:hover {
  color: var(--text);
  background: var(--panel);
}
.topnav a.active {
  color: var(--text);
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--border);
}

.topright {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  background: var(--panel);
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.lang-toggle:hover {
  color: var(--text);
  border-color: var(--border);
}

.user-picker {
  position: relative;
}
.user-picker-button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-picker-button:hover {
  border-color: var(--border);
}
.user-picker-button .caret {
  color: var(--text-muted);
  font-size: 10px;
}
.user-picker-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 240px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px;
  z-index: 200;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
}
.user-picker-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}
.user-picker-menu button:hover {
  background: var(--panel-3);
}
.user-picker-menu button.active {
  background: var(--panel-3);
  color: var(--accent);
}
.user-picker-menu .menu-empty {
  color: var(--text-muted);
  padding: 12px;
  text-align: center;
  font-size: 12px;
}

.zoho-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.zoho-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.zoho-status.ok {
  color: var(--ok);
}
.zoho-status.ok .dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.12);
}
.zoho-status.warn {
  color: var(--warn);
}
.zoho-status.warn .dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}
.zoho-status.err {
  color: var(--danger);
}
.zoho-status.err .dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}

/* ─── Main app area ────────────────────────────────────────── */
#app {
  padding: 24px 28px;
  max-width: 1400px;
  margin: 0 auto;
}
.loading {
  padding: 60px 0;
  text-align: center;
  color: var(--text-muted);
}

.page-head {
  margin-bottom: 20px;
}
.page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.page-head .subtitle {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
}

.page-tools {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

/* ─── KPI cards ────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 16px 18px;
  position: relative;
}
.kpi-card .label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.kpi-card .value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-card .value .unit {
  font-size: 18px;
  color: var(--text-dim);
  margin-left: 2px;
}
.kpi-card .value-sub {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 400;
}
.kpi-card .delta {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.kpi-card .delta.up {
  color: var(--ok);
}
.kpi-card .delta.down {
  color: var(--danger);
}
.kpi-card .delta-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.kpi-card.attention {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), var(--panel));
  border-color: rgba(245, 158, 11, 0.3);
}
.kpi-card.attention .pill {
  display: inline-block;
  background: rgba(245, 158, 11, 0.18);
  color: var(--warn);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.kpi-card.mini-chart {
  padding-bottom: 10px;
}
.kpi-card.mini-chart .chart-area {
  height: 56px;
  margin-top: 8px;
}

/* ─── Panels (cards with title + chart/content) ────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 18px 20px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.panel-head h2 {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.panel-head .meta {
  font-size: 11px;
  color: var(--text-dim);
}
.panel-head .meta.ok {
  color: var(--ok);
  font-weight: 500;
}

.col-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 820px) {
  .col-2 {
    grid-template-columns: 1fr;
  }
}

/* ─── Bar lists (horizontal bars) ──────────────────────────── */
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 60px;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.bar-row .label {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}
.bar-row .label .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.bar-row .track {
  background: var(--panel-3);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}
.bar-row .fill {
  height: 100%;
  border-radius: 3px;
}
.bar-row .value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 500;
}

/* ─── Progress bar (Meta del mes) ──────────────────────────── */
.progress-panel {
  padding: 20px 24px;
}
.progress-panel .progress-head {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  margin-bottom: 14px;
}
.progress-panel .progress-head .col .label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.progress-panel .progress-head .col .value {
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.progress-panel .progress-head .col .value.good {
  color: var(--ok);
}
.progress-panel .progress-head .col .value.alert {
  color: var(--warn);
}
.progress-bar {
  position: relative;
  height: 8px;
  background: var(--panel-3);
  border-radius: 4px;
  overflow: visible;
}
.progress-bar .fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--ok), var(--info));
}
.progress-bar .badge {
  position: absolute;
  right: 6px;
  top: -10px;
  transform: translateY(-50%);
  background: var(--panel-3);
  color: var(--text);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
}

/* ─── Tables ───────────────────────────────────────────────── */
.table-panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  overflow: hidden;
}
.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
  gap: 12px;
}
.table-head h2 {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.table-head .subtle {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.table-head input[type="text"],
.table-head select,
.table-head button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
}
.table-head input[type="text"]:focus {
  border-color: var(--accent-dim);
}
.table-head .filters {
  display: flex;
  gap: 8px;
  align-items: center;
}
.table-head button {
  cursor: pointer;
}
.table-head button:hover {
  border-color: var(--text-dim);
}

.chip-row {
  display: flex;
  gap: 6px;
  padding: 0 18px 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
}
.chip-row .right {
  margin-left: auto;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--panel-2);
}
.chip:hover {
  color: var(--text);
}
.chip.active {
  color: var(--text);
  border-color: var(--border);
}
.chip .count {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text-dim);
}
.chip.active .count {
  color: var(--text);
}
.chip .swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

table.data {
  width: 100%;
  border-collapse: collapse;
}
table.data th {
  text-align: left;
  padding: 12px 18px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border-soft);
}
table.data td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  font-size: 13px;
}
table.data tr.row {
  cursor: pointer;
  transition: background 0.05s;
}
table.data tr.row:hover {
  background: var(--panel-2);
}
table.data tr.row.expanded {
  background: var(--panel-2);
}
table.data tr.row.expanded td {
  border-bottom-color: transparent;
}
table.data tr:last-child td {
  border-bottom: none;
}

table.data .name {
  font-weight: 500;
}
table.data .sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
table.data .mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text-dim);
}
table.data .phone-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
table.data .phone-stack .ph-label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
}

/* Score badge — circle with score and /10 below */
.score-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-weight: 600;
  font-size: 14px;
  color: #0a0a0a;
  line-height: 1;
}
.score-badge .out {
  font-size: 8px;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.6);
}
.score-badge.empty {
  background: var(--panel-3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
}

/* Category pill */
.cat-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid currentColor;
}
.cat-pill.qualified {
  color: var(--cat-qualified);
}
.cat-pill.interested {
  color: var(--cat-interested);
}
.cat-pill.watch {
  color: var(--cat-watch);
}
.cat-pill.non-qualified {
  color: var(--cat-non-qualified);
}
.cat-pill.service {
  color: var(--cat-service);
}
.cat-pill.no-fit {
  color: var(--cat-no-fit);
}
.cat-pill.none {
  color: var(--text-muted);
  border-style: dashed;
}

/* Status pill (Contacts) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
}
.status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.status-pill.active .dot {
  background: var(--status-active);
}
.status-pill.dormant .dot {
  background: var(--status-dormant);
}
.status-pill.churned .dot {
  background: var(--status-churned);
}
.status-pill.vip .dot {
  background: var(--status-vip);
}

/* Origin pill */
.origin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  color: var(--text);
  border: 1px solid var(--border-soft);
}
.origin-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.origin-pill[data-origin="Instagram"] .dot {
  background: var(--origin-instagram);
}
.origin-pill[data-origin="Facebook"] .dot {
  background: var(--origin-facebook);
}
.origin-pill[data-origin="Website"] .dot {
  background: var(--origin-website);
}
.origin-pill[data-origin="Call Center"] .dot {
  background: var(--origin-callcenter);
}
.origin-pill[data-origin="WhatsApp"] .dot {
  background: var(--origin-whatsapp);
}
.origin-pill[data-origin="Other"] .dot {
  background: var(--origin-other);
}

/* Avatar (initials in colored circle) */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  color: #0a0a0a;
  flex-shrink: 0;
}

/* Expanded row detail */
.detail-row td {
  background: var(--panel-2);
  padding: 18px 24px;
}
.detail {
  display: grid;
  grid-template-columns: 280px 1fr 1fr 160px;
  gap: 20px;
  align-items: start;
}
.detail .ai-card {
  background: var(--bg);
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
}
.detail .ai-card .ai-tag {
  display: inline-block;
  background: var(--violet);
  color: #0a0a0a;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.detail .ai-card .ai-headline {
  font-size: 11px;
  color: var(--text);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.detail .ai-card .ai-body {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.detail .ai-card .signals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}
.detail .signal {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--panel-3);
  display: inline-flex;
  align-items: center;
}
.detail .signal.pos {
  color: var(--ok);
}
.detail .signal.neg {
  color: var(--danger);
}

.detail .section .lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.detail .section .val {
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
}
.detail .actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.detail .actions .btn {
  background: var(--panel-3);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.detail .actions .btn:hover {
  background: var(--accent-dim);
  color: #0a0a0a;
}

/* ─── Home page list cards ─────────────────────────────────── */
.list-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 18px 20px;
}
.list-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.list-card-head h2 {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.list-card-head .badge {
  font-size: 11px;
  color: var(--ok);
  font-weight: 500;
}
.list-card .row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.list-card .row:last-child {
  border-bottom: none;
}
.list-card .row .meta {
  flex: 1;
}
.list-card .row .name {
  font-weight: 500;
  color: var(--text);
  font-size: 13px;
}
.list-card .row .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.list-card .row .when {
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.list-card .row.new::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: -4px;
}

/* ─── Charts (SVG containers) ──────────────────────────────── */
.chart-area {
  width: 100%;
  height: 240px;
  position: relative;
}
.chart-area svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ─── Ranking / Top deals list ─────────────────────────────── */
.rank-list {
  display: flex;
  flex-direction: column;
}
.rank-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
}
.rank-row:last-child {
  border-bottom: none;
}
.rank-row .rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--panel-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.rank-row .name {
  font-weight: 500;
}
.rank-row .sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.rank-row .you-badge {
  display: inline-block;
  background: var(--info);
  color: #0a0a0a;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-left: 6px;
  text-transform: uppercase;
}
.rank-row .amount {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

/* ─── Funnel ───────────────────────────────────────────────── */
.funnel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.funnel-step {
  display: grid;
  grid-template-columns: 1fr 60px;
  gap: 12px;
  align-items: center;
}
.funnel-step .bar {
  height: 36px;
  border-radius: 6px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  background: linear-gradient(90deg, var(--info), rgba(96, 165, 250, 0.4));
}
.funnel-step .bar.s2 {
  background: linear-gradient(90deg, #5a8de8, rgba(90, 141, 232, 0.4));
}
.funnel-step .bar.s3 {
  background: linear-gradient(90deg, #4a7bcc, rgba(74, 123, 204, 0.4));
}
.funnel-step .bar.s4 {
  background: linear-gradient(90deg, var(--ok), rgba(74, 222, 128, 0.5));
}
.funnel-step .count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}
.funnel-conversion {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}
.funnel-conversion strong {
  color: var(--ok);
  font-weight: 600;
}

/* ─── Period toggle ────────────────────────────────────────── */
.period-toggle {
  display: inline-flex;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 2px;
}
.period-toggle button {
  background: transparent;
  color: var(--text-dim);
  border: 0;
  padding: 5px 14px;
  font-family: inherit;
  font-size: 11px;
  border-radius: 5px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.period-toggle button.active {
  background: var(--panel-3);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

/* ─── Empty states ─────────────────────────────────────────── */
.empty {
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 56px 24px;
  text-align: center;
  color: var(--text-dim);
}
.empty h2 {
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 8px;
}
.empty p {
  margin: 4px 0;
  font-size: 13px;
}
.empty .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}
.empty code {
  background: var(--panel-2);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.inline-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  font-size: 12px;
}

/* ─── Footer ───────────────────────────────────────────────── */
.appfoot {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-deep);
  border-top: 1px solid var(--border);
  padding: 10px 28px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
  z-index: 50;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.appfoot .sep {
  margin: 0 8px;
  color: var(--border);
}

/* ─── Admin page ───────────────────────────────────────────── */
.subnav {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 2px;
}
.subnav a {
  padding: 8px 14px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.1s;
}
.subnav a:hover {
  color: var(--text);
}
.subnav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.flag-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.flag-card .flag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.flag-card .flag-info {
  flex: 1;
}
.flag-card .flag-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.flag-card .flag-title .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.flag-card .flag-title .status-dot.on {
  background: var(--ok);
}
.flag-card .flag-title .status-dot.off {
  background: var(--text-muted);
}
.flag-card .flag-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}
.flag-card .flag-override {
  display: inline-block;
  font-size: 10px;
  color: var(--warn);
  background: rgba(245, 158, 11, 0.12);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  background: var(--panel-3);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all 0.15s;
}
.toggle.on {
  background: var(--ok);
  border-color: var(--ok);
}
.toggle.on::after {
  left: 20px;
  background: #0a0a0a;
}

.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  border: 0;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary:hover {
  background: #6ee7d8;
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-secondary {
  background: var(--panel-3);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}
.btn-secondary:hover {
  border-color: var(--text-dim);
}

.kv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.kv-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.kv-table tr:last-child td {
  border-bottom: none;
}
.kv-table td.k {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  font-weight: 600;
  width: 200px;
}
.kv-table td.v {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kv-table td.v.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text-dim);
}
.kv-table .pill-ok {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(74, 222, 128, 0.12);
  color: var(--ok);
  font-size: 11px;
}
.kv-table .pill-bad {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  font-size: 11px;
}

.toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-3);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 200;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: toast-in 0.2s ease-out;
}
.toast.success {
  border-color: var(--accent-dim);
}
.toast.error {
  border-color: var(--danger);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Agent status dot */
.agent-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}
.agent-dot.active {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.15);
}
.agent-dot.idle {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
.agent-dot.away {
  background: #fb923c;
}
.agent-dot.offline {
  background: var(--text-muted);
}

input.cell-input,
select.cell-select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
  min-width: 100px;
}
input.cell-input:focus,
select.cell-select:focus {
  border-color: var(--accent-dim);
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 720px) {
  .topbar {
    padding: 12px 16px;
  }
  .topnav {
    display: none;
  }
  #app {
    padding: 16px;
  }
  .progress-panel .progress-head {
    grid-template-columns: 1fr 1fr;
  }
}
