:root {
  /* Brand accent — deliberately distinct from the semantic status colors below */
  --accent: #6d6af7;
  --accent-dark: #5753e6;
  --accent-soft: rgba(109, 106, 247, 0.16);
  --accent-soft-strong: rgba(109, 106, 247, 0.28);

  /* Semantic status colors */
  --blue: #6d6af7;
  --blue-dark: #5753e6;
  --green: #12b886;
  --green-dark: #0ca678;
  --green-soft: rgba(18, 184, 134, 0.16);
  --red: #f5455c;
  --red-soft: rgba(245, 69, 92, 0.16);
  --amber: #f5a524;
  --amber-soft: rgba(245, 165, 36, 0.16);
  --gray: #6b7383;

  /* Surfaces */
  --bg: #0a0c11;
  --bg-elevated: #10131a;
  --card: #141821;
  --card-hover: #1a1f2b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* Text */
  --text: #f2f4f8;
  --text-muted: #8b93a3;
  --text-dim: #575f6e;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 16px 40px -10px rgba(0, 0, 0, 0.65);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --sidebar-w: 188px;
  --content-max: 1560px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 16px;
}

::selection { background: var(--accent-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Brand ---- */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.brand-word {
  font-weight: 800;
  font-size: 15.5px;
  letter-spacing: -0.02em;
}

/* ---- Sidebar (desktop) ---- */
.sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  flex-direction: column;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 18px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.sidebar-nav .navbtn {
  position: relative;
  flex-direction: row;
  justify-content: flex-start;
  gap: 9px;
  padding: 7px 10px 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav .navbtn .navicon { font-size: 13px; width: 14px; text-align: center; color: var(--text-dim); transition: color 0.15s ease; }

.sidebar-nav .navbtn:hover { background: var(--card); color: var(--text); }
.sidebar-nav .navbtn.active { background: var(--accent-soft); color: var(--text); }
.sidebar-nav .navbtn.active .navicon { color: var(--accent); }

.sidebar-nav .navbtn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 14px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sidebar-footer { padding: 8px 6px 2px; }
.sidebar-footer .queue-badge { display: block; width: 100%; text-align: center; font-size: 10.5px; padding: 5px 8px; }

/* ---- Topbar (mobile) ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.queue-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 999px;
}

.app {
  padding: 16px 16px 90px;
  max-width: 900px;
  margin: 0 auto;
  animation: fadeIn 0.28s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Bottom nav (mobile) ---- */
.bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.navbtn {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 2px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.navbtn.active { color: var(--accent); }
.navicon { font-size: 18px; }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.3s ease;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

@media (min-width: 600px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: 27px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Hero stat: the one number per zone that should catch your eye first */
.stat-card.hero {
  border-color: var(--accent-soft-strong);
  background: linear-gradient(165deg, var(--card-hover), var(--card));
  box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow-md);
}

.stat-card.hero .stat-value { font-size: 32px; color: var(--accent); }
.stat-card.hero.tone-green .stat-value { color: var(--green); }
.stat-card.hero.tone-red .stat-value { color: var(--red); }
.stat-card.hero .stat-label { color: var(--text); opacity: 0.75; }

h1, h2, h3 { margin: 0 0 10px; letter-spacing: -0.015em; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }

.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 20px 0 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  min-height: 44px;
  transition: filter 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--card-hover); color: var(--text); border: 1px solid var(--border-strong); }
.btn.secondary:hover { background: #232936; }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.amber { background: var(--amber); color: #201400; }
.btn.gray { background: var(--gray); }
.btn.block { width: 100%; }
.btn.small { padding: 8px 12px; font-size: 12.5px; min-height: 34px; }
.btn:disabled { opacity: 0.45; cursor: default; filter: none; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Lightweight text-style CTA, e.g. "See full trends →" — intentionally not a boxed button */
.link-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  padding: 4px 2px;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: gap 0.15s ease, color 0.15s ease;
}
.link-cta:hover { gap: 7px; color: #a5a3ff; }

input[type=text], input[type=number], input[type=date], input[type=datetime-local],
input[type=search], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  transition: border-color 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

textarea { resize: vertical; min-height: 60px; }

label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
  margin-top: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}

.field-grid .full { grid-column: 1 / -1; }

/* ---- Call Next view ---- */
.lead-hero {
  text-align: center;
  padding: 22px 16px;
}

.lead-hero .name {
  font-size: 25px;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.lead-hero .meta {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.call-btn {
  display: inline-block;
  font-size: 21px;
  font-weight: 800;
  color: #fff;
  background: var(--green);
  padding: 16px 24px;
  border-radius: 999px;
  text-decoration: none;
  min-width: 220px;
  box-shadow: 0 8px 24px -6px rgba(18, 184, 134, 0.45);
  transition: filter 0.15s ease;
}
.call-btn:hover { filter: brightness(1.08); }

.dispo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 6px;
}

@media (min-width: 500px) {
  .dispo-grid { grid-template-columns: repeat(4, 1fr); }
}

.dispo-btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 8px;
  font-weight: 700;
  font-size: 12.5px;
  color: #fff;
  cursor: pointer;
  min-height: 52px;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.dispo-btn:hover { filter: brightness(1.1); }
.dispo-btn:active { transform: scale(0.97); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  white-space: nowrap;
}

/* ---- Leads list ---- */
.lead-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lead-row:hover { border-color: var(--border-strong); background: var(--card-hover); }

.lead-row .lname { font-weight: 700; }
.lead-row .lmeta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.lead-row .lright { text-align: right; }

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
}

.filter-row select { min-width: 120px; width: auto; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.65);
  backdrop-filter: blur(3px);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
}

.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 18px;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 640px) {
  .modal-box { border-radius: 18px; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-close {
  border: none;
  background: var(--card);
  color: var(--text-muted);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.modal-close:hover { background: var(--card-hover); color: var(--text); }

.history-item {
  border-left: 2px solid var(--border-strong);
  padding: 6px 0 6px 12px;
  margin-bottom: 6px;
}

.history-item .htime { font-size: 11px; color: var(--text-dim); }

.toast-root {
  position: fixed;
  bottom: 70px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  background: var(--card-hover);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.2s ease;
}

/* ---- Empty states ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-pro {
  text-align: center;
  padding: 44px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
}

.empty-pro-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 20px;
  margin-bottom: 14px;
}

.empty-pro-title { font-size: 15px; font-weight: 700; color: var(--text); }
.empty-pro-desc { font-size: 13px; color: var(--text-muted); margin: 6px auto 0; max-width: 360px; line-height: 1.5; }
.empty-pro .btn-row { justify-content: center; margin-top: 16px; }

.funnel-row { margin-bottom: 12px; }
.funnel-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; font-weight: 600; }
.funnel-bar-bg { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px; height: 10px; overflow: hidden; }
.funnel-bar-fill { background: linear-gradient(90deg, var(--accent-dark), var(--accent)); height: 100%; border-radius: 6px; transition: width 0.4s ease; }

table.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

table.stats-table th, table.stats-table td {
  padding: 7px 9px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

table.stats-table th { color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
table.stats-table th:first-child, table.stats-table td:first-child { text-align: left; }

.table-scroll { overflow-x: auto; }

.top-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.spacer { flex: 1; }

.muted { color: var(--text-muted); font-size: 13px; }

.hidden { display: none !important; }

/* ---- Goal progress ---- */
.goal-progress-bg {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
  margin: 10px 0;
}

.goal-progress-fill {
  background: linear-gradient(90deg, var(--accent), var(--green));
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.goal-stats-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.goal-stats-row strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---- Integration status pills ---- */
.status-pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.status-pill.connected { background: var(--green); }
.status-pill.not_configured { background: var(--gray); }
.status-pill.error { background: var(--red); }
.status-pill.disabled { background: #40465433; color: var(--text-muted); }

.integration-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.integration-card:hover { border-color: var(--border-strong); background: var(--card-hover); }

.integration-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.integration-header .iname { font-weight: 700; font-size: 15px; }

.copy-box {
  display: flex;
  gap: 6px;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
  margin: 6px 0;
  color: var(--text-muted);
}

.copy-box button {
  flex-shrink: 0;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
}

.more-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.more-menu-item:hover { border-color: var(--border-strong); background: var(--card-hover); transform: translateX(2px); }

.more-menu-item .desc {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.kv-list { font-size: 13px; }
.kv-list .kv-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); gap: 12px; }
.kv-list .kv-row span:first-child { color: var(--text-muted); }
.kv-list .kv-row strong { font-variant-numeric: tabular-nums; text-align: right; }
.kv-list .kv-row:last-child { border-bottom: none; }

.pill-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.pill { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; font-size: 11.5px; color: var(--text-muted); }

/* ---- Pipeline ---- */
.pipeline-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.pipeline-summary .big { font-size: 30px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.pipeline-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 2px 14px;
  margin-bottom: 4px;
}

.pipeline-stage {
  flex: 1 1 0;
  min-width: 118px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pipeline-stage:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.pipeline-stage .pcount { font-size: 26px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.pipeline-stage .plabel { font-size: 10.5px; color: var(--text-muted); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

.pipeline-stage .pfill-bg { margin-top: 10px; height: 4px; border-radius: 2px; background: var(--bg-elevated); overflow: hidden; }
.pipeline-stage .pfill { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent-dark), var(--accent)); transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }

.pipeline-stage.tone-success { border-color: rgba(18, 184, 134, 0.35); }
.pipeline-stage.tone-success .pcount { color: var(--green); }
.pipeline-stage.tone-success .pfill { background: linear-gradient(90deg, var(--green-dark), var(--green)); }

.pipeline-arrow {
  flex: 0 0 auto;
  align-self: center;
  color: var(--text-dim);
  font-size: 20px;
  font-weight: 700;
  padding: 0 1px;
}

.pipeline-overlay-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pipeline-overlay-chip {
  background: var(--card);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pipeline-overlay-chip:hover { border-color: var(--border-strong); background: var(--card-hover); }
.pipeline-overlay-chip.tone-exit { color: #fb9caa; border-color: rgba(245, 69, 92, 0.3); }
.pipeline-overlay-chip.tone-followup { color: #ffc069; border-color: rgba(245, 165, 36, 0.3); }

/* ---- Needs Attention ---- */
.attention-card {
  border: 1px solid var(--amber);
  border-left-width: 3px;
  background: var(--amber-soft);
}

.attention-card.ok { border-color: var(--green); background: var(--green-soft); }
.attention-card.empty { border-color: var(--border); background: var(--card); border-left-width: 1px; }

.attention-rate-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; }
.attention-rate-row .rate-actual { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.attention-rate-row .rate-floor { font-size: 12px; color: var(--text-muted); }

/* ---- Trend / comparison ---- */
.delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.delta-pill.up { background: var(--green-soft); color: #34d399; }
.delta-pill.down { background: var(--red-soft); color: #fb7185; }
.delta-pill.flat { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }

.compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 700px) {
  .compare-grid { grid-template-columns: 1fr 1fr 1fr; }
}

.compare-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.compare-metric-row:last-child { border-bottom: none; }
.compare-metric-row .cmv { display: flex; align-items: baseline; gap: 7px; }
.compare-metric-row .cmv strong { font-size: 14px; font-variant-numeric: tabular-nums; }

.sparkline-wrap { margin-bottom: 16px; }
.sparkline-wrap .sp-title { font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.sparkline-wrap svg { display: block; width: 100%; height: 44px; }

/* ---- Batches / vendor performance ---- */
.roi-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.roi-badge .roi-val { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.roi-badge .roi-lbl { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; opacity: 0.8; margin-top: 1px; }
.roi-badge.tone-green { background: var(--green-soft); color: #34d399; }
.roi-badge.tone-red { background: var(--red-soft); color: #fb7185; }
.roi-badge.tone-flat { background: var(--bg-elevated); color: var(--text-muted); }

table.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
table.compare-table th, table.compare-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
table.compare-table th:first-child, table.compare-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--card); font-variant-numeric: normal; }
table.compare-table thead th { color: var(--text-muted); font-weight: 700; text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.03em; background: var(--bg-elevated); }
table.compare-table thead th:first-child { background: var(--bg-elevated); }
table.compare-table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }
table.compare-table tbody tr:nth-child(even) td:first-child { background: #171c26; }
table.compare-table td.best-val { color: #34d399; font-weight: 800; }

.view-toggle { display: flex; gap: 6px; margin-bottom: 14px; }
.view-toggle button.active { background: var(--accent); color: #fff; border-color: transparent; }

.command-zone-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 32px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.command-zone-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.command-zone-title::before {
  content: '';
  width: 4px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent);
  flex-shrink: 0;
}

/* =====================================================================
   Desktop layout overrides — kept together at the END of the stylesheet
   so they reliably win the cascade over the mobile-first base rules
   above (same-specificity selectors resolve by source order in CSS).
   ===================================================================== */
@media (min-width: 900px) {
  .sidebar { display: flex; }
  .topbar { display: none; }
  .bottomnav { display: none; }

  .app {
    margin: 0 0 0 var(--sidebar-w);
    padding: 30px 40px 56px;
    max-width: var(--content-max);
  }

  .toast-root { bottom: 24px; }

  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1200px) {
  .app { padding-left: 48px; padding-right: 48px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
