/* Dashboard — consistent app shell on the shared design system. */

body {
  width: auto;
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
}

.app {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* ================= Mobile top bar ================= */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  align-items: center;
  gap: var(--space-3);
  padding:
    env(safe-area-inset-top, 0px)
    max(var(--space-3), env(safe-area-inset-right, 0px))
    0
    max(var(--space-3), env(safe-area-inset-left, 0px));
  background: rgba(28, 28, 28, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar-menu {
  width: 40px; height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}
.topbar-menu svg { width: 20px; height: 20px; display: block; }
.topbar-menu:hover { background: var(--primary-soft); border-color: var(--border-strong); color: var(--text-strong); }
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-strong);
}
.topbar-brand .brand-logo { width: 28px; height: 28px; }
.topbar-brand em {
  font-style: normal;
  color: var(--primary);
  font-weight: 600;
  font-size: 12px;
  margin-left: 2px;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease-out), visibility var(--dur);
}
body.nav-open .sidebar-scrim {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
body.nav-open {
  overflow: hidden;
}

/* ================= Sidebar ================= */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: rgba(28, 28, 28, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-3);
  padding-left: max(var(--space-3), env(safe-area-inset-left, 0px));
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 50;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-2) var(--space-2) var(--space-4);
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.15;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-3);
}
.side-brand .brand-logo {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}
.side-brand span {
  color: var(--primary);
  display: block;
  font-weight: 600;
  font-size: 12px;
}

.side-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  position: relative;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast), transform var(--dur-fast);
}
@media (hover: hover) {
  .nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
    transform: translateX(1px);
  }
  .nav-item.active:hover { background: var(--primary-hover); color: var(--primary-on); transform: none; }
}
.nav-item.active {
  background: var(--primary);
  color: var(--primary-on);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.nav-item.active .ni-badge {
  background: rgba(0, 0, 0, 0.12);
  color: var(--primary-on);
  box-shadow: none;
}
.ni-ico { width: 18px; height: 18px; flex: none; display: block; stroke: currentColor; }
.ni-label { flex: 1; text-align: left; }
.ni-badge:empty { display: none; }
.ni-badge {
  min-width: 20px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-on);
  background: var(--primary);
  border-radius: 999px;
  padding: 1px 7px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}
.side-foot { margin-top: auto; padding: var(--space-3) var(--space-2) var(--space-1); }
.sidebar-credits {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  border: 1px solid transparent;
  color: var(--primary-text);
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}
.sidebar-credits:hover {
  border-color: var(--border-strong);
  background: var(--primary-soft);
}
.sidebar-credits-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.sidebar-credits-value {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

/* ================= Content / page shell ================= */
.content {
  flex: 1;
  min-width: 0;
  padding: var(--content-pad);
  padding-right: max(var(--content-pad-x), env(safe-area-inset-right, 0px));
  padding-bottom: max(var(--content-pad-bottom), env(safe-area-inset-bottom, 0px));
  max-width: 1180px;
  width: 100%;
  position: relative;
}

.page-head { margin-bottom: var(--space-5); }
.page-head h1 {
  font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.lead {
  color: var(--muted);
  font-size: clamp(13px, 0.8rem + 0.2vw, 14px);
  margin-top: var(--space-1);
  max-width: 64ch;
  line-height: 1.55;
}

/* Panel enter + stagger */
.panel { animation: panelIn var(--dur) var(--ease-out) both; }
.panel.panel-enter { animation: none; }
.panel.panel-enter > * {
  animation: panelChildIn var(--dur-slow) var(--ease-out) both;
}
.panel.panel-enter > *:nth-child(1) { animation-delay: 0.02s; }
.panel.panel-enter > *:nth-child(2) { animation-delay: 0.06s; }
.panel.panel-enter > *:nth-child(3) { animation-delay: 0.1s; }
.panel.panel-enter > *:nth-child(4) { animation-delay: 0.14s; }
.panel.panel-enter > *:nth-child(5) { animation-delay: 0.18s; }
.panel.panel-enter > *:nth-child(6) { animation-delay: 0.22s; }
.panel.panel-enter > *:nth-child(7) { animation-delay: 0.26s; }
.panel.panel-enter > *:nth-child(n+8) { animation-delay: 0.3s; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes panelChildIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
  margin-bottom: var(--space-4);
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.card.hero {
  position: relative;
  overflow: hidden;
  border-color: var(--border-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow-md);
}
.card.hero::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  height: 3px; width: 100%;
  background: var(--primary-grad);
}
.card h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.card h2 .ico {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.card h2 .ico svg {
  width: 15px; height: 15px;
  display: block;
}
.hint {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  margin-bottom: var(--space-3);
}
.hint em { color: var(--primary-text); font-style: normal; font-weight: 600; }
.hint strong { color: var(--text); }
.hint code, code {
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  font-size: 11.5px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
}

/* ---------- unified inputs ---------- */
#ap-query, #url-list,
.lead-search, .lead-group,
.field input, .field select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
#ap-query, #url-list {
  resize: vertical;
  min-height: 66px;
}
#url-list {
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  font-size: 12px;
}
#ap-query:focus, #url-list:focus,
.lead-search:focus, .lead-group:focus,
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.ap-actions {
  display: flex;
  gap: 10px;
  margin-top: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
}
.toolbar {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
  align-items: center;
}
.toolbar .spacer { flex: 1; min-width: 8px; }

/* ---------- option rows ---------- */
.slow-opt {
  font-size: 12.5px;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  margin: 0;
}
.slow-opt input[type="checkbox"] {
  width: auto;
  min-width: 0;
  flex: none;
  display: inline-block;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--primary);
}
.opt-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.opt-grid .slow-opt {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  background: var(--surface);
  transition: border-color .15s, background .15s;
}
.opt-grid .slow-opt:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.opt-grid .slow-opt:has(input:checked) { border-color: var(--primary); }
.opt-text { display: block; }
.opt-text b { font-weight: 600; display: block; }
.opt-text small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

/* ---------- lead filters ---------- */
.lead-filters {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.lead-search { flex: 1; min-width: min(220px, 100%); }
.lead-group { min-width: min(180px, 100%); width: auto; }
.exclude-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: var(--space-2) var(--space-3);
}
.exclude-box summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}
.exclude-box summary::-webkit-details-marker { display: none; }
.exclude-box summary::before { content: "▸ "; }
.exclude-box[open] summary::before { content: "▾ "; }
.exclude-box textarea {
  width: 260px;
  max-width: 100%;
  margin-top: var(--space-2);
  padding: var(--space-2) 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  font-size: 12px;
  resize: vertical;
}
.group-manage {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}
.group-manage summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
}
.group-manage summary::-webkit-details-marker { display: none; }
.group-manage summary::before { content: "▸ "; }
.group-manage[open] summary::before { content: "▾ "; }
.group-manage-list {
  margin-top: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.group-manage-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: 6px var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.group-manage-row .gm-name { flex: 1; min-width: 120px; font-size: 13px; font-weight: 600; }
.group-manage-row button { font-size: 12px; padding: 4px 10px; }
.biz-groups { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.biz-groups .g-source { font-weight: 600; color: var(--muted); }
.biz-groups .g-custom { color: var(--primary); }

/* ---------- stat tiles ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: var(--space-4);
}
.stats:has(> :nth-child(5)),
.stats.stats-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.stats.stats-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stat {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
@media (hover: hover) {
  .stat:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
}
.stat-ico {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--primary-soft);
  color: var(--primary);
}
.stat-ico svg { width: 16px; height: 16px; display: block; }
.stat-ico.green { background: var(--green-soft); color: var(--green); }
.stat-ico.purple { background: var(--purple-soft); color: var(--purple); }
.stat-ico.orange { background: var(--orange-soft); color: var(--orange); }
.stat-body { min-width: 0; flex: 1; }
.stat .n {
  font-size: clamp(1.15rem, 1rem + 0.4vw, 1.4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}
.stat .l {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat.email .n { color: var(--green-text); }
.stat.saved .n { color: var(--primary); }
.table-wrap {
  max-height: min(60vh, 520px);
  overflow-y: auto;
  scrollbar-gutter: stable;
}
/* Infinite-scroll sentinel under each table; holds "Loading more…" while a page loads. */
.list-more {
  min-height: 1px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.list-more:not(:empty) { padding: 10px 0; }

/* ================= Hero banner (Overview) ================= */
.hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 32px) clamp(18px, 3.5vw, 36px);
  margin-bottom: var(--space-5);
  color: #fff;
  background: var(--hero-grad);
  box-shadow: var(--shadow-lg);
}
.hb-orb { position: absolute; border-radius: 50%; filter: blur(2px); opacity: 0.5; pointer-events: none; }
.hb-orb-1 {
  width: 300px; height: 300px; right: -70px; top: -120px;
  background: radial-gradient(circle, rgba(255,255,255,0.28), transparent 68%);
}
.hb-orb-2 {
  width: 240px; height: 240px; right: 130px; bottom: -140px;
  background: radial-gradient(circle, rgba(129,140,248,0.5), transparent 66%);
}
.hb-content { position: relative; z-index: 1; max-width: 680px; }
.hb-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  padding: 4px 12px;
  border-radius: 999px;
}
.hb-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #7ee787;
  box-shadow: 0 0 0 3px rgba(126,231,135,0.3);
}
.hero-banner h1 {
  color: #fff;
  font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.75rem);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: var(--space-4) 0 10px;
  text-wrap: balance;
}
.hero-banner p {
  color: rgba(255,255,255,0.86);
  font-size: clamp(13px, 0.8rem + 0.25vw, 14.5px);
  line-height: 1.55;
  max-width: 620px;
}
.hb-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
  flex-wrap: wrap;
}
.hb-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--primary-on);
  border: none;
  box-shadow: 0 6px 16px rgba(0,0,0,0.14);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), box-shadow var(--dur-fast);
}
.hb-btn svg { width: 17px; height: 17px; }
@media (hover: hover) {
  .hb-btn:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,0.18); }
}
.hb-btn:active { transform: translateY(0) scale(0.98); }
.hb-btn.ghost {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: none;
}
@media (hover: hover) {
  .hb-btn.ghost:hover { background: rgba(255,255,255,0.2); box-shadow: none; }
}

.section-title {
  font-size: clamp(0.9rem, 0.85rem + 0.25vw, 1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: var(--space-2) 0 var(--space-4);
}

/* ================= Feature grid (Overview) ================= */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-4);
}
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-pad);
  box-shadow: var(--shadow-md);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur-fast);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.feature::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 3px;
  background: var(--feat, var(--primary));
  opacity: 0;
  transition: opacity var(--dur-fast);
}
@media (hover: hover) {
  .feature:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
  }
  .feature:hover::before { opacity: 1; }
}
.feat-tile {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #050404;
  background: var(--feat-grad, var(--primary-grad));
  box-shadow: 0 6px 14px var(--feat-shadow, rgba(0,0,0,0.35));
}
.feat-tile svg { width: 22px; height: 22px; }
.feat-step {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 14px 0 4px;
}
.feature h3 { font-size: 15px; font-weight: 700; margin: 0 0 6px; }
.feature p { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.link-btn {
  display: inline-block;
  margin-top: var(--space-3);
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--feat, var(--primary));
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.feat-blue   { --feat: #ffffff; --feat-grad: linear-gradient(135deg,#ffffff,#e8e8e8); --feat-shadow: rgba(0,0,0,0.35); }
.feat-emerald{ --feat: #34d399; --feat-grad: linear-gradient(135deg,#059669,#34d399); --feat-shadow: rgba(52,211,153,0.30); }
.feat-violet { --feat: #a78bfa; --feat-grad: linear-gradient(135deg,#7c3aed,#a78bfa); --feat-shadow: rgba(167,139,250,0.30); }
.feat-amber  { --feat: #c6a052; --feat-grad: linear-gradient(135deg,#c6a052,#fbbf24); --feat-shadow: rgba(198,160,82,0.30); }

/* ================= Guide list ================= */
.guide-list { display: flex; flex-direction: column; gap: var(--space-3); }
.guide-row { display: flex; align-items: center; gap: 18px; margin: 0; }
.guide-row h3 { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.guide-row p { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.guide-row .demo { flex: none; }

/* ================= Animated demos ================= */
.demo {
  position: relative;
  width: 100%;
  height: 96px;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, #252525, #1c1c1c);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.demo.sm { width: 120px; height: 72px; flex: none; }

.demo-scan .pin {
  position: absolute; top: 14px;
  width: 12px; height: 12px;
  border-radius: 50% 50% 50% 0;
  background: var(--primary);
  transform: rotate(-45deg);
  animation: pinDrop 2.4s ease-in-out infinite;
}
.demo-scan .rows { display: flex; flex-direction: column; gap: 5px; margin-top: 26px; width: 62%; }
.demo-scan .rows i {
  height: 7px; border-radius: 4px; background: #4a4a4a;
  opacity: 0; animation: rowIn 2.4s ease-in-out infinite;
}
.demo-scan .rows i:nth-child(1) { animation-delay: .5s; }
.demo-scan .rows i:nth-child(2) { animation-delay: .8s; width: 85%; }
.demo-scan .rows i:nth-child(3) { animation-delay: 1.1s; width: 70%; }
.demo-scan .rows i:nth-child(4) { animation-delay: 1.4s; width: 90%; }
@keyframes pinDrop {
  0%,100% { transform: rotate(-45deg) translateY(-6px); }
  20% { transform: rotate(-45deg) translateY(0); }
}
@keyframes rowIn {
  0%,30% { opacity: 0; transform: translateX(-8px); }
  45%,90% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

.demo-mail .env { font-size: 34px; color: var(--primary); }
.demo-mail .at {
  position: absolute; font-size: 15px; font-weight: 800;
  color: var(--primary); animation: atPulse 2s ease-in-out infinite;
}
.demo-mail .tick {
  position: absolute; right: 26px; bottom: 22px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; animation: tickIn 2s ease-in-out infinite;
}
@keyframes atPulse {
  0%,100% { transform: scale(1); opacity: .55; }
  50% { transform: scale(1.35); opacity: 1; }
}
@keyframes tickIn {
  0%,55% { opacity: 0; transform: scale(.4); }
  70%,100% { opacity: 1; transform: scale(1); }
}

.demo-name { gap: var(--space-2); }
.demo-name .chip {
  font-size: 11px; font-weight: 600; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px var(--space-2); box-shadow: var(--shadow-sm);
  color: var(--text);
}
.demo-name .chip.out {
  color: var(--text-strong); border-color: var(--border-strong);
  background: var(--primary-soft); animation: popIn 2.2s ease-in-out infinite;
}
.demo-name .arrow { color: var(--muted); font-weight: 800; animation: nudge 2.2s ease-in-out infinite; }
@keyframes popIn {
  0%,40% { opacity: 0; transform: scale(.6); }
  60%,100% { opacity: 1; transform: scale(1); }
}
@keyframes nudge {
  0%,100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

.demo-save .box {
  width: 46px; height: 54px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--primary);
  background: var(--surface);
}
.demo-save .fly {
  position: absolute; left: 20px;
  width: 22px; height: 6px; border-radius: 3px;
  background: var(--primary); opacity: 0;
  animation: fly 2.4s ease-in-out infinite;
}
.demo-save .fly.a { top: 30px; animation-delay: .2s; }
.demo-save .fly.b { top: 44px; animation-delay: .7s; }
.demo-save .fly.c { top: 58px; animation-delay: 1.2s; }
@keyframes fly {
  0% { opacity: 0; left: 14px; }
  25% { opacity: 1; }
  70% { opacity: 1; left: 52%; }
  100% { opacity: 0; left: 54%; }
}

.demo-auto .sw {
  width: 42px; height: 22px; border-radius: 999px;
  background: var(--border-strong); position: relative;
  animation: swOn 2.4s ease-in-out infinite;
}
.demo-auto .sw::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; animation: knob 2.4s ease-in-out infinite;
}
@keyframes swOn {
  0%,45% { background: var(--border-strong); }
  55%,100% { background: var(--primary); }
}
@keyframes knob {
  0%,45% { left: 3px; }
  55%,100% { left: 23px; }
}
.demo-dir { flex-direction: column; gap: 5px; }
.demo-dir i {
  height: 8px; width: 60%; border-radius: 4px;
  background: #c7d7f5; opacity: .4;
  animation: rowIn 2.1s ease-in-out infinite;
}
.demo-dir i:nth-child(2) { animation-delay: .4s; width: 46%; }
.demo-dir i:nth-child(3) { animation-delay: .8s; width: 54%; }

/* Sales Navigator paste-URL scrape card */
.sn-url-row { margin-top: 0; margin-bottom: var(--space-3); }
.sn-url-row input { flex: 1; min-width: 0; }
.sn-url-row button { flex: none; }
.sn-scrape-opts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 var(--space-3);
}
.sn-scrape-opts label[hidden] { display: none; }

/* live run progress */
.run-progress {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.rp-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-2);
}
.rp-phase {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
}
.rp-pct {
  font-weight: 800;
  font-size: 13px;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.rp-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.rp-fill, .rp-bar > span, #rp-fill, #maps-ep-fill, #php-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--primary-grad);
  transition: width .4s ease;
}
.rp-stats {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: 10px;
}
.rp-stat { font-size: 12px; color: var(--muted); }
.rp-stat b {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rp-current {
  margin-top: var(--space-2);
  font-size: 11.5px;
  color: var(--muted);
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-time {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: var(--space-2);
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.rp-time span:empty { display: none; }
.rp-note { margin-top: var(--space-2); font-size: 11.5px; color: var(--muted); }
.rp-stalled { color: var(--amber); font-weight: 600; }

/* ---------- Responsive ladder ---------- */
@media (max-width: 1100px) {
  .content { max-width: 100%; }
}

@media (max-width: 900px) {
  .sidebar {
    width: var(--sidebar-rail);
    padding: var(--space-3) var(--space-2);
    padding-left: max(var(--space-2), env(safe-area-inset-left, 0px));
  }
  .side-brand {
    justify-content: center;
    padding: var(--space-2) 0 var(--space-3);
  }
  .side-brand div,
  .nav-item .ni-label,
  .side-foot { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .nav-item.active { box-shadow: none; border-radius: var(--radius-sm); }
  .nav-item:hover { transform: none; }

  .content {
    padding: 24px 20px 48px;
    padding-right: max(20px, env(safe-area-inset-right, 0px));
    padding-bottom: max(48px, env(safe-area-inset-bottom, 0px));
  }

  .stats, .stats.stats-3, .stats.stats-5, .stats:has(> :nth-child(5)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .card.spotlight {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .card.spotlight .link-btn {
    margin-top: 0;
    width: 100%;
    text-align: left;
  }

  .page-hero { grid-template-columns: 1fr; }
  .page-hero-aside { justify-self: stretch; width: 100%; }

  .field, .field.grow, .field select, .field input, .field.narrow input {
    min-width: 0;
  }
  .lead-search, .lead-group { min-width: 0; }
  .filter-bar .filter-search,
  .filter-bar select { min-width: 0; }
  .results-head h2 { min-width: 0; }
}

@media (max-width: 768px) {
  .date-row { flex-direction: column; align-items: stretch; }
  .field, .field.grow, .field select, .field input, .field.narrow input {
    min-width: 0;
    width: 100%;
  }
  .lead-filters { flex-direction: column; align-items: stretch; }
  .lead-search, .lead-group { min-width: 0; width: 100%; }
  .filter-bar { align-items: stretch; }
  .filter-bar .filter-search { min-width: 0; width: 100%; }
  .filter-bar .dd-menu { width: 100%; }
  .filter-bar .dd-menu > summary { width: 100%; justify-content: center; }
  .dd-panel,
  .dd-filters .dd-panel {
    left: 0;
    right: 0;
    max-width: none;
    width: 100%;
  }

  .page-hero .ap-actions > .primary,
  .page-hero .ap-actions > a.primary,
  .page-hero .ap-actions > button.primary,
  .page-hero .hb-actions > .hb-btn {
    width: 100%;
    justify-content: center;
  }

  .toolbar { gap: 8px; }
  .ap-actions { gap: 8px; }
}

@media (max-width: 640px) {
  .topbar { display: flex; }

  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: min(300px, 88vw);
    height: 100vh;
    height: 100dvh;
    padding: var(--space-4) var(--space-3);
    padding-top: max(var(--space-4), env(safe-area-inset-top, 0px));
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom, 0px));
    padding-left: max(var(--space-3), env(safe-area-inset-left, 0px));
    transform: translateX(-105%);
    box-shadow: none;
    border-right: 1px solid var(--border);
  }
  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .side-brand {
    justify-content: flex-start;
    padding: var(--space-2) var(--space-2) var(--space-4);
  }
  .side-brand div { display: block; }
  .nav-item .ni-label { display: block; flex: 1; }
  .side-foot { display: block; }
  .nav-item { justify-content: flex-start; padding: 9px 11px; }
  .nav-item.active { box-shadow: inset 3px 0 0 var(--primary); }

  .content {
    padding:
      calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 16px)
      max(16px, env(safe-area-inset-right, 0px))
      max(40px, env(safe-area-inset-bottom, 0px))
      max(16px, env(safe-area-inset-left, 0px));
    max-width: none;
  }

  .hb-actions { gap: var(--space-2); }
  .hb-btn { width: 100%; justify-content: center; }

  .guide-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .guide-row .demo.sm { width: 100%; max-width: 160px; }

  .stats { gap: var(--space-2); }
  .feature-grid { grid-template-columns: 1fr; }

  .table-wrap {
    max-height: none;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
  }
  .table-wrap table { min-width: 640px; }
}

@media (max-width: 480px) {
  .stats, .stats.stats-3, .stats.stats-5, .stats:has(> :nth-child(5)) { grid-template-columns: 1fr; }
  .stat { min-width: 0; }
  .spot-ico { width: 40px; height: 40px; }
  .content-chrome { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .panel,
  .panel.panel-enter > * {
    animation: none !important;
  }
  .feature:hover,
  .card.spotlight:hover,
  .nav-item:hover,
  button.primary:hover,
  .hb-btn:hover {
    transform: none;
  }
}

/* ---------- date / field rows ---------- */
.date-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  align-items: flex-end;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}
.field input, .field select {
  font-size: 13px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  min-width: min(170px, 100%);
  width: auto;
  max-width: 100%;
}
.field.narrow input { min-width: min(110px, 100%); }
.field.grow { flex: 1; min-width: min(220px, 100%); }
.field.grow input { width: 100%; }
.field select { min-width: min(240px, 100%); }
.list-row { margin-top: 14px; }

.ph-extra {
  margin-top: 12px;
}
.ph-extra > summary {
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  user-select: none;
}
.ph-extra > summary::-webkit-details-marker { display: none; }
.ph-extra > summary::before { content: "▸ "; }
.ph-extra[open] > summary::before { content: "▾ "; }
.ph-extra .preset-row { margin-top: 10px; }
.ph-extra .opt-grid { margin-top: var(--space-3); }

.preset-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: 10px;
}
.chip {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
  box-shadow: none;
  cursor: pointer;
  transition: color var(--dur-fast), background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
@media (hover: hover) {
  .chip:hover {
    color: var(--primary-text);
    border-color: var(--primary);
    background: var(--primary-soft);
    transform: translateY(-1px);
  }
}
.chip.on {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

/* Overview spotlight */
.card.spotlight {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 18px);
  margin-bottom: var(--space-4);
  cursor: pointer;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur-fast);
}
@media (hover: hover) {
  .card.spotlight:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
  }
}
.spot-ico {
  width: 44px; height: 44px;
  flex: none;
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.spot-ico.ph {
  background: rgba(218, 85, 47, 0.18);
  color: #f97316;
}
.spot-ico.maps {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.spot-ico.sites {
  background: var(--green-soft);
  color: var(--green);
}
.spot-ico svg { width: 22px; height: 22px; }
.spot-body { flex: 1; min-width: 0; }
.spot-tag {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary);
  margin-bottom: 3px;
}
.spot-tag.ph { color: #f97316; }
.spot-tag.maps { color: #ffffff; }
.spot-tag.sites { color: var(--green); }
.spot-body h3 {
  font-size: clamp(0.9rem, 0.85rem + 0.3vw, 1rem);
  font-weight: 700;
  margin-bottom: 4px;
  text-wrap: balance;
}
.spot-body p { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.card.spotlight .link-btn {
  flex: none;
  white-space: nowrap;
}

.demo-ph { flex-direction: column; gap: 5px; }
.demo-ph .ph-mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #da552f;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: rowIn 2.1s ease-in-out infinite;
}
.demo-ph i {
  height: 6px; width: 54%; border-radius: 4px;
  background: #f3c4b5; opacity: .5;
  animation: rowIn 2.1s ease-in-out infinite;
}
.demo-ph i:nth-of-type(2) { animation-delay: .5s; width: 40%; }

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.8); }
}
.ni-live {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
  animation: livePulse 1.4s ease-in-out infinite;
}
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 7px;
  animation: livePulse 1.4s ease-in-out infinite;
}

.biz-name { font-weight: 600; }
.biz-meta, .biz-tail {
  max-width: 52ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.biz-tail { font-size: 11px; color: var(--muted); margin-top: 2px; }
td { vertical-align: top; }

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--green-text);
  background: var(--green-soft);
  border: 1px solid #bbf7d0;
  padding: 3px 10px;
  border-radius: 999px;
}
.ph-table { width: 100%; border-collapse: collapse; }
.ph-table th { text-align: left; }

.check-all-th {
  white-space: nowrap;
  vertical-align: middle;
}
.check-all-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.check-all-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent, var(--text-strong));
  line-height: 1;
}
.check-all-wrap.is-partial .check-all-label,
.check-all-wrap:not(.is-all) .check-all-label {
  display: none;
}
.th-with-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ph-prod { font-weight: 600; }
.ph-tag {
  font-size: 11.5px;
  color: var(--muted);
  max-width: 42ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ph-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ph-link { color: var(--primary); text-decoration: none; }
.ph-link:hover { text-decoration: underline; }
.ph-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.ph-badge.queued { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.ph-badge.working { background: var(--amber-soft); color: var(--amber); border-color: rgba(198, 160, 82, 0.4); }
.ph-badge.none { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.ph-badge.nosite { background: var(--red-soft); color: var(--red); border-color: rgba(248, 113, 113, 0.4); }
.ph-badge.saved { background: var(--primary-soft); color: var(--primary-text); border-color: var(--border-strong); }
.ph-email { color: var(--green-text); font-weight: 600; }

/* ---------- autosave switch + action list ---------- */
.switch-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) 14px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}
.switch-row:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.switch-row .sr-ico {
  width: 32px; height: 32px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  color: var(--amber);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.switch-row .sr-ico svg { width: 17px; height: 17px; }
.switch-row .sr-text { flex: 1; }
.switch-row .sr-text small {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.5;
}
.switch-input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-ui {
  width: 40px; height: 23px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background .18s;
  flex: none;
  margin-top: 4px;
}
.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: left .18s;
}
.switch-input:checked + .switch-ui { background: var(--green); }
.switch-input:checked + .switch-ui::after { left: 20px; }

.action-list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  display: grid;
  gap: 7px;
}
.action-list li {
  font-size: 12.5px;
  color: var(--muted);
  padding-left: 18px;
  position: relative;
  line-height: 1.5;
}
.action-list li::before {
  content: "›";
  position: absolute;
  left: 4px;
  color: var(--primary);
  font-weight: 700;
}
.action-list b { color: var(--text); font-weight: 600; }

/* ================= Page hero (source panels) ================= */
.page-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-5);
  align-items: center;
  border-radius: var(--radius-lg);
  padding: clamp(18px, 2.8vw, 28px) clamp(16px, 3vw, 32px);
  margin-bottom: var(--space-4);
  color: #fff;
  background: var(--hero-grad);
  box-shadow: var(--shadow-lg);
  border: none;
}
.page-hero.compact {
  grid-template-columns: 1fr;
  padding: clamp(16px, 2.5vw, 24px) clamp(16px, 2.8vw, 28px);
}
.page-hero .ph-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.45;
}
.page-hero .ph-orb-1 {
  width: 260px; height: 260px; right: -40px; top: -100px;
  background: radial-gradient(circle, rgba(255,255,255,0.28), transparent 68%);
}
.page-hero .ph-orb-2 {
  width: 180px; height: 180px; right: 160px; bottom: -90px;
  background: radial-gradient(circle, rgba(147,197,253,0.45), transparent 66%);
}
.page-hero-main { position: relative; z-index: 1; min-width: 0; }
.page-hero-aside { position: relative; z-index: 1; justify-self: end; width: min(100%, 280px); }
.page-hero .hb-badge { margin-bottom: 12px; }
.page-hero h2 {
  color: #fff;
  font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  display: block;
  text-wrap: balance;
}
.page-hero h2 .ico { display: none; }
.page-hero .hint,
.page-hero p.hero-copy {
  color: rgba(255, 255, 255, 0.86);
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 52ch;
  margin: 0 0 10px;
}
.page-hero .hint strong,
.page-hero .hint b,
.page-hero .hint em { color: #fff; }
.page-hero .ap-actions,
.page-hero .hb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.page-hero a.primary,
.page-hero button.primary,
.page-hero .hb-btn {
  background: #fff;
  color: var(--primary-on);
  border-color: #fff;
  box-shadow: 0 6px 16px rgba(0,0,0,0.14);
}
.page-hero a.primary:hover,
.page-hero button.primary:hover,
.page-hero .hb-btn:hover {
  background: var(--primary-hover);
  color: var(--primary-on);
}
.page-hero a.ghost-link,
.page-hero button.ghost-link,
.page-hero .hb-btn.ghost {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: none;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  padding: 10px 14px;
  border-radius: 10px;
}
.page-hero a.ghost-link:hover,
.page-hero button.ghost-link:hover,
.page-hero .hb-btn.ghost:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.page-hero .status { color: rgba(255,255,255,0.85); }
.page-hero .status.ok { color: #bbf7d0; }
.page-hero .status.err { color: #fecaca; }
.page-hero textarea,
.page-hero label.field input,
.page-hero label.field select,
.page-hero .date-row input,
.page-hero .date-row select {
  background: rgba(255,255,255,0.95);
  border-color: transparent;
  color: #121212;
}
.page-hero label.field,
.page-hero .slow-opt,
.page-hero .opt-text,
.page-hero .opt-text small,
.page-hero .preset-row .chip {
  color: rgba(255,255,255,0.92);
}
.page-hero .slow-opt {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.22);
}
.page-hero .chip {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
  color: #fff;
  box-shadow: none;
}
.page-hero .chip:hover { background: rgba(255,255,255,0.22); }
.page-hero .ph-extra > summary {
  color: rgba(255,255,255,0.85);
}
.page-hero .ph-extra > summary:hover {
  color: #fff;
}
.page-hero .run-progress {
  background: rgba(15, 23, 42, 0.18);
  border-color: rgba(255,255,255,0.18);
}
.page-hero .rp-bar {
  background: rgba(255,255,255,0.22);
}
.page-hero .rp-fill,
.page-hero #rp-fill,
.page-hero #php-fill {
  background: #fff;
}
.page-hero .rp-phase,
.page-hero .rp-pct,
.page-hero .rp-stat,
.page-hero .rp-current,
.page-hero .rp-time,
.page-hero .rp-note { color: rgba(255,255,255,0.9); }

.hero-demo-card {
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.35);
}
.hero-demo-card .hdc-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.hero-demo-card .hdc-name { font-weight: 700; font-size: 13px; color: var(--text-strong); }
.hero-demo-card .hdc-meta { font-size: 11px; color: var(--muted); }
.hero-demo-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hero-demo-steps .step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.hero-demo-steps .step b {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex: none;
}

/* Results card chrome */
.results-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.results-head h2 {
  margin: 0;
  flex: 1;
  min-width: min(180px, 100%);
}
.results-head .toolbar {
  margin: 0;
  flex-wrap: wrap;
}

.result-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
@media (max-width: 768px) {
  .result-tabs {
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, #000 90%, transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent);
  }
  .result-tabs::-webkit-scrollbar { display: none; }
}
.result-tabs button {
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  flex: none;
  white-space: nowrap;
}
.result-tabs button:hover {
  color: var(--text);
  background: transparent;
  border-color: transparent;
}
.result-tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: transparent;
}
.result-tabs .tab-count {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 1px 7px;
}
.result-tabs button.active .tab-count {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.filter-bar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: var(--space-3);
  align-items: center;
}
.filter-bar .filter-search {
  flex: 1;
  min-width: min(180px, 100%);
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238e8e8e' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m15 15-3.5-3.5'/%3E%3C/svg%3E") 12px 50% no-repeat;
  font: inherit;
  color: var(--text);
}
.filter-bar .filter-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.filter-bar select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  color: var(--text);
  min-width: min(140px, 100%);
  max-width: 100%;
}

/* Quick find-email actions beside search / Menus */
.filter-bar .find-email-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.filter-bar .find-email-btn .dd-ico {
  color: var(--text);
}
.filter-bar .find-email-btn:hover:not(:disabled) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.filter-bar .find-email-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.filter-bar .find-email-btn:disabled .dd-ico {
  color: var(--muted);
}

/* Compact All filters / Menus dropdowns beside search */
.filter-bar .dd-menu {
  position: relative;
  flex: none;
  z-index: 1;
}
.filter-bar .dd-menu[open] {
  z-index: 50;
}
/* Cards animate in (opacity/transform), so each is its own stacking context;
   lift the one with an open dropdown above the cards that follow it. */
.panel > *:has(.dd-menu[open]) {
  position: relative;
  z-index: 30;
}
.filter-bar .dd-menu > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  white-space: nowrap;
}
.filter-bar .dd-menu > summary::-webkit-details-marker { display: none; }
.filter-bar .dd-menu > summary::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
}
.filter-bar .dd-menu[open] > summary {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.dd-ico {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}
.filter-bar .dd-menu > summary .dd-ico { color: var(--text); }
.dd-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 260px;
  max-width: min(320px, calc(100vw - 24px));
  max-height: min(70vh, calc(100vh - 140px));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}
.dd-filters .dd-panel { left: 0; right: auto; }
.dd-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.dd-field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.dd-field select,
.dd-panel select {
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  color: var(--text);
}
.dd-panel .exclude-box,
.dd-panel .group-manage {
  width: 100%;
  margin: 0;
}
.dd-panel .exclude-box summary,
.dd-panel .group-manage summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.dd-panel .exclude-box summary::before,
.dd-panel .group-manage summary::before {
  content: none;
}
.dd-panel .exclude-box textarea {
  width: 100%;
}
.dd-actions-panel {
  gap: 4px;
  min-width: 240px;
  padding: 8px;
}
.dd-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transform: none;
}
.dd-item:hover {
  background: var(--surface-2);
  border-color: transparent;
  transform: none;
}
.dd-item:active {
  transform: none;
}
.dd-item .dd-ico {
  color: var(--muted);
}
.dd-item.danger,
button.dd-item.danger {
  color: var(--red, #dc2626);
  border: none;
  background: transparent;
}
.dd-item.danger:hover,
button.dd-item.danger:hover {
  background: var(--red-soft, #fef2f2);
  border-color: transparent;
}
.dd-item.primary,
button.dd-item.primary {
  margin-top: 4px;
  border: none;
  background: var(--primary);
  color: #fff;
}
.dd-item.primary:hover,
button.dd-item.primary:hover {
  filter: brightness(1.05);
  background: var(--primary);
  border-color: transparent;
  transform: none;
}
.dd-item.primary .dd-ico {
  color: #fff;
}
.dd-item[hidden] {
  display: none !important;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-text);
  background: var(--primary-soft);
  letter-spacing: 0.02em;
}
img.avatar {
  display: block;
  object-fit: cover;
  background: var(--surface-2);
  padding: 0;
  color: transparent;
}
.person-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}
.person-cell .person-text {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  max-width: 56ch;
}
.person-cell .person-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 600;
  color: var(--text-strong);
}
.person-cell .person-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.person-cell .person-sub {
  font-size: 11px;
  color: var(--muted);
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Business / person subtext shrinks with the viewport */
@media (max-width: 1100px) {
  .person-cell .person-text { max-width: 42ch; }
}
@media (max-width: 900px) {
  .person-cell .person-text { max-width: 32ch; }
}
@media (max-width: 640px) {
  .person-cell .person-text { max-width: 22ch; }
}

/* Maps Business column: share width so long addresses ellipsize instead of widening the table */
#maps-results .ph-table {
  table-layout: fixed;
}
#maps-results .ph-table th:nth-child(1),
#maps-results .ph-table td:nth-child(1) {
  width: 40px;
}
#maps-results .ph-table th:nth-child(2),
#maps-results .ph-table td:nth-child(2) {
  width: auto;
  overflow: hidden;
}
#maps-results .ph-table th:nth-child(3),
#maps-results .ph-table td:nth-child(3) {
  width: 16%;
  overflow: hidden;
}
#maps-results .ph-table th:nth-child(4),
#maps-results .ph-table td:nth-child(4) {
  width: 28%;
  max-width: 0; /* forces fixed-layout ellipsis inside the cell */
  overflow: hidden;
}
#maps-results .ph-table th:nth-child(5),
#maps-results .ph-table td:nth-child(5) {
  width: 56px;
}
#maps-results .person-cell .person-text {
  max-width: 100%;
}
#maps-results .status-cell {
  display: flex;
  max-width: 100%;
  min-width: 0;
}
#maps-results .status-cell > span:not(.status-dot) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Product Hunt: flexible columns; Maker / Action sizing */
#ph-results .ph-table {
  table-layout: fixed;
}
#ph-results .ph-table th:nth-child(1),
#ph-results .ph-table td:nth-child(1) {
  width: 40px;
}
#ph-results .ph-table th:nth-child(2),
#ph-results .ph-table td:nth-child(2) {
  width: 28%;
  min-width: 140px;
  overflow: hidden;
}
#ph-results .ph-table th:nth-child(3),
#ph-results .ph-table td:nth-child(3) {
  width: auto;
}
#ph-results .ph-table th:nth-child(4),
#ph-results .ph-table td:nth-child(4) {
  width: 16%;
  min-width: 100px;
}
#ph-results .ph-table th:nth-child(5),
#ph-results .ph-table td:nth-child(5) {
  width: 22%;
  min-width: 120px;
  overflow: hidden;
}
#ph-results .ph-table th:nth-child(6),
#ph-results .ph-table td:nth-child(6) {
  width: 12%;
  min-width: 88px;
}
#ph-results .ph-table th:nth-child(7),
#ph-results .ph-table td:nth-child(7) {
  width: 56px;
}
#ph-results .person-cell .person-text {
  max-width: 100%;
}
#ph-results .status-cell {
  max-width: 100%;
  min-width: 0;
}
#ph-results .status-cell > span:not(.status-dot) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.maker-cell {
  min-width: 0;
}
.maker-names {
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
}
.maker-more {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.maker-more:hover {
  text-decoration: underline;
}
.company-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.company-cell .company-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.company-mark {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: var(--muted);
  flex: none;
}
img.company-mark {
  display: block;
  object-fit: cover;
  padding: 0;
  color: transparent;
}
.site-domain-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.icon-btn.inline-icon {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  text-decoration: none;
}
.icon-btn.inline-icon svg { width: 14px; height: 14px; }
.icon-btn.inline-icon:hover {
  color: var(--text-strong);
  background: var(--primary-soft);
  border-color: var(--border-strong);
}
.icon-btn.inline-icon:disabled {
  opacity: 0.45;
  pointer-events: none;
}
.status-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
  max-width: 100%;
  min-width: 0;
}
.email-status-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.email-crawl-progress {
  margin: 0 0 12px;
}
.email-crawl-progress .rp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: var(--space-2);
}
.email-crawl-progress .rp-current {
  margin-top: 0;
  flex: 1;
  min-width: 0;
}
.email-crawl-progress .rp-foot .danger {
  flex: none;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--border-strong);
}
.status-dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(5,150,105,0.18); }
.status-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(180,83,9,0.18); }
.status-dot.err { background: var(--red); box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }
.status-dot.busy { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.row-actions .icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.row-actions .icon-btn svg { width: 15px; height: 15px; }
.row-actions .icon-btn:hover { color: var(--text-strong); background: var(--primary-soft); border-color: var(--border-strong); }
.row-actions .icon-btn.danger:hover { color: var(--red); background: var(--red-soft); border-color: rgba(248, 113, 113, 0.4); }

.stats-outside { margin-bottom: var(--space-4); }

.page-hero .opt-grid .slow-opt {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.22);
}
.page-hero .opt-grid .slow-opt:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.14);
}
.page-hero .opt-grid .slow-opt:has(input:checked) {
  border-color: rgba(255,255,255,0.55);
}
.live-chip {
  border-color: rgba(52, 211, 153, 0.35);
}
.filter-bar .filter-search {
  background-color: var(--surface);
}
.page-hero .hint { color: rgba(255,255,255,0.86); }
.results-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ================= Auth gate ================= */
body:not([data-auth="in"]) .topbar,
body:not([data-auth="in"]) .sidebar-scrim,
body:not([data-auth="in"]) .app { display: none !important; }
.auth-screen { display: none; }
body[data-auth="out"] .auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-6) var(--space-4);
  background:
    radial-gradient(900px 480px at 15% -10%, var(--primary-soft), transparent 70%),
    radial-gradient(700px 420px at 110% 110%, var(--purple-soft), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 4vw, 32px);
  box-shadow: var(--shadow-lg);
  animation: panelIn var(--dur-slow) var(--ease-out) both;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0;
  height: 3px; width: 100%;
  background: var(--primary-grad);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.15;
  color: var(--text-strong);
  margin-bottom: var(--space-5);
}
.auth-brand .brand-logo { width: 36px; height: 36px; }
.auth-brand span { color: var(--primary); display: block; font-weight: 600; font-size: 12px; }
.auth-card h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.google-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: var(--space-5);
  padding: 11px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-strong);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.google-signin:hover {
  background: var(--surface-2);
  border-color: var(--border-strong, var(--border));
}
.google-signin:disabled {
  opacity: 0.65;
  cursor: default;
}
.google-signin-icon {
  width: 20px;
  height: 20px;
  flex: none;
}
#auth-status {
  margin-top: var(--space-4);
}
/* ================= User chip / profile ================= */
.user-avatar {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-grad);
  color: #000;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0;
}
.user-avatar.lg { width: 64px; height: 64px; font-size: 22px; box-shadow: var(--shadow-md); }
.user-chip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: var(--space-3);
  border-radius: var(--radius);
  text-align: left;
  box-shadow: none;
}
.user-chip-text { display: flex; flex-direction: column; min-width: 0; }
.user-chip-name,
.user-chip-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip-name { font-weight: 600; color: var(--text-strong); font-size: 12.5px; }
.user-chip-email { color: var(--muted); font-size: 11px; font-weight: 400; }

.profile-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.profile-id { flex: 1; min-width: 180px; }
.profile-id h2 { font-size: 18px; margin-bottom: 2px; }
.profile-email { color: var(--text); font-weight: 500; word-break: break-all; }
.profile-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}
.profile-grid .card { margin-bottom: 0; }
.profile-grid .card h2 { margin-bottom: var(--space-3); }
.profile-grid label input { color: var(--text); }
.profile-grid label input:disabled { background: var(--surface-2); color: var(--muted); }
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
}

/* ================= Server loaders ================= */
@keyframes qpSpin { to { transform: rotate(360deg); } }
@keyframes qpSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.qp-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--primary-ring);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: qpSpin 0.7s linear infinite;
  flex-shrink: 0;
}
.qp-spinner.lg { width: 34px; height: 34px; border-width: 3px; }

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 18, 18, 0.78);
  backdrop-filter: blur(3px);
}
.page-loader[hidden] { display: none; }
.page-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-7);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.page-loader-text { color: var(--text); font-weight: 600; font-size: 14px; }

.qp-sync-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 1001;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.qp-sync-bar::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 40%;
  background: var(--primary-grad);
  animation: qpSlide 1.1s var(--ease-out) infinite;
}
.qp-sync-pill {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity var(--dur-fast), transform var(--dur-fast);
}
body.is-syncing .qp-sync-bar { opacity: 1; }
body.is-syncing .qp-sync-pill { opacity: 1; transform: none; }

/* Control that started a server request */
button.is-loading,
label.is-loading,
.is-loading > input,
.is-loading > select { cursor: progress; }
button.is-loading,
label.is-loading { position: relative; pointer-events: none; opacity: 0.85; }
button.is-loading { color: transparent !important; }
button.is-loading::after,
label.is-loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--primary-ring);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: qpSpin 0.7s linear infinite;
}
button.is-loading::after { top: calc(50% - 7px); left: calc(50% - 7px); }
button.primary.is-loading::after { border-color: rgba(0, 0, 0, 0.2); border-top-color: #000; }
label.is-loading::after { top: 6px; right: 6px; }
input.is-loading,
textarea.is-loading,
select.is-loading { cursor: progress; opacity: 0.7; }

/* Results table while prospects are fetched from the server */
.table-wrap.is-loading { position: relative; min-height: 140px; }
.table-wrap.is-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  background: rgba(28, 28, 28, 0.65);
}
.table-wrap.is-loading::after {
  content: '';
  position: absolute;
  top: 48px;
  left: calc(50% - 15px);
  z-index: 4;
  width: 30px;
  height: 30px;
  border: 3px solid var(--primary-ring);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: qpSpin 0.7s linear infinite;
}

.qp-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1002;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-strong);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}
.qp-toast[hidden] { display: none; }
.qp-toast.err { border-left-color: var(--red); }
.qp-toast.ok { border-left-color: var(--green); }

/* ================= Credits ================= */
.credits-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: 22px 24px;
  background:
    radial-gradient(120% 140% at 0% 0%, var(--primary-soft), transparent 55%),
    var(--surface);
  border-color: color-mix(in srgb, var(--primary) 18%, var(--border));
}
.credits-hero-main { min-width: 0; }
.credits-balance-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.credits-balance-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 6px;
}
.credits-balance-value {
  font-size: clamp(2.1rem, 1.6rem + 1.8vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-strong);
  line-height: 1;
}
.credits-balance-unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.credits-balance-meta {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary-text);
  background: var(--primary-soft);
}
.credits-refresh-btn { flex-shrink: 0; }
.credits-buy-card h2,
.credits-tx-card h2 { margin-bottom: var(--space-2); }
.credits-tx-card { margin-top: var(--space-4); }
#credits-tx-wrap.is-loading { opacity: 0.55; pointer-events: none; }
.credits-buy-lead { margin: 0 0 var(--space-4); max-width: none; }
.credits-pack-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.credits-packages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.credits-pack-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-height: 220px;
  padding: 18px 18px 16px;
  margin: 0;
  text-align: left;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: none;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}
.credits-pack-card:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface));
  transform: translateY(-2px);
}
.credits-pack-card.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent),
    0 10px 28px color-mix(in srgb, var(--primary) 12%, transparent);
}
.credits-pack-card.is-best {
  border-color: color-mix(in srgb, var(--green) 40%, var(--border));
}
.credits-pack-card.is-best.is-selected {
  border-color: var(--primary);
}
.credits-pack-card.is-busy {
  opacity: 0.6;
  cursor: progress;
  pointer-events: none;
  transform: none;
}
.credits-pack-card-top {
  display: flex;
  align-items: center;
  min-height: 22px;
  margin-bottom: 10px;
  width: 100%;
}
.credits-pack-badge-spacer {
  display: block;
  height: 22px;
}
.credits-best-value {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--green);
}
.credits-pack-amount {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-strong);
}
.credits-pack-unit {
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.credits-pack-price {
  margin-top: 14px;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--green);
}
.credits-pack-price-note {
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.credits-pack-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: auto;
  padding-top: 14px;
  width: 100%;
  border-top: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
}
.credits-pack-per {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
}
.credits-pack-per em {
  font-style: normal;
  font-weight: 500;
  color: var(--muted);
}
.credits-pack-savings {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
}
.credits-pack-savings.is-base {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
}
.credits-pack-select-mark {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.credits-pack-card.is-selected .credits-pack-select-mark {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px var(--surface);
}
.credits-pack-card.is-selected .credits-pack-select-mark::after {
  content: none;
}
.credits-payable {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
}
.credits-payable-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.credits-payable-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  line-height: 1.15;
}
.credits-payable.is-ready .credits-payable-value { color: var(--primary-text); }
.credits-payable.is-error .credits-payable-value { color: var(--red); font-size: 1.05rem; }
.credits-payable-meta {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
.credits-buy-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: var(--space-4);
}
#credits-pay-btn { min-width: 180px; }
.credits-tx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.credits-tx-table th,
.credits-tx-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.credits-tx-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.credits-tx-table .muted { color: var(--muted); text-align: center; padding: 28px 12px; }
.credits-tx-credits-pos { color: var(--green); font-weight: 700; }
.credits-tx-credits-neg { color: var(--red); font-weight: 700; }
.credits-type-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.credits-type-pill.purchase {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-color: transparent;
}
.credits-type-pill.signup_bonus {
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: var(--green);
  border-color: transparent;
}
.credits-tx-actions { margin-top: var(--space-3); }
@media (max-width: 1100px) {
  .credits-packages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .credits-packages {
    grid-template-columns: 1fr;
  }
  .credits-pack-card {
    min-height: 0;
  }
  .credits-pack-amount { font-size: 1.4rem; }
  .credits-pack-price { font-size: 1.35rem; }
}

/* ================= Analytics ================= */
#panel-analytics {
  --an-prospects: #94a3b8;
  --an-prospects-hi: #e2e8f0;
  --an-credits: #fbbf24;
  --an-credits-hi: #fde68a;
  --an-company: #34d399;
  --an-company-hi: #6ee7b7;
  --an-person: #a78bfa;
  --an-person-hi: #c4b5fd;
  --an-line: #38bdf8;
  --an-line-hi: #7dd3fc;
}

.analytics-summary .analytics-stat {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.03), transparent 55%),
    var(--surface);
}
.analytics-summary .analytics-stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}
.analytics-stat--prospects::before { background: var(--an-prospects-hi); }
.analytics-stat--company::before { background: var(--an-company); }
.analytics-stat--person::before { background: var(--an-person); }
.analytics-stat--credits::before { background: var(--an-credits); }
.analytics-stat--prospects .n { color: var(--an-prospects-hi); }
.analytics-stat--credits .n { color: var(--an-credits); }

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.analytics-card {
  margin-top: var(--space-4);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 255, 255, 0.035), transparent 55%),
    var(--surface);
}
.analytics-grid .analytics-card { margin-top: 0; }
.analytics-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.analytics-card-head h2 { margin: 0 0 4px; font-size: 1.05rem; }
.analytics-card-lead {
  margin: 0;
  max-width: none;
  font-size: 13px;
  color: var(--muted);
}
.analytics-tx-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.analytics-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}
.analytics-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.analytics-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.analytics-swatch--prospects { background: linear-gradient(180deg, var(--an-prospects-hi), var(--an-prospects)); }
.analytics-swatch--credits { background: linear-gradient(180deg, var(--an-credits-hi), var(--an-credits)); }
.analytics-swatch--company { background: linear-gradient(180deg, var(--an-company-hi), var(--an-company)); }
.analytics-swatch--person { background: linear-gradient(180deg, var(--an-person-hi), var(--an-person)); }
.analytics-swatch--line { background: linear-gradient(180deg, var(--an-line-hi), var(--an-line)); border-radius: 999px; }

.analytics-chart {
  min-height: 220px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 4px 0 2px;
}
.analytics-chart--wide,
.analytics-chart--line { min-height: 240px; }
.analytics-empty {
  margin: auto;
  padding: 28px 12px;
  font-size: 13.5px;
  text-align: center;
}
.analytics-svg {
  width: 100%;
  height: auto;
  max-height: 280px;
  overflow: visible;
}
.analytics-grid-line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}
.analytics-axis-label {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.analytics-col-bar {
  fill: url(#an-grad-prospects);
  transform-origin: bottom;
  animation: analytics-bar-in 0.55s var(--ease-out) both;
}
.analytics-col-bar--prospects { fill: url(#an-grad-prospects); }
.analytics-col-bar--credits { fill: url(#an-grad-credits); }
.analytics-col-bar--company {
  fill: var(--an-company);
  animation-delay: 0.05s;
}
.analytics-col-bar--person {
  fill: var(--an-person);
  animation-delay: 0.12s;
}
.analytics-col:nth-child(2) .analytics-col-bar { animation-delay: 0.06s; }
.analytics-col:nth-child(3) .analytics-col-bar { animation-delay: 0.12s; }
.analytics-col:nth-child(4) .analytics-col-bar { animation-delay: 0.18s; }
.analytics-col:nth-child(5) .analytics-col-bar { animation-delay: 0.24s; }
.analytics-col-value {
  fill: var(--text-strong);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.analytics-col-value--sm { font-size: 10px; fill: var(--text); }
.analytics-col-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.analytics-area { animation: analytics-fade-in 0.5s var(--ease-out) both; }
.analytics-line {
  fill: none;
  stroke: var(--an-line);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: analytics-fade-in 0.55s var(--ease-out) both;
}
.analytics-dot {
  fill: var(--bg);
  stroke: var(--an-line);
  stroke-width: 2;
}
.analytics-dot-halo {
  fill: rgba(56, 189, 248, 0.16);
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.analytics-dot-wrap:hover .analytics-dot-halo { opacity: 1; }
.analytics-tx-card {
  margin-top: var(--space-4);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(56, 189, 248, 0.05), transparent 50%),
    var(--surface);
}
#analytics-tx-wrap.is-loading { opacity: 0.55; pointer-events: none; }

@keyframes analytics-bar-in {
  from { opacity: 0; transform: scaleY(0.35); }
  to { opacity: 1; transform: scaleY(1); }
}
@keyframes analytics-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 960px) {
  .analytics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .analytics-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .analytics-card-head { gap: var(--space-2); }
  .analytics-chart,
  .analytics-chart--wide,
  .analytics-chart--line { min-height: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  .analytics-col-bar,
  .analytics-area,
  .analytics-line {
    animation: none;
  }
}
