/* ═══════════════════════════════════════════════════════════════
 * Sovun Assistant — Calm UI design system (added 2026-06-01)
 * Sidebar nav, minimal bento dashboard, semantic color coding.
 * Legacy rules below still serve the other views (Leads, Setup, etc.)
 * ═══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07111f;
  color: #e6edf3;
  --panel: rgba(13, 17, 23, 0.9);
  --panel-2: #111827;
  --border: #2f3b4a;
  --border-soft: #1a2332;
  --sidebar: #0a1422;
  --muted: #9ca8b8;
  --green: #3ddc84;
  --blue: #58a6ff;
  --gold: #f2cc60;
  --yellow: #f2cc60;
  --red: #f87171;
  --teal: #5eead4;
}

* { box-sizing: border-box; }

/* The console body is the sidebar+main flex container (see body.console below).
   Kept OFF the global body so auth pages (login, reset-password) center normally. */
body { margin: 0; min-height: 100vh; }
.hero, .app-nav { display: none !important; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: 236px; flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column;
  padding: 24px 0; z-index: 10;
}
.sidebar .brand-row { padding: 0 20px 24px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; gap: 11px; }
.sidebar .brand-row .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  display: flex; align-items: center; justify-content: center;
  color: #07111f; font-weight: 800; font-size: 14px;
}
.sidebar .brand-text strong { display: block; color: #fff; font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.sidebar .brand-text small { display: block; color: var(--muted); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; margin-top: 2px; }
.sidebar nav { display: flex; flex-direction: column; padding: 18px 12px 0; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: #c9d1d9; font-size: 13.5px;
  text-decoration: none; cursor: pointer; user-select: none;
  margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.04); color: #fff; }
.sidebar nav a.active { background: rgba(61,220,132,0.1); color: #fff; }
.sidebar nav a.active .nav-dot { background: var(--green); }
.nav-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.nav-count { margin-left: auto; font-size: 10.5px; color: var(--muted); background: rgba(255,255,255,0.05); padding: 1px 7px; border-radius: 999px; }
.nav-count.alert { background: rgba(248,113,113,0.12); color: var(--red); }
.sidebar-footer { margin-top: auto; padding: 14px 14px 0; border-top: 1px solid var(--border-soft); }
.sidebar-footer .account { display: flex; align-items: center; gap: 10px; padding: 8px; }
.sidebar-footer .account .av {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: #07111f; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.sidebar-footer .account .info strong { display: block; color: #fff; font-size: 12.5px; font-weight: 500; }
.sidebar-footer .account .info small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 1px; }
.sidebar-footer .logout-link {
  display: block; padding: 8px; color: var(--muted); font-size: 12px;
  text-decoration: none; border-radius: 6px; cursor: pointer;
  background: none; border: none; width: 100%; text-align: left; font-family: inherit;
}
.sidebar-footer .logout-link:hover { color: var(--red); }

/* ── Main content shell ─────────────────────────────────────── */
.app-shell { flex: 1; min-width: 0; padding: 48px 56px 80px; max-width: 1000px; }
@media (max-width: 900px) { .app-shell { padding: 36px 28px 60px; } }
@media (max-width: 600px) { body { display: block !important; } .sidebar { display: none; } .app-shell { padding: 24px 18px; max-width: 100%; } }

.app-topbar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 36px; flex-wrap: wrap; gap: 18px; }
.app-topbar .greet h1 { font-size: 32px; font-weight: 500; line-height: 1.05; letter-spacing: -0.02em; color: #fff; margin: 0; word-spacing: normal; }
.app-topbar .greet .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.app-topbar .pill-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px; color: #c9d1d9;
  cursor: default;
}
.pill .pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(61,220,132,0.5); }
.pill.client { cursor: pointer; }
.pill.client strong, .pill.metric strong { color: #fff; font-weight: 600; }
.pill.metric { color: var(--green); }

/* ── Calm dashboard tiles ─────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
@media (max-width: 900px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .stat-row { grid-template-columns: 1fr; } }

.calm-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 140px;
}
.calm-tile h4 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0; }
.calm-tile.accent-g { border-left: 3px solid var(--green); }
.calm-tile.accent-y { border-left: 3px solid var(--yellow); }
.calm-tile.accent-r { border-left: 3px solid var(--red); }
.calm-tile.accent-t { border-left: 3px solid var(--teal); }
.big-num { font-size: 44px; font-weight: 300; letter-spacing: -0.03em; line-height: 1; color: #fff; margin-top: 12px; }
.big-num.warn { color: var(--red); }
.big-num.watch { color: var(--yellow); }
.tile-lbl { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

.recent-tile { padding: 0; margin-bottom: 18px; }
.recent-tile .head { padding: 22px 24px 6px; display: flex; justify-content: space-between; align-items: baseline; }
.recent-tile .head h4 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.recent-tile .head .meta { color: var(--muted); font-size: 12px; }
.recent-tile .head .meta a { color: var(--green); text-decoration: none; cursor: pointer; }
.recent-tile .list { padding: 8px 24px 18px; }

.calm-lead-row { display: grid; grid-template-columns: 60px 1fr auto; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border-soft); align-items: center; }
.calm-lead-row:last-child { border-bottom: none; }
.calm-lead-row .t { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.calm-lead-row .who { font-size: 14px; color: #fff; font-weight: 500; display: block; margin: 0; }
.calm-lead-row .svc { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.calm-lead-row .src {
  display: inline-block; padding: 1px 7px; border-radius: 5px;
  font-size: 10px; letter-spacing: 0.03em; color: var(--muted);
  background: rgba(255,255,255,0.04); font-weight: 600;
  margin-right: 6px; text-transform: lowercase;
}
.calm-lead-row .calm-badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; border: 1px solid transparent; white-space: nowrap;
}
.calm-lead-row .calm-badge.pending { background: rgba(242,204,96,0.1); border-color: rgba(242,204,96,0.3); color: var(--yellow); }
.calm-lead-row .calm-badge.confirmed { background: rgba(61,220,132,0.1); border-color: rgba(61,220,132,0.3); color: var(--green); }

.ai-banner {
  margin-top: 14px;
  padding: 16px 20px;
  background: rgba(94,234,212,0.07);
  border: 1px solid rgba(94,234,212,0.25);
  border-radius: 12px;
  display: flex; align-items: center; gap: 14px;
  font-size: 13.5px;
}
.ai-banner .ai-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--teal); color: #07111f;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.ai-banner b { color: #fff; font-weight: 600; }
.ai-banner .ai-cta {
  color: var(--teal); font-weight: 600; margin-left: auto; flex-shrink: 0;
  cursor: pointer; text-decoration: none;
  background: none; border: none; font-family: inherit; font-size: 13.5px;
}

.primary-action { margin-top: 32px; display: flex; justify-content: flex-end; }
.primary-action .primary-cta {
  padding: 12px 22px; border-radius: 999px;
  border: 1px solid var(--green);
  background: var(--green); color: #07111f;
  font-size: 13.5px; font-weight: 700;
  box-shadow: 0 4px 18px rgba(61,220,132,0.25);
  cursor: pointer; font-family: inherit;
}
.primary-action .primary-cta:hover { background: #4ce694; }

/* ── Calm dashboard view: hide all legacy panels, show only calm-* ── */
#dashboard-view.active-view { display: block; }
#dashboard-view > .section-title,
#dashboard-view > .command-bar-panel,
#dashboard-view > #dashboard-cards,
#dashboard-view > #setup-progress-panel,
#dashboard-view > .two-column,
#dashboard-view > #legacy-stubs,
#dashboard-view > article.panel { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
 * Legacy rules begin here — still in use by Leads / Setup / etc.
 * ═══════════════════════════════════════════════════════════════ */
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(24, 87, 126, 0.65), transparent 32rem),
    linear-gradient(135deg, #07111f, #0d1117 58%, #101827);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-start;
  padding: 2rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
}

h1, h2, h3 { margin: 0.2rem 0 0.5rem; }
h1 { font-size: clamp(2.5rem, 7vw, 5rem); letter-spacing: -0.035em; word-spacing: 0.08em; }
h2 { font-size: clamp(1.5rem, 4vw, 2.4rem); }
.hero-copy { max-width: 58rem; color: #c9d1d9; font-size: 1.12rem; }
.eyebrow { color: var(--green); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; font-size: 0.78rem; }
.hero-actions { display: grid; gap: 0.7rem; justify-items: end; }
.client-switcher {
  background: rgba(61, 220, 132, 0.07);
  border: 1px solid var(--green);
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
  min-width: 240px;
}
.switcher-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--green);
  margin-bottom: 0.35rem;
  font-weight: 800;
}
.client-switcher select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  margin: 0;
  font-weight: 700;
  background: #050b14;
}
.badge { border: 1px solid var(--gold); color: var(--gold); border-radius: 999px; padding: 0.55rem 0.8rem; white-space: nowrap; background: rgba(242, 204, 96, 0.08); }
.muted-badge { border-color: var(--blue); color: var(--blue); background: rgba(88, 166, 255, 0.08); }

.app-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.8rem clamp(1rem, 4vw, 3rem);
  background: rgba(7, 17, 31, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.app-nav button { background: transparent; border-color: var(--border); color: #c9d1d9; white-space: nowrap; }
.app-nav button.active { color: #07111f; background: var(--green); border-color: var(--green); }

.app-shell { padding: 1rem clamp(1rem, 4vw, 3rem) 3rem; }
.view { display: none; }
.active-view { display: grid; gap: 1rem; }
.two-column { display: grid; grid-template-columns: minmax(280px, 0.75fr) minmax(320px, 1.25fr); gap: 1rem; align-items: start; }
.leads-layout { grid-template-columns: minmax(280px, 420px) 1fr; }

.panel, .stat-card, .estimate-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.8rem; }
.muted { color: var(--muted); }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 1rem; }
.stat-card { display: grid; gap: 0.2rem; min-height: 8rem; }
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong { font-size: clamp(2rem, 5vw, 3.2rem); color: #fff; }
.safety-card { border-color: rgba(242, 204, 96, 0.6); }
.check-list { padding-left: 1.2rem; }
.check-list li { margin: 0.6rem 0; }

.setup-panel, .companies-panel { margin-bottom: 1rem; }
.setup-grid { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 0 1rem; }
.setup-grid label:has(textarea), .setup-grid button { grid-column: 1 / -1; }

label { display: grid; gap: 0.35rem; margin: 0.8rem 0; color: #c9d1d9; }
input, textarea, button, select {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #050b14;
  color: #e6edf3;
  padding: 0.82rem;
  font: inherit;
}
textarea { min-height: 170px; resize: vertical; }
.approval-note-label { margin-top: 1rem; }
.approval-note { min-height: 86px; }
button { cursor: pointer; background: #238636; border-color: #2ea043; font-weight: 800; }
button.secondary { background: #1f2937; border-color: var(--border); }
.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.leads, .estimate-grid { display: grid; gap: 1rem; }
.estimate-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.lead-card { border: 1px solid var(--border); border-radius: 18px; padding: 1rem; background: var(--panel-2); }
.lead-card h3, .estimate-card h3 { margin-top: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0; }
.chip { background: #1f2937; border: 1px solid var(--border); color: #c9d1d9; padding: 0.25rem 0.55rem; border-radius: 999px; font-size: 0.85rem; }
.overdue-chip { border-color: rgba(248, 113, 113, 0.8); color: #fecaca; background: rgba(127, 29, 29, 0.55); }
.price-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 0.7rem; margin: 0.7rem 0; }
.price-grid div { border: 1px solid rgba(61, 220, 132, 0.35); border-radius: 14px; padding: 0.8rem; background: rgba(61, 220, 132, 0.07); }
.price-grid span { display: block; color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; }
.price-grid strong { display: block; margin-top: 0.25rem; font-size: 1.05rem; color: #fff; }
pre { white-space: pre-wrap; background: #050b14; border: 1px solid var(--border); padding: 0.85rem; border-radius: 14px; overflow-x: auto; }
.warning { color: var(--gold); }
.qualification-card {
  margin: 1rem 0;
  padding: 0.9rem;
  border: 1px solid rgba(61, 220, 132, 0.45);
  border-radius: 16px;
  background: rgba(61, 220, 132, 0.07);
}
.qualification-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}
.qualification-head h4 { margin-top: 0; }
.qualification-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; }
.score-pill {
  min-width: 120px;
  text-align: center;
  border: 1px solid rgba(61, 220, 132, 0.7);
  border-radius: 14px;
  padding: 0.65rem;
  background: rgba(5, 11, 20, 0.72);
}
.score-pill strong { display: block; font-size: 1.35rem; color: #fff; }
.score-pill span { display: block; color: var(--green); font-size: 0.82rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.follow-up-panel {
  margin: 1rem 0;
  padding: 0.9rem;
  border: 1px solid rgba(88, 166, 255, 0.45);
  border-radius: 16px;
  background: rgba(88, 166, 255, 0.07);
}
.history-list { display: grid; gap: 0.45rem; margin-bottom: 0.8rem; }
.history-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.65fr) 1fr auto;
  gap: 0.6rem;
  align-items: start;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(5, 11, 20, 0.72);
}
.history-row span, .history-row small { color: var(--muted); }
.receipt-row {
  border-left: 3px solid var(--green);
  background: linear-gradient(90deg, rgba(61,220,132,0.08), rgba(5, 11, 20, 0.72));
}
.receipt-row strong { color: #fff; }
.receipt-row span { color: #d8fbe7; }
.activity-feed { display: grid; gap: 0.55rem; }
.activity-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) 1fr auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(17, 24, 39, 0.78);
}
.activity-row span, .activity-row small { color: var(--muted); }
.estimate-total { font-size: 2rem; font-weight: 900; color: #fff; }
.estimate-total small { display: block; font-size: 0.85rem; color: var(--muted); font-weight: 500; }

.phone-demo { display: grid; grid-template-columns: minmax(280px, 390px) 1fr; gap: 1.2rem; align-items: start; }
.phone-shell {
  width: min(100%, 390px);
  min-height: 720px;
  border: 12px solid #050b14;
  border-radius: 42px;
  background: #0d1117;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.phone-status { padding: 1rem; text-align: center; background: #050b14; color: var(--green); font-weight: 800; }
.phone-content { padding: 0.8rem; }
.compact-card { font-size: 0.92rem; }
.compact-card .button-row { display: grid; }

/* ── Wizard ─────────────────────────────────────────────────────────────────── */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 1.5rem 0 1.8rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}
.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
.wizard-step span {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--muted);
  background: #050b14;
  transition: all 0.2s;
}
.wizard-step small {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.wizard-step.active span {
  border-color: var(--green);
  background: rgba(61, 220, 132, 0.15);
  color: var(--green);
}
.wizard-step.active small { color: var(--green); }
.wizard-step.done span {
  border-color: var(--green);
  background: var(--green);
  color: #07111f;
}
.wizard-step.done small { color: var(--green); }
.wizard-divider {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 1.5rem;
  margin-bottom: 1.4rem;
}
.wizard-panel { display: none; }
.wizard-panel.active-panel { display: block; }
.wizard-heading {
  margin: 0 0 0.3rem;
  font-size: 1.15rem;
  color: #fff;
}
.wizard-note { margin: 0 0 1.2rem; font-size: 0.92rem; }
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.wizard-nav button { min-width: 9rem; }
.full-width { grid-column: 1 / -1; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.summary-section {
  background: #050b14;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
}
.summary-section h4 {
  margin: 0 0 0.7rem;
  color: var(--green);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.summary-section p { margin: 0.3rem 0; font-size: 0.9rem; }
.summary-section pre { margin: 0.3rem 0; font-size: 0.85rem; }

/* ── Setup Progress (active client dashboard) ───────────────────────────────── */
.setup-progress-panel { display: grid; gap: 1rem; }
.overall-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.overall-progress-bar {
  flex: 1;
  height: 14px;
  background: #050b14;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.overall-progress-bar div {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 0.4s ease;
}
.overall-progress strong {
  font-size: 1.8rem;
  font-weight: 800;
  min-width: 4.5rem;
  text-align: right;
}
.percent-complete { color: var(--green); }
.percent-warn { color: var(--gold); }
.percent-low { color: #f87171; }
.setup-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}
.setup-section {
  background: #050b14;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem;
}
.setup-section.setup-complete { border-color: var(--green); background: rgba(61, 220, 132, 0.07); }
.setup-section.setup-partial { border-color: var(--gold); background: rgba(242, 204, 96, 0.06); }
.setup-section.setup-empty { border-color: rgba(248, 113, 113, 0.5); }
.setup-section-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.setup-section-head strong { flex: 1; font-size: 0.95rem; }
.setup-icon { font-size: 1.1rem; }
.setup-complete .setup-icon { color: var(--green); }
.setup-partial .setup-icon { color: var(--gold); }
.setup-empty .setup-icon { color: #f87171; }
.setup-pct { font-size: 0.85rem; color: var(--muted); font-weight: 700; }
.setup-section-bar {
  background: rgba(0, 0, 0, 0.3);
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}
.setup-section-bar div {
  height: 100%;
  background: var(--green);
  transition: width 0.4s ease;
}
.setup-partial .setup-section-bar div { background: var(--gold); }
.setup-section small { color: var(--muted); font-size: 0.78rem; }

/* ── All Clients Overview ───────────────────────────────────────────────────── */
.clients-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.client-overview-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
}
.client-overview-card.is-active-client {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(61, 220, 132, 0.4);
}
.client-overview-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
}
.client-overview-head h3 { margin: 0 0 0.4rem; font-size: 1.2rem; }
.active-chip {
  background: rgba(61, 220, 132, 0.18);
  border-color: var(--green);
  color: var(--green);
  font-weight: 700;
}
.completeness {
  text-align: right;
  min-width: 110px;
}
.completeness-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.completeness strong {
  display: block;
  font-size: 1.4rem;
  color: var(--green);
  font-weight: 800;
  margin: 0.1rem 0;
}
.completeness-bar {
  background: #050b14;
  border: 1px solid var(--border);
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.2rem;
}
.completeness-bar div {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
  border-radius: 999px;
}
.completeness small { font-size: 0.7rem; color: var(--muted); }
.client-mini-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  padding: 0.85rem;
  background: #050b14;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.mini-stat {
  text-align: center;
  display: grid;
  gap: 0.15rem;
}
.mini-stat span {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.mini-stat strong {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}

/* ── Customer-facing dashboard ─────────────────────────────────────────────── */
.customer-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 1rem;
  align-items: start;
}
.customer-hero-card, .support-card {
  grid-column: span 3;
}
.customer-hero-card {
  border-color: rgba(61, 220, 132, 0.55);
  background: linear-gradient(135deg, rgba(61, 220, 132, 0.1), rgba(88, 166, 255, 0.08)), var(--panel);
}
.support-card {
  border-color: rgba(88, 166, 255, 0.6);
}
.support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.9rem 0;
}
.support-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid #2ea043;
  background: #238636;
  color: #fff;
  padding: 0.8rem 1rem;
  font-weight: 800;
  text-decoration: none;
}
.support-button.secondary-link {
  background: #1f2937;
  border-color: var(--border);
  color: #e6edf3;
}

/* ── Mobile install ─────────────────────────────────────────────────────────── */
.mobile-install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  align-items: start;
}
.install-card h3 { margin-top: 0.3rem; }
.phone-url-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #050b14;
  border: 1px solid var(--green);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  margin: 0.8rem 0;
}
.phone-url-box code {
  flex: 1;
  font-size: 1rem;
  color: var(--green);
  word-break: break-all;
  font-family: ui-monospace, monospace;
}
.phone-url-box button { flex-shrink: 0; padding: 0.5rem 1rem; }
.install-steps {
  padding-left: 1.2rem;
  margin: 0.5rem 0 0;
}
.install-steps li { margin: 0.7rem 0; line-height: 1.5; }
.small-note { font-size: 0.82rem; margin-top: 0.3rem; }
.qr-block {
  display: flex;
  justify-content: center;
  margin: 1rem 0 0.5rem;
}
.qr-block img {
  border-radius: 16px;
  border: 2px solid var(--green);
  padding: 0.5rem;
  background: #07111f;
  width: 180px;
  height: 180px;
}

@media (max-width: 1000px) {
  .two-column, .leads-layout, .phone-demo { grid-template-columns: 1fr; }
  .customer-dashboard-grid { grid-template-columns: 1fr; }
  .customer-hero-card, .support-card { grid-column: span 1; }
  .stats-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .setup-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
}

@media (max-width: 640px) {
  .hero { flex-direction: column; padding: 1.2rem; }
  .hero-actions { justify-items: start; }
  .app-shell { padding: 0.8rem; }
  .stats-grid, .setup-grid { grid-template-columns: 1fr; }
  .section-title { flex-direction: column; align-items: flex-start; }
  .activity-row, .history-row { grid-template-columns: 1fr; }
  .phone-shell { border-width: 6px; border-radius: 28px; min-height: auto; }
  .client-mini-stats { grid-template-columns: repeat(2, 1fr); }
  .client-overview-head { grid-template-columns: 1fr; }
  .completeness { text-align: left; }
}

.lead-contact {
  margin: 0.3rem 0 0.6rem;
  color: var(--muted, #9ca8b8);
  font-size: 0.92rem;
}
.lead-contact a {
  color: var(--green, #3ddc84);
  text-decoration: none;
}
.lead-contact a:hover { text-decoration: underline; }

.account-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.account-box .switcher-label {
  font-size: 0.78rem;
  color: #9fb3c8;
}

.command-bar { display: flex; gap: 8px; align-items: center; }
.command-bar input { flex: 1; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15); background: rgba(7,17,31,0.6); color: #e8f0f7; font: inherit; }
.command-output { margin-top: 12px; padding: 10px; border-radius: 8px; background: rgba(7,17,31,0.4); min-height: 1.4em; }
.command-output ul { margin: 8px 0 0; padding-left: 18px; }
.command-output code { background: rgba(255,255,255,0.05); padding: 1px 6px; border-radius: 4px; }

/* ═══════════════════════════════════════════════════════════════
 * In-app support messaging (#19)
 * ═══════════════════════════════════════════════════════════════ */
.messages-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .messages-layout { grid-template-columns: 1fr; } }

.thread-list {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; max-height: 70vh; overflow-y: auto;
}
.thread-list .thread-item {
  padding: 14px 16px; border-bottom: 1px solid var(--border-soft);
  cursor: pointer; transition: background .12s;
}
.thread-list .thread-item:last-child { border-bottom: none; }
.thread-list .thread-item:hover { background: rgba(255,255,255,0.03); }
.thread-list .thread-item.active { background: rgba(61,220,132,0.1); }
.thread-list .thread-item .tname { font-size: 13.5px; font-weight: 600; color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.thread-list .thread-item .tprev { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-list .thread-item .tunread {
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 1px 7px; flex-shrink: 0;
}

.thread-panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; display: flex; flex-direction: column; min-height: 360px;
}
.thread-scroll { flex: 1; padding: 20px; overflow-y: auto; max-height: 56vh; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; word-wrap: break-word; }
.msg .meta { font-size: 10.5px; color: var(--muted); margin-top: 5px; }
/* Messages the current user sent align right + green; the other side left + panel-2 */
.msg.mine { align-self: flex-end; background: rgba(61,220,132,0.14); border: 1px solid rgba(61,220,132,0.3); }
.msg.mine .meta { text-align: right; }
.msg.theirs { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); }
.msg-empty { color: var(--muted); font-size: 13px; text-align: center; margin: auto; }

.message-composer { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.message-composer textarea {
  flex: 1; resize: vertical; min-height: 42px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(7,17,31,0.7);
  color: var(--text); font-family: inherit; font-size: 13.5px;
}
.message-composer button {
  align-self: flex-end; padding: 10px 20px; border-radius: 999px;
  border: 1px solid var(--green); background: var(--green); color: #07111f;
  font-weight: 700; font-size: 13.5px; cursor: pointer; font-family: inherit;
}
.message-error { color: #ff8080; font-size: 12.5px; padding: 0 14px 12px; min-height: 1em; }

/* Per-client feature toggles (Setup view) */
.feature-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 8px 0 4px; }
.feature-toggle-row { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.feature-toggle-row input { width: 16px; height: 16px; }

/* ═══════════════════════════════════════════════════════════════
 * Control console (rebuild 2026-06-07) — drill-in detail, health,
 * client rows, sub-tabs. Layered on the existing calm design system.
 * ═══════════════════════════════════════════════════════════════ */
body.console { display: flex; }
.app-shell { max-width: 1100px; }

.eyebrow { color: var(--green); }
.sub { color: var(--muted); font-size: 14px; margin: 6px 0 28px; }

/* client rows */
.recent-tile .list { padding: 8px 22px 16px; }
.client-row { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.client-row:last-child { border-bottom: none; }
.client-row:hover .cname { color: var(--green); }
.client-row.active { background: rgba(61,220,132,0.06); }
.cname { font-size: 15px; font-weight: 600; color: #fff; transition: color .12s; }
.cmeta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.mini { font-size: 12.5px; color: var(--muted); text-align: right; }
.mini b { color: #fff; font-weight: 600; display: block; font-size: 16px; }

/* chips */
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; border: 1px solid transparent; white-space: nowrap; }
.chip.active { background: rgba(61,220,132,0.12); border-color: rgba(61,220,132,0.35); color: var(--green); }
.chip.trial { background: rgba(242,204,96,0.12); border-color: rgba(242,204,96,0.35); color: var(--yellow); }
.chip.attention { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.4); color: var(--red); }

/* activity feed */
.activity-row { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; align-items: baseline; }
.activity-row:last-child { border-bottom: none; }
.activity-row .when { color: var(--muted); font-size: 12px; min-width: 92px; }
.dotc { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* client detail */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.detail-head h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; color: #fff; }
.detail-head-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.back-btn { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); padding: 7px 12px; font-size: 13px; cursor: pointer; }
.back-btn:hover { border-color: var(--green); color: #fff; }
.vieweas-btn { background: rgba(88,166,255,0.12); border: 1px solid rgba(88,166,255,0.4); color: var(--blue); padding: 8px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.vieweas-btn:hover { background: rgba(88,166,255,0.2); }

.subtabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: 22px 0 24px; }
.subtab { padding: 10px 14px; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.subtab:hover { color: var(--text); }
.subtab.active { color: #fff; border-bottom-color: var(--green); }
.subpanel { display: none; }
.subpanel.active { display: block; }

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; font-size: 13.5px; }
.kv .k { color: var(--muted); }
.kv .v { color: #fff; }
.row-line { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.row-line:last-child { border-bottom: none; }
.row-line .meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.note { background: rgba(94,234,212,0.08); border: 1px solid rgba(94,234,212,0.25); border-radius: 10px; padding: 12px 16px; font-size: 13px; color: var(--text-2); }
.note b { color: #fff; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--blue); background: rgba(88,166,255,0.08); padding: 2px 8px; border-radius: 6px; }

/* health */
.health-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.hc { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.hc:last-child { border-bottom: none; }
.hc .ico { width: 20px; height: 20px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.hc.ok .ico { background: rgba(61,220,132,0.15); color: var(--green); }
.hc.warn .ico { background: rgba(242,204,96,0.15); color: var(--yellow); }
.hc.bad .ico { background: rgba(248,113,113,0.15); color: var(--red); }
.hc .lbl2 { color: #fff; }
.hc .det { color: var(--muted); font-size: 12px; margin-left: auto; text-align: right; }

/* buttons */
.btn { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: var(--text); font-size: 12.5px; cursor: pointer; font-family: inherit; }
.btn:hover { border-color: var(--green); }
.btn.danger { border-color: rgba(248,113,113,0.5); color: var(--red); }
.btn.danger:hover { background: rgba(248,113,113,0.1); border-color: var(--red); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary-cta { padding: 10px 18px; border-radius: 999px; border: 1px solid var(--green); background: var(--green); color: #07111f; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit; }
.primary-cta:hover { background: #4ce694; }

/* messages */
.messages-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
@media (max-width: 820px) { .messages-layout { grid-template-columns: 1fr; } }
.thread-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; display: flex; flex-direction: column; min-height: 360px; }
.thread-scroll { flex: 1; padding: 18px; overflow-y: auto; max-height: 56vh; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; word-wrap: break-word; }
.msg .meta { font-size: 10.5px; color: var(--muted); margin-top: 5px; }
.msg.mine { align-self: flex-end; background: rgba(61,220,132,0.14); border: 1px solid rgba(61,220,132,0.3); }
.msg.mine .meta { text-align: right; }
.msg.theirs { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); }
.msg-empty { color: var(--muted); font-size: 13px; text-align: center; margin: auto; padding: 12px; }
.message-composer { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.message-composer textarea { flex: 1; resize: vertical; min-height: 42px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: rgba(7,17,31,0.7); color: var(--text); font-family: inherit; font-size: 13.5px; }
.message-composer button { align-self: flex-end; padding: 10px 20px; border-radius: 999px; border: 1px solid var(--green); background: var(--green); color: #07111f; font-weight: 700; font-size: 13.5px; cursor: pointer; font-family: inherit; }
.message-error { color: #ff8080; font-size: 12.5px; min-height: 1em; }

/* toggle (feature switches) */
.toggle { width: 38px; height: 22px; background: #1f2937; border: 1px solid var(--border); border-radius: 999px; position: relative; cursor: pointer; flex-shrink: 0; }
.toggle.on { background: var(--green); border-color: var(--green); box-shadow: 0 0 12px rgba(61,220,132,0.35); }
.toggle::after { content: ''; position: absolute; top: 1px; left: 1px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: left .15s; }
.toggle.on::after { left: 17px; }
