/* Flowlzy Team Scraper — plain CSS, navy + clean-blue brand. */

:root {
  --navy: #0a2540;
  --clean-blue: #2f6fed;
  --slate-900: #0f172a;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --emerald-50: #ecfdf5;
  --emerald-700: #047857;
  --amber-50: #fffbeb;
  --amber-700: #b45309;
  --rose-50: #fef2f2;
  --rose-700: #b91c1c;
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06),
    0 1px 2px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
    sans-serif;
  font-size: 14px;
  color: var(--slate-900);
  background: var(--slate-50);
}

.hidden {
  display: none !important;
}
.muted {
  color: var(--slate-500);
}
.small {
  font-size: 12px;
}
.center {
  text-align: center;
}
.pad {
  padding: 32px;
}
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  color: var(--slate-400);
}
.kicker-inline {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 10px;
  color: var(--slate-400);
  margin-left: 10px;
}
.error {
  color: var(--rose-700);
  background: var(--rose-50);
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  margin-top: 8px;
}
.grow {
  flex: 1;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--slate-300);
  background: var(--white);
  color: var(--slate-700);
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  transition: background 0.1s, border-color 0.1s;
}
button:hover {
  background: var(--slate-100);
}
button.primary {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
button.primary:hover {
  background: #0d3258;
}
button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--slate-500);
}
button.ghost:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}
button.block {
  display: block;
  width: 100%;
  margin-bottom: 6px;
  text-align: left;
  padding: 8px 10px;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--slate-300);
  border-radius: 6px;
  background: var(--white);
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--clean-blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}
textarea {
  resize: vertical;
  min-height: 80px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  line-height: 1.5;
}

/* ── Login ─────────────────────────────────────────────── */

.login {
  position: fixed;
  inset: 0;
  background: var(--slate-50);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.login-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 32px;
  width: 360px;
  box-shadow: var(--shadow-card);
  text-align: center;
}
.login-card h1 {
  margin: 0;
  font-size: 28px;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.login-card p {
  margin: 8px 0 16px;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.login-card button {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
  padding: 9px;
  border-radius: 6px;
}

/* ── Boot loader ───────────────────────────────────────── */

.boot {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-500);
  font-size: 13px;
}

/* ── App shell ─────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
}
.topbar .brand strong {
  font-size: 18px;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--slate-100);
  color: var(--slate-500);
}
.pill.ok {
  background: var(--emerald-50);
  color: var(--emerald-700);
}
.pill.warn {
  background: var(--amber-50);
  color: var(--amber-700);
}
.pill.bad {
  background: var(--rose-50);
  color: var(--rose-700);
}

/* ── Main grid ─────────────────────────────────────────── */

.main {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  width: 240px;
  background: var(--white);
  border-right: 1px solid var(--slate-200);
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
}
.section {
  margin-bottom: 22px;
}
.section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--slate-400);
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--slate-400);
  background: var(--slate-100);
  padding: 1px 6px;
  border-radius: 999px;
  letter-spacing: 0;
  text-transform: none;
}

/* "Browse all" trigger in the section label row */
.browse-trigger {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--clean-blue);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}
.browse-trigger:hover {
  background: rgba(47, 111, 237, 0.1);
  color: var(--navy);
}

/* Highlighted search matches in sheet list + browse cards */
mark {
  background: #fef08a;
  color: var(--slate-900);
  padding: 0 2px;
  border-radius: 2px;
}

/* ── Sidebar sheet search + sort row ───────────────────── */
.sheet-search-input {
  width: 100%;
  font-size: 12px;
  padding: 5px 8px;
  margin-bottom: 6px;
}
.sheet-sort-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.sheet-sort-row label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.sheet-sort-select {
  flex: 1;
  font-size: 11px;
  padding: 3px 6px;
  height: 26px;
}
.sheet-list .sheet {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--slate-700);
  font-weight: 500;
  margin-bottom: 2px;
  font-size: 13px;
}
.sheet-list .sheet:hover {
  background: var(--slate-100);
}
.sheet-list .sheet.active {
  background: var(--navy);
  color: var(--white);
}
.sheet-list .sheet .sheet-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sheet-list .sheet .sheet-progress {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--slate-500);
}
.sheet-list .sheet.active .sheet-progress {
  color: rgba(255, 255, 255, 0.7);
}
.sheet-list .sheet .bar {
  flex: 1;
  height: 3px;
  background: var(--slate-200);
  border-radius: 2px;
  overflow: hidden;
}
.sheet-list .sheet.active .bar {
  background: rgba(255, 255, 255, 0.2);
}
.sheet-list .sheet .bar-fill {
  display: block;
  height: 100%;
  background: var(--clean-blue);
  transition: width 0.2s;
}
.sheet-list .sheet.active .bar-fill {
  background: var(--white);
}

/* ── Daily summary card ────────────────────────────────── */
.daily-summary {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  font-size: 13px;
}
.daily-summary .kicker {
  font-size: 10px;
  font-weight: 700;
  color: var(--clean-blue);
  letter-spacing: 0.18em;
}
.daily-summary .metric strong {
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
  margin-right: 4px;
}
.daily-summary .metric.metric-good strong {
  color: var(--emerald-700);
}
.daily-summary .metric.metric-dim strong {
  color: var(--slate-500);
}

/* ── Search row ────────────────────────────────────────── */
.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.search-row input {
  flex: 1;
}

/* ── Lead modal: notes + audit row ─────────────────────── */
.form-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: flex-end;
}
.form-row-split .audit-trail {
  padding: 6px 0;
}

/* ── Topbar operator button ────────────────────────────── */
#btn-operator {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--slate-200);
  background: var(--slate-50);
  border-radius: 6px;
}
#btn-operator:hover {
  background: var(--slate-100);
}
#btn-operator #operator-name {
  font-weight: 600;
  color: var(--navy);
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}
.status-pill {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--slate-200);
  background: var(--white);
  color: var(--slate-700);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-pill.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}
.status-pill.dim {
  opacity: 0.45;
}
.status-pill .pill-count {
  font-size: 10px;
  font-weight: 700;
  background: var(--slate-100);
  color: var(--slate-700);
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
}
.status-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
}
.status-help {
  font-size: 11px;
  padding: 0;
  color: var(--clean-blue);
  text-decoration: underline;
  background: transparent;
  border: none;
}
.status-help:hover {
  background: transparent;
  color: var(--navy);
}

/* "How status works" explainer table inside the help modal */
.status-help-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}
.status-help-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
}
.status-help-row .status-badge {
  flex-shrink: 0;
  margin-top: 1px;
}

/* Bottom-right toast — used after Open WhatsApp + status changes */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  max-width: 360px;
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.2);
  animation: toast-in 0.2s ease-out;
}
.toast.toast-error {
  background: var(--rose-700);
}
@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-width: 0;
}

/* ── Job card ──────────────────────────────────────────── */

.job-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.job-card.running {
  border-color: var(--clean-blue);
  background: #eff6ff;
}
.job-card.done {
  border-color: #6ee7b7;
  background: var(--emerald-50);
}
.job-card.failed {
  border-color: #fca5a5;
  background: var(--rose-50);
}
.job-card .pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--clean-blue);
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ── Leads table ───────────────────────────────────────── */

.lead-table-wrap {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-500);
  padding: 10px 12px;
  background: var(--slate-50);
  border-bottom: 1px solid var(--slate-200);
}
td {
  padding: 12px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: top;
}
tr:hover td {
  background: var(--slate-50);
}
.lead-name {
  font-weight: 600;
  color: var(--navy);
}
.lead-meta {
  font-size: 11px;
  color: var(--slate-500);
  margin-top: 2px;
}
.draft-preview {
  color: var(--slate-700);
  line-height: 1.4;
  max-height: 60px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 12.5px;
}
.lead-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* status badges in table — base palette, applied to both static
   `.status-badge` (read-only) and the editable `.status-inline`
   <select> dropdown so the colors stay consistent. */
.status-badge,
.status-inline {
  display: inline-block;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 999px;
  text-transform: capitalize;
  border: 1px solid transparent;
  width: auto;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.status-inline {
  cursor: pointer;
  padding-right: 22px;
  /* Mini chevron via inline SVG so each select carries a visual
     "this is editable" cue without an extra DOM node. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23475569' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: filter 0.1s, box-shadow 0.1s;
}
.status-inline:hover {
  filter: brightness(0.96);
  box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.18);
}
.status-inline:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(47, 111, 237, 0.4);
}
.status-ready {
  background-color: var(--slate-100);
  color: var(--slate-700);
}
.status-outreached {
  background-color: var(--clean-blue);
  color: var(--white);
}
.status-outreached.status-inline {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='white' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
.status-replied {
  background-color: var(--emerald-50);
  color: var(--emerald-700);
}
.status-interested {
  background-color: #fef3c7;
  color: #92400e;
}
.status-not_interested {
  background-color: var(--rose-50);
  color: var(--rose-700);
}
.status-converted {
  background-color: var(--emerald-700);
  color: var(--white);
}
.status-converted.status-inline {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='white' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
/* needs_review = Max-flagged, "don't send yet". Amber to read as
   "wait" without screaming danger. */
.status-needs_review {
  background-color: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
/* needs_rewrite = teammate-flagged, "this AI draft is broken". Rose
   to read as "needs work / blocked". */
.status-needs_rewrite {
  background-color: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}
/* dropped = lead went cold after msg 3. Don't message again. */
.status-dropped {
  background-color: var(--slate-200);
  color: var(--slate-500);
  border-color: var(--slate-300);
  text-decoration: line-through;
  text-decoration-color: var(--slate-400);
}

/* ── Stale row highlight ───────────────────────────────── */
/* Outreached >5 days ago with no reply → amber left border + chip. */
tr.row-stale td {
  background: #fffbeb;
}
tr.row-stale td:first-child {
  box-shadow: inset 3px 0 0 var(--amber-700);
}
.stale-chip {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--amber-50);
  color: var(--amber-700);
  border: 1px solid #fde68a;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Lead modal: Next/Prev nav + flag-rewrite + toast undo ─ */
.modal-card .modal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  margin-right: 12px;
}
.modal-card .modal-nav button {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--slate-200);
  background: var(--white);
}
.modal-card .modal-nav button:disabled {
  opacity: 0.4;
}
.modal-card .modal-nav #lead-position {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--slate-500);
  min-width: 40px;
  text-align: center;
}

/* Flag-for-rewrite button gets a red accent so it reads as a
   destructive-ish action, but still ghost-style so it doesn't compete
   with the primary Send button. */
button.danger {
  color: var(--rose-700);
}
button.danger:hover {
  background: var(--rose-50);
  color: var(--rose-700);
}

/* Toast Undo button */
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
}
.toast-undo {
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
}
.toast-undo:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ── Full-screen "Browse all sheets" overlay ──────────── */
/* Covers the entire viewport. Card grid scales from 2-col (small
   screens) to 4-col (1280px+). Designed for hundreds of sheets —
   the grid is virtualization-ready (we'd swap in IntersectionObserver
   row recycling once we hit ~500 sheets, not before). */
.browse-overlay {
  position: fixed;
  inset: 0;
  background: var(--white);
  z-index: 80;
  display: flex;
  flex-direction: column;
}
.browse-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--slate-200);
  background: var(--white);
  flex-shrink: 0;
}
.browse-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.browse-title h2 {
  margin: 0;
  font-size: 20px;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.browse-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.browse-controls input[type="search"] {
  width: 280px;
  font-size: 13px;
  padding: 7px 10px;
}
.browse-controls select {
  width: auto;
  min-width: 140px;
  font-size: 12px;
  padding: 6px 8px;
}
.browse-controls .close {
  font-size: 24px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--slate-500);
  border-radius: 6px;
  padding: 0;
}
.browse-controls .close:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}

.browse-grid {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  background: var(--slate-50);
}
.browse-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: inherit;
  transition: border-color 0.1s, box-shadow 0.1s, transform 0.1s;
}
.browse-card:hover {
  border-color: var(--clean-blue);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
  background: var(--white);
}
.browse-card .card-niche {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}
.browse-card .card-location {
  font-size: 12px;
  color: var(--slate-700);
  font-weight: 500;
}
.browse-card .card-date {
  font-size: 11px;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.browse-card .card-stats {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--slate-100);
}
.browse-card .card-stat {
  font-size: 11px;
  color: var(--slate-700);
}
.browse-card .card-stat strong {
  font-size: 13px;
  color: var(--navy);
  font-weight: 700;
  margin-right: 2px;
}
.browse-card .card-stat-good strong {
  color: var(--emerald-700);
}
.browse-card .card-bar {
  height: 4px;
  background: var(--slate-100);
  border-radius: 2px;
  overflow: hidden;
}
.browse-card .card-bar-fill {
  display: block;
  height: 100%;
  background: var(--clean-blue);
  transition: width 0.2s;
}
.browse-card .card-pct {
  text-align: right;
}

/* ── AI reasoning panel (lead modal) ──────────────────── */
/* Surfaces the structured Enrichment JSON: hook used, customer-voice
   quotes, 5-dim operational pain score, follow-up stage. Collapsible
   so the modal stays scannable when there's nothing yet enriched. */

.ai-reasoning {
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 0;
  background: var(--white);
  margin-top: 4px;
}
.ai-reasoning > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  border-radius: 8px;
}
.ai-reasoning > summary::-webkit-details-marker { display: none; }
.ai-reasoning > summary::before {
  content: "▸";
  color: var(--slate-400);
  font-size: 11px;
  width: 10px;
}
.ai-reasoning[open] > summary::before {
  content: "▾";
}
.ai-reasoning > summary:hover {
  background: var(--slate-50);
}
.ai-reasoning .ai-reasoning-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ai-reasoning-body {
  padding: 0 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-section {
  background: var(--slate-50);
  border: 1px solid var(--slate-100);
  border-radius: 6px;
  padding: 10px 12px;
}
.ai-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

/* Lead Score + Personalization Score chips */
.lead-score-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 6px;
  vertical-align: middle;
}
.lead-score-chip.score-cold {
  background: var(--slate-100);
  color: var(--slate-500);
}
.lead-score-chip.score-warm {
  background: #fef3c7;
  color: #92400e;
}
.lead-score-chip.score-hot {
  background: var(--emerald-50);
  color: var(--emerald-700);
}
.skip-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  background: var(--rose-50);
  color: var(--rose-700);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #fecaca;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Hook block */
.hook-priority {
  font-size: 11px;
  margin-bottom: 6px;
}
.hook-evidence {
  margin: 4px 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--clean-blue);
  background: var(--white);
  font-style: italic;
  font-size: 12.5px;
  color: var(--slate-700);
  line-height: 1.5;
}

/* Customer-voice quotes */
.quote-card {
  margin: 4px 0;
  padding: 8px 12px;
  border-left: 3px solid var(--rose-700);
  background: var(--white);
  border-radius: 0 4px 4px 0;
}
.quote-card.quote-social {
  border-left-color: var(--clean-blue);
}
.quote-card .quote-text {
  font-size: 12.5px;
  color: var(--slate-900);
  line-height: 1.4;
}
.quote-card .quote-meta {
  margin-top: 4px;
}
.quote-card .quote-meta code {
  background: var(--slate-100);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
}

/* Pain-score bars */
.pain-row {
  display: grid;
  grid-template-columns: 150px 1fr 24px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  margin-bottom: 3px;
}
.pain-label {
  color: var(--slate-700);
}
.pain-bar {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 14px;
  letter-spacing: -1px;
  color: var(--slate-300);
}
.pain-bar.pain-high { color: var(--rose-700); }
.pain-bar.pain-med  { color: #92400e; }
.pain-bar.pain-low  { color: var(--emerald-700); }
.pain-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 12px;
  color: var(--slate-700);
  text-align: right;
}

/* ── Activity feed modal ───────────────────────────────── */
.activity-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--slate-200);
}
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 60vh;
  overflow-y: auto;
}
.activity-event {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.activity-event:hover {
  background: var(--slate-50);
  border-color: var(--slate-300);
}
.activity-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--clean-blue);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.activity-body {
  flex: 1;
  min-width: 0;
}
.activity-line {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.activity-notes {
  margin-top: 4px;
  font-style: italic;
}
.activity-time {
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
/* Browser sometimes paints the option list in default styling; force
   it back to a sensible neutral so dropdowns aren't jarring. */
.status-inline option {
  background: var(--white);
  color: var(--slate-900);
  font-weight: 500;
  text-transform: capitalize;
}

/* ── Modal ─────────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal-card {
  background: var(--white);
  border-radius: 12px;
  width: 480px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-card.wide {
  width: 720px;
}
.modal-card header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-card header h2 {
  margin: 0;
  font-size: 16px;
  color: var(--navy);
}
.modal-card .close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--slate-400);
  padding: 0;
}
.modal-card .close:hover {
  color: var(--slate-900);
  background: transparent;
}
.modal-card footer {
  padding: 12px 20px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form label span {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-700);
}
.form .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Lead modal — context block above the editable draft */
.lead-context {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.6;
}
.lead-context dt {
  display: inline;
  font-weight: 600;
  color: var(--slate-700);
}
.lead-context dd {
  display: inline;
  margin: 0 0 0 4px;
  color: var(--slate-700);
}
.lead-context dl {
  margin: 0;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 4px 10px;
}
.lead-context dt {
  text-align: right;
}

/* Status select inside the lead modal */
.status-select {
  width: 200px;
}

/* ─── Help / Team Guide overlay ──────────────────────────────
   Reuses .browse-overlay positioning (fixed full-screen). The
   .help-body is the scrolling reading pane below the header. */
.help-body {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px 80px;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
}
.help-body section {
  margin-top: 36px;
  padding-top: 12px;
  scroll-margin-top: 90px; /* anchor scroll lands clear of sticky header */
}
.help-body section:first-of-type {
  margin-top: 16px;
}
.help-body h3 {
  font-size: 22px;
  color: var(--navy);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.help-body h4 {
  font-size: 15px;
  color: var(--navy);
  margin: 18px 0 6px;
}
.help-body p {
  margin: 0 0 12px;
}
.help-body ul,
.help-body ol {
  margin: 0 0 12px;
  padding-left: 22px;
}
.help-body ul li,
.help-body ol li {
  margin-bottom: 6px;
}
.help-body code {
  background: var(--slate-100);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--navy);
}

/* Sticky in-overlay TOC at the top of help-body */
.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 12px 14px;
  background: var(--slate-50, #f6f8fb);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 13px;
}
.help-toc a {
  color: var(--blue, #2f6fed);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
}
.help-toc a:hover {
  background: var(--blue, #2f6fed);
  color: white;
}

.help-body .big-list {
  font-size: 16px;
  padding-left: 26px;
}
.help-body .big-list li {
  margin-bottom: 8px;
}

.help-body .callout {
  background: #fff7e6;
  border-left: 4px solid #f5a623;
  padding: 12px 14px;
  border-radius: 0 6px 6px 0;
  margin: 14px 0;
}

.help-body ul.dont {
  list-style: none;
  padding-left: 0;
}
.help-body ul.dont li {
  background: #fdecec;
  border-left: 3px solid #d33a2c;
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 0 4px 4px 0;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px;
  font-size: 14px;
}
.help-table th,
.help-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: top;
}
.help-table th {
  background: var(--slate-100);
  color: var(--navy);
  font-weight: 600;
  font-size: 13px;
}
.help-table tr:last-child td {
  border-bottom: none;
}

.help-footer {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--slate-200);
  text-align: center;
}

/* ─── Analytics overlay ─────────────────────────────────────
   Same fixed-overlay container as Browse + Help. Inside, KPI cards
   + funnel bars + tables. All pure CSS, no charting library. */
.analytics-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 80px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}
.analytics-body h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--navy);
  letter-spacing: -0.01em;
}

/* KPI cards row */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}
.kpi-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 14px 16px;
}
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500, #64748b);
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 4px;
}
.kpi-sub {
  font-size: 11px;
}

.analytics-section {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 18px;
}
.analytics-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .analytics-grid-2 { grid-template-columns: 1fr; }
}

/* Funnel — colored horizontal bars */
.funnel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.funnel-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 12px;
}
.funnel-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  text-align: right;
}
.funnel-bar {
  position: relative;
  height: 30px;
  background: var(--slate-100);
  border-radius: 6px;
  overflow: hidden;
}
.funnel-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}
.funnel-fill-0 { background: linear-gradient(90deg, #4a90e2, #2f6fed); }
.funnel-fill-1 { background: linear-gradient(90deg, #f5a623, #e08e15); }
.funnel-fill-2 { background: linear-gradient(90deg, #7ed321, #5fa617); }
.funnel-fill-3 { background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.funnel-fill-4 { background: linear-gradient(90deg, #10b981, #059669); }
.funnel-val {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  text-shadow: 0 0 3px rgba(255,255,255,0.8);
}

/* Daily activity sparkline */
.spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 90px;
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 4px;
}
.spark-col {
  flex: 1;
  min-width: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: default;
}
.spark-bar {
  width: 100%;
  max-width: 24px;
  background: linear-gradient(180deg, #2f6fed, #4a90e2);
  border-radius: 2px 2px 0 0;
  transition: opacity 0.2s;
}
.spark-col:hover .spark-bar { opacity: 0.7; }
.spark-date {
  font-size: 9px;
  color: var(--slate-500, #64748b);
  white-space: nowrap;
}

/* Analytics tables */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.analytics-table th,
.analytics-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: middle;
}
.analytics-table th {
  background: var(--slate-100);
  color: var(--navy);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.analytics-table td.num,
.analytics-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.analytics-table tr:last-child td { border-bottom: none; }
.analytics-table code {
  font-size: 12px;
  background: var(--slate-100);
  padding: 1px 6px;
  border-radius: 3px;
}

.callout-warn {
  background: #fff7e6;
  border-left: 4px solid #f5a623;
}
