/* ========================================================================
   LSA Lead Tracker. styles
   Design: clean, flat, professional. White cards, thin 0.5px borders,
   generous whitespace, no gradients, no drop shadows. System font stack.
   One accent color used sparingly. Color semantics: red = bad/loss,
   green = good/creditable, amber = needs attention.
   ======================================================================== */

:root {
  --accent: #0ea5e9;
  --accent-dark: #0369a1;
  --bad: #dc2626;
  --bad-tint: #fef2f2;
  --good: #16a34a;
  --good-tint: #f0fdf4;
  --warn: #d97706;
  --warn-tint: #fffbeb;
  --text: #0f172a;
  --text-mid: #475569;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-light: #eef2f6;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --bg-page: #fcfcfd;
  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

/* sr-only utility */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ===================== Body / global overrides for tool ===================== */
body.page-tool {
  background: var(--bg-page) !important;
}
body.page-tool .article-content,
body.page-tool .article-page-wrap {
  /* Tool isn't an article; ensure global article rules don't apply */
  all: revert;
}

/* ===================== Tool hero (BGM-styled, narrow) ===================== */
.tool-hero {
  background: #0a1628;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 104px 24px 56px;
  text-align: center;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.tool-hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(420px 380px at 12% 20%, rgba(56,189,248,.32), transparent 60%),
    radial-gradient(360px 320px at 88% 30%, rgba(129,140,248,.28), transparent 60%),
    radial-gradient(300px 280px at 50% 110%, rgba(125,211,252,.22), transparent 60%);
  filter: blur(40px);
}
/* Floating aurora blobs (match the other BGM tool heroes) */
.tool-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 1;
}
.tool-blob-1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #38bdf8, transparent 70%);
  top: -140px; left: -60px;
  animation: blobFloat1 16s ease-in-out infinite;
}
.tool-blob-2 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #818cf8, transparent 70%);
  top: -40px; right: -60px;
  animation: blobFloat2 19s ease-in-out infinite;
}
.tool-blob-3 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, #a78bfa, transparent 70%);
  bottom: -150px; left: 42%;
  animation: blobFloat3 22s ease-in-out infinite;
}
@keyframes blobFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
}
@keyframes blobFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-35px, 40px) scale(0.92); }
}
@keyframes blobFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -35px) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) {
  .tool-blob { animation: none; }
}

.tool-hero-inner {
  position: relative; z-index: 2;
  max-width: 820px; margin: 0 auto;
}
.tool-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase;
  color: #7dd3fc;
  background: rgba(56,189,248,.12);
  border: 1px solid rgba(56,189,248,.3);
  border-radius: 999px;
  padding: 5px 13px;
  margin-bottom: 16px;
}
.tool-eyebrow-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8;
  animation: dotPulse 2.4s ease-in-out infinite;
}
@keyframes dotPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.85); } }
.tool-h1 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif !important;
  font-size: clamp(1.9rem, 4vw, 2.8rem) !important;
  font-weight: 900 !important;
  letter-spacing: -.02em !important;
  line-height: 1.1 !important;
  margin: 0 0 14px !important;
  background: linear-gradient(90deg, #38bdf8 0%, #818cf8 70%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-wrap: balance;
}
.tool-sub {
  font-size: 1.05rem; line-height: 1.6;
  color: rgba(255,255,255,.78);
  max-width: 680px; margin: 0 auto;
  text-wrap: pretty;
}
.tool-sub strong { color: #fff; font-weight: 700; }

/* ===================== Tabs ===================== */
.tabs {
  background: #fff;
  border-bottom: 0.5px solid var(--border);
  padding: 0 20px;
  display: flex; gap: 4px;
  max-width: 100vw; overflow-x: auto;
  position: sticky; top: var(--nav-height, 60px); z-index: 50;
}
.tab {
  background: none; border: 0;
  padding: 14px 16px; font-size: 0.92rem; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}
.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ===================== Layout ===================== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 16px;
}
.container > section.view:last-of-type > *:last-child,
.container > section.view-dashboard > div#dashboardBody > div:last-child {
  margin-bottom: 0;
}
.view { display: block; }
/* Override BGM global "section { padding: 72px 0 }" — the tool views and the
   content-section get their own tight spacing. Without this override every
   view inherits 144px of vertical padding from the global theme. */
section.view, section.content-section {
  padding-top: 0;
  padding-bottom: 0;
}
section.content-section {
  padding: 8px 20px 32px;
}
.view[hidden] { display: none; }

/* ===================== Cards ===================== */
.card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.card-head h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.card-head-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ===================== Empty state ===================== */
.empty-state {
  background: var(--bg);
  border: 0.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
}
.empty-state h2 { margin: 0 0 8px; font-size: 1.1rem; font-weight: 700; }
.empty-state p { margin: 0 0 8px; color: var(--text-mid); }

/* ===================== Top recommendation ===================== */
.top-recommendation {
  border-left: 3px solid var(--warn);
  background: var(--warn-tint);
}
.rec-label {
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--warn);
  margin-bottom: 6px;
}
.top-recommendation h3 { margin: 0 0 6px; font-size: 1.02rem; }
.top-recommendation p { margin: 0 0 12px; color: var(--text); font-size: 0.94rem; }

/* ===================== Metrics ===================== */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.metric {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
}
.metric-label {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.metric-value {
  font-size: 1.7rem; font-weight: 700;
  letter-spacing: -.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.metric-hint {
  font-size: 0.74rem; color: var(--text-muted);
  margin-top: 6px;
}
.metric-emphasis {
  border-color: var(--accent);
  border-left-width: 3px;
}
.metric-emphasis .metric-value { color: var(--accent-dark); }
.metric-credit .metric-value { color: var(--good); }

/* Charge-status breakdown strip */
.charge-breakdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.charge-stat {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.charge-stat-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.charge-stat .charge-dot {
  width: 9px; height: 9px; border-radius: 50%;
  flex-shrink: 0;
}
.charge-stat-count {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.charge-stat-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}
.charge-stat-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}
/* Color accents matching the charge-status badges in the lead list */
.charge-stat-charged { border-top: 3px solid #3b82f6; }
.charge-stat-charged .charge-dot { background: #3b82f6; }
.charge-stat-not-charged { border-top: 3px solid #94a3b8; }
.charge-stat-not-charged .charge-dot { background: #94a3b8; }
.charge-stat-credited { border-top: 3px solid #16a34a; }
.charge-stat-credited .charge-dot { background: #16a34a; }
.charge-stat-total { border-top: 3px solid var(--accent); background: #f8fafc; }
.charge-stat-total .charge-stat-count { color: var(--accent-dark); }

@media (max-width: 640px) {
  .charge-breakdown { grid-template-columns: repeat(2, 1fr); }
}

/* Period bar */
.period-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
  font-size: 0.88rem; color: var(--text-mid);
}
.period-bar label { font-weight: 600; }
.period-summary { color: var(--text-muted); margin-left: auto; }

/* BGM CTA strip */
.bgm-cta-strip {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px;
  background: #f1f5f9;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px; flex-wrap: wrap;
}
.bgm-cta-text { flex: 1; min-width: 220px; font-size: 0.92rem; }
.bgm-cta-text strong { display: block; color: var(--text); font-weight: 700; }
.bgm-cta-text span { color: var(--text-mid); }

/* ===================== Buttons ===================== */
.btn-primary, .btn-secondary, .btn-text {
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 0.5px solid var(--accent);
  padding: 9px 16px; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 0.5px solid var(--border);
  padding: 9px 16px; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 600;
}
.btn-secondary:hover { background: var(--bg-soft); border-color: #cbd5e1; }
.btn-text {
  background: none; border: 0;
  color: var(--accent-dark);
  font-size: 0.88rem; font-weight: 600;
  padding: 4px 0;
  text-decoration: none;
}
.btn-text:hover { color: var(--accent); text-decoration: underline; }
.btn-danger {
  background: var(--bg);
  color: var(--bad);
  border: 0.5px solid var(--border);
  padding: 6px 12px; border-radius: var(--radius);
  font-size: 0.84rem; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover { background: var(--bad-tint); border-color: #fecaca; }

/* ===================== Leads list ===================== */
.leads-list { display: flex; flex-direction: column; }
.lead-row {
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  gap: 14px; align-items: center;
  padding: 12px 0;
  border-top: 0.5px solid var(--border-light);
}
.lead-row:first-child { border-top: 0; }
.lead-date {
  font-size: 0.82rem; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.lead-meta {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
}
.lead-meta-line1 { font-size: 0.95rem; font-weight: 600; }
.lead-meta-line2 { font-size: 0.82rem; color: var(--text-mid); }
.lead-amount {
  font-size: 0.95rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.lead-actions { display: inline-flex; gap: 6px; }
.lead-actions button {
  background: none; border: 0; cursor: pointer;
  padding: 6px 8px; border-radius: 4px;
  font-size: 0.84rem; color: var(--text-muted);
  font-family: inherit;
}
.lead-actions button:hover { background: var(--bg-soft); color: var(--text); }

/* Outcome tag pills */
.outcome-tag {
  display: inline-block;
  font-size: 0.74rem; font-weight: 700;
  padding: 2px 8px; border-radius: 99px;
  letter-spacing: 0.02em;
  margin-right: 6px;
}
.tag-booked { background: var(--good-tint); color: var(--good); }
.tag-quoted { background: #f0f9ff; color: var(--accent-dark); }
.tag-lost { background: #fef3c7; color: #92400e; }
.tag-spam { background: var(--bad-tint); color: var(--bad); }
.tag-wrong_service { background: var(--bad-tint); color: var(--bad); }
.tag-out_of_area { background: var(--bad-tint); color: var(--bad); }
.tag-existing_client { background: var(--warn-tint); color: var(--warn); }

/* Credit verdict marker on lead row */
.lead-credit-mark {
  display: inline-block; font-size: 0.7rem;
  padding: 1px 6px; border-radius: 3px;
  background: var(--good-tint); color: var(--good);
  font-weight: 700;
}

/* Expanded lead detail */
.lead-detail {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  font-size: 0.88rem;
}
.lead-detail .verdict {
  margin-bottom: 8px;
  font-weight: 600;
}
.lead-detail .verdict.creditable { color: var(--good); }
.lead-detail .verdict.not-creditable { color: var(--bad); }
.lead-detail .feedback-note {
  background: #fff;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
}
.copy-feedback-btn {
  margin-top: 6px;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.copy-feedback-btn:hover { background: var(--bg-soft); }
.copy-feedback-btn.copied { background: var(--good-tint); color: var(--good); border-color: #86efac; }

/* ===================== Form ===================== */
form { display: flex; flex-direction: column; gap: 16px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label {
  font-size: 0.82rem; font-weight: 600; color: var(--text);
}
.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field input[type="search"],
.form-field select,
.form-field textarea {
  padding: 9px 12px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}
.form-field .hint { font-size: 0.78rem; color: var(--text-muted); }

input[type="search"] {
  min-width: 180px;
  padding: 7px 12px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-family: inherit;
}
input[type="search"]:focus { outline: none; border-color: var(--accent); }
select {
  padding: 7px 10px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-family: inherit;
  background: #fff;
}

/* Outcome grid */
.outcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.outcome-btn {
  padding: 10px 12px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 0.88rem; font-weight: 500;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color .15s, background .15s, color .15s;
}
.outcome-btn:hover { border-color: #cbd5e1; }
.outcome-btn.selected {
  border-color: var(--accent);
  background: rgba(14,165,233,.06);
  color: var(--accent-dark);
  font-weight: 600;
}
.outcome-btn.outcome-danger.selected { border-color: var(--bad); background: var(--bad-tint); color: var(--bad); }
.outcome-btn.outcome-warn.selected { border-color: var(--warn); background: var(--warn-tint); color: var(--warn); }

/* Radio row */
.radio-row { display: flex; gap: 18px; }
.radio-row label {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 500; cursor: pointer;
  font-size: 0.92rem;
}

/* Live verdict preview */
.verdict-preview {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 0.5px solid var(--border);
}
.verdict-preview.good { background: var(--good-tint); border-color: #bbf7d0; color: #166534; }
.verdict-preview.bad { background: var(--bad-tint); border-color: #fecaca; color: #991b1b; }
.verdict-preview.warn { background: var(--warn-tint); border-color: #fde68a; color: #92400e; }
.verdict-preview strong { font-weight: 700; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* CSV IO */
.io-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.io-block { display: flex; flex-direction: column; gap: 8px; }
.io-block h4 { margin: 0; font-size: 0.96rem; font-weight: 700; }
.io-block .muted { margin: 0; }
.io-block input[type="file"] {
  font-size: 0.86rem;
  padding: 8px 0;
}
.status-msg {
  font-size: 0.84rem;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.status-msg.success { background: var(--good-tint); color: #166534; border: 0.5px solid #bbf7d0; }
.status-msg.error { background: var(--bad-tint); color: #991b1b; border: 0.5px solid #fecaca; }

/* CSV mapping UI */
.mapping-ui { margin-top: 10px; padding: 12px; background: var(--bg-soft); border-radius: var(--radius); font-size: 0.86rem; }
.mapping-ui .mapping-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; align-items: center; }
.mapping-ui select { width: 100%; }

/* Aggregate opt-in */
.aggregate-card {
  background: var(--bg-soft);
  border-color: var(--border-light);
}
.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--accent);
}

/* Data management */
.data-mgmt { border-color: #fee2e2; }
.data-mgmt h3 { color: var(--bad); }

/* ===================== Recommendations ===================== */
.recs-list { display: flex; flex-direction: column; gap: 10px; }
.rec-card {
  padding: 14px 16px;
  border: 0.5px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  background: #fff;
}
.rec-card.sev-high { border-left-color: var(--bad); }
.rec-card.sev-med { border-left-color: var(--warn); }
.rec-card.sev-low { border-left-color: var(--accent); }
.rec-card h4 { margin: 0 0 6px; font-size: 0.95rem; font-weight: 700; }
.rec-card p { margin: 0 0 6px; font-size: 0.9rem; color: var(--text-mid); }
.rec-card .rec-tradeoff {
  font-size: 0.82rem; color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}

/* ===================== Monthly snapshot ===================== */
.table-wrap { overflow-x: auto; }
.snapshot-table {
  width: 100%; border-collapse: collapse; font-size: 0.9rem;
}
.snapshot-table th, .snapshot-table td {
  padding: 10px 12px; text-align: left;
  border-bottom: 0.5px solid var(--border-light);
  white-space: nowrap;
}
.snapshot-table thead th {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--text-mid);
  font-size: 0.82rem;
  border-bottom-color: var(--border);
}
.snapshot-table td {
  font-variant-numeric: tabular-nums;
}
.snapshot-table td:first-child { font-weight: 600; }
.snapshot-table .delta-up { color: var(--good); font-size: 0.78rem; margin-left: 4px; }
.snapshot-table .delta-down { color: var(--bad); font-size: 0.78rem; margin-left: 4px; }

/* ===================== Misc ===================== */
.muted { color: var(--text-muted); }
.small { font-size: 0.82rem; }

/* ===================== Trust strip (between tool + site footer) ===================== */
.tool-trust-strip {
  background: var(--bg);
  border-top: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border);
  padding: 14px 20px;
  margin-top: 24px;
}
.tool-trust-strip-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap;
  font-size: 0.84rem; color: var(--text-muted);
}
.tool-trust-strip a {
  color: var(--text-mid);
  text-decoration: underline;
  text-decoration-color: rgba(71,85,105,.3);
  text-underline-offset: 2px;
}
.tool-trust-strip a:hover { color: var(--accent-dark); text-decoration-color: var(--accent); }
.tool-trust-dot { color: var(--text-muted); }
.verify-stamp strong { color: var(--text); }

/* ===================== Mobile ===================== */
@media (max-width: 640px) {
  .form-row, .io-grid {
    grid-template-columns: 1fr;
  }
  .lead-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .lead-row .lead-actions { justify-self: flex-end; }
  .lead-row .lead-amount { font-size: 1.1rem; }
  .metric-value { font-size: 1.4rem; }
  .app-title { font-size: 1rem; }
  .card { padding: 16px; }
  .container { padding: 18px 16px 60px; }
  .tabs { padding: 0 12px; }
  .tab { padding: 12px 10px; font-size: 0.88rem; }
  .bgm-cta-strip { flex-direction: column; align-items: flex-start; }
}

/* =============================================================
   Tracker byline (E-E-A-T + freshness, same pattern as scanners)
   ============================================================= */
.tracker-byline {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; margin: 16px 0 12px;
  background: #fff;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.tracker-byline .b-avatar {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8 0%, #818cf8 60%, #a78bfa 100%);
  color: #fff; font-weight: 800; font-size: 0.92rem;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.tracker-byline .b-info { flex: 1; min-width: 200px; }
.tracker-byline .b-name { font-size: 0.92rem; font-weight: 700; color: var(--text); line-height: 1.4; }
.tracker-byline .b-name a { color: var(--accent-dark); text-decoration: underline; text-decoration-color: rgba(3,105,161,.3); }
.tracker-byline .b-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }
.tracker-byline .b-meta a { color: var(--text-muted); text-decoration: underline; }
.tracker-byline .b-meta time { font-weight: 600; color: var(--text-mid); }
.tracker-byline .b-badges { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.tracker-byline .b-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 700;
  padding: 3px 9px; border-radius: 99px;
  background: #f0f9ff; color: #0c4a6e;
  border: 1px solid #bae6fd;
}

/* =============================================================
   Long-form content section (below the tool)
   ============================================================= */
.content-section {
  max-width: 920px;
  margin: 0 auto;
  padding: 8px 20px 32px;
}
.content-section + .content-section {
  padding-top: 0;
}
.content-section-inner {
  background: #fff;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 36px clamp(20px, 4vw, 44px);
}
.content-section-inner h2 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  font-weight: 800;
  color: var(--text);
  margin: 32px 0 12px;
  letter-spacing: -.005em;
  text-wrap: balance;
}
.content-section-inner h2:first-child { margin-top: 0; }
.content-section-inner p {
  font-size: 0.98rem;
  line-height: 1.72;
  color: var(--text);
  margin: 0 0 14px;
}
.content-section-inner ul, .content-section-inner ol {
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--text);
  line-height: 1.7;
}
.content-section-inner li { margin-bottom: 7px; }
.content-section-inner a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-decoration-color: rgba(3,105,161,.3);
  font-weight: 600;
}
.content-section-inner a:hover { color: var(--accent); }
.content-section-inner strong { color: var(--text); font-weight: 700; }

/* FAQ items */
.faq-item {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 8px;
}
.faq-item[open] { border-color: var(--accent); background: #f0f9ff; }
.faq-item summary {
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 26px;
  font-size: 0.96rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--accent);
  font-weight: 700;
  transition: transform .15s;
}
.faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-item p {
  margin: 10px 0 0;
  color: var(--text-mid);
  font-size: 0.92rem;
  line-height: 1.7;
}

/* =============================================================
   UI polish — empty state, metric emphasis, outcome buttons
   ============================================================= */
.empty-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: center;
  margin: 16px 0 12px;
}

/* Metric card: stronger "true CPL gap" emphasis */
.metric-emphasis {
  position: relative;
  border-color: var(--accent);
  border-left-width: 3px;
}
.metric-emphasis::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(14,165,233,.15);
}
.metric-credit { border-left: 3px solid var(--good); }

/* Outcome buttons: bigger tap targets + visual outcome icons */
.outcome-grid {
  gap: 10px;
}
.outcome-btn {
  padding: 14px 14px;
  font-size: 0.93rem;
  font-weight: 600;
  position: relative;
  padding-left: 38px;
}
.outcome-btn::before {
  content: '';
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #e2e8f0;
  border: 2px solid #cbd5e1;
  transition: background .15s, border-color .15s;
}
.outcome-btn[data-outcome="booked"]::before { background: #dcfce7; border-color: #86efac; }
.outcome-btn[data-outcome="quoted"]::before { background: #dbeafe; border-color: #93c5fd; }
.outcome-btn[data-outcome="lost"]::before { background: #fef3c7; border-color: #fcd34d; }
.outcome-btn[data-outcome="spam"]::before,
.outcome-btn[data-outcome="wrong_service"]::before,
.outcome-btn[data-outcome="out_of_area"]::before { background: #fee2e2; border-color: #fca5a5; }
.outcome-btn[data-outcome="existing_client"]::before { background: #ffedd5; border-color: #fdba74; }
.outcome-btn.selected::before {
  box-shadow: 0 0 0 2px #fff inset;
}

/* Recommendation card severity polish */
.top-recommendation {
  position: relative;
  padding-left: 24px;
}
.top-recommendation.sev-high {
  border-left-color: var(--bad);
  background: var(--bad-tint);
}
.top-recommendation.sev-high .rec-label { color: var(--bad); }

/* Period bar polish */
.period-bar {
  background: var(--bg);
  padding: 10px 14px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
}

/* Quick data-action buttons inside the period-bar */
.period-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.period-bar .period-summary {
  margin-left: auto;
  margin-right: 8px;
}
.data-btn {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.data-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.data-btn-danger {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff;
}
.data-btn-danger:hover {
  background: #fef2f2;
  border-color: #f87171;
  color: #991b1b;
}

/* Data management card on Log view */
.data-mgmt-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-danger {
  background: #fff;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.btn-danger:hover {
  background: #fef2f2;
  color: #991b1b;
  border-color: #f87171;
}

@media (max-width: 640px) {
  .period-bar .period-summary { margin-left: 0; margin-right: 0; width: 100%; }
  .period-actions { width: 100%; }
  .data-btn { flex: 1; min-width: 0; text-align: center; }
}

/* LSA "How to download CSV" helper block on Log view */
.lsa-howto {
  margin: 0 0 18px;
  padding: 12px 16px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-left: 3px solid #0ea5e9;
  border-radius: 8px;
}
.lsa-howto > summary {
  cursor: pointer;
  color: #0c4a6e;
  font-size: 0.94rem;
  user-select: none;
  padding: 2px 0;
  list-style-position: outside;
}
.lsa-howto[open] > summary {
  margin-bottom: 10px;
}
.lsa-howto-steps {
  margin: 4px 0 8px;
  padding-left: 22px;
  color: var(--text);
  font-size: 0.93rem;
  line-height: 1.6;
}
.lsa-howto-steps li {
  margin-bottom: 5px;
}
.lsa-howto-steps a {
  color: #0c4a6e;
  font-weight: 600;
}
.lsa-howto-steps a:hover {
  color: #0ea5e9;
}
.lsa-howto .muted {
  margin-top: 6px;
  color: #475569;
}

/* Rich import-result banner with CPL benchmark + adjust UI */
.status-msg.import-result {
  padding: 16px 18px;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-left: 4px solid #16a34a;
  color: var(--text);
  margin-top: 12px;
}
.import-result-head {
  font-size: 1rem;
  margin-bottom: 8px;
}
.import-result-list {
  margin: 4px 0 10px;
  padding-left: 20px;
  font-size: 0.9rem;
  color: var(--text-mid);
}
.import-result-list li { margin-bottom: 3px; }
.import-result-cpl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 0.92rem;
}
.import-result-cpl .btn-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: #15803d;
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
}
.import-result-cpl .btn-text:hover {
  color: #166534;
  text-decoration: underline;
}
.import-result-adjust {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: rgba(255,255,255,0.6);
  border-radius: 6px;
  margin-bottom: 8px;
}
.import-result-adjust label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.import-result-adjust input {
  width: 90px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
}
.import-result-adjust .btn-primary {
  padding: 7px 14px;
  font-size: 0.88rem;
}
.import-result-note {
  margin: 0;
  font-size: 0.85rem;
}

/* ===================== LSA-style lead rows (mirrors Google's LSA dashboard) ===================== */
.lead-row.lead-row-lsa {
  display: grid;
  grid-template-columns: 1.6fr 1.4fr 110px 90px 1.1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--border);
  font-size: 0.9rem;
}
.lead-row.lead-row-lsa:hover { background: var(--bg-soft); }
.lead-row-lsa .cell-customer-main {
  font-weight: 600;
  color: var(--text);
}
.lead-row-lsa .cell-customer-main.cell-customer-nophone {
  font-weight: 500;
  color: var(--text-muted);
  font-style: italic;
}
.lead-row-lsa .cell-customer-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.lead-row-lsa .cell-jobtype {
  display: flex;
  flex-direction: column;
}
.lead-row-lsa .jobtype-text {
  color: var(--text);
  font-weight: 500;
}
.lead-row-lsa .intent-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.lead-row-lsa .cell-date {
  color: var(--text-mid);
  font-size: 0.84rem;
}
.lead-row-lsa .lead-actions {
  display: flex;
  gap: 4px;
}
.lead-row-lsa .lead-actions button {
  font-size: 0.78rem;
  padding: 5px 9px;
  border: 0.5px solid var(--border);
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-mid);
}
.lead-row-lsa .lead-actions button:hover {
  background: var(--bg-soft);
  color: var(--text);
}

/* Charge-status pill — colors match Google's LSA dashboard */
.charge-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.charge-charged {
  background: #dbeafe;
  color: #1e40af;
}
.charge-not-charged {
  background: #f1f5f9;
  color: #475569;
}
.charge-credited {
  background: #dcfce7;
  color: #166534;
}

/* Booking-outcome picker — looks like a chip, behaves like a select */
.booking-picker {
  display: inline-block;
  padding: 4px 22px 4px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position: calc(100% - 11px) 50%, calc(100% - 7px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px dashed #cbd5e1;
  color: #64748b;
  transition: border-color 0.12s, background-color 0.12s;
  max-width: 180px;
}
.booking-picker:hover {
  border-color: #38bdf8;
  color: #1e40af;
}
.booking-picker-set {
  border-style: solid;
  border-color: transparent;
}
.booking-picker.booking-booked { background-color: #d1fae5; color: #065f46; }
.booking-picker.booking-quoted { background-color: #dbeafe; color: #1e40af; }
.booking-picker.booking-lost { background-color: #fee2e2; color: #991b1b; }
.booking-picker.booking-spam { background-color: #fef3c7; color: #92400e; }
.booking-picker.booking-wrong_service { background-color: #fee2e2; color: #991b1b; }
.booking-picker.booking-out_of_area { background-color: #fee2e2; color: #991b1b; }
.booking-picker.booking-existing_client { background-color: #fef3c7; color: #92400e; }

/* Recommendations section (always visible below leads list) */
.recs-section {
  margin-top: 18px;
}
.recs-section .card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.recs-count {
  display: inline-flex;
  gap: 6px;
}
.count-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
}
.count-pill.count-high { background: #fee2e2; color: #991b1b; }
.count-pill.count-med { background: #fef3c7; color: #92400e; }
.count-pill.count-low { background: #e0f2fe; color: #075985; }
.recs-intro {
  margin: 6px 0 14px;
}
.rec-card-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.rec-card-head h4 {
  margin: 0;
  flex: 1;
  min-width: 200px;
}
.rec-sev-tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.rec-sev-high { background: #fee2e2; color: #991b1b; }
.rec-sev-med { background: #fef3c7; color: #92400e; }
.rec-sev-low { background: #e0f2fe; color: #075985; }
.recs-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-left: 3px solid #16a34a;
  border-radius: 8px;
}
.recs-empty-icon {
  font-size: 1.6rem;
  color: #16a34a;
  font-weight: 700;
}

/* Primary import card — visually elevated so contractors see CSV upload first */
.card-import-primary {
  border: 1px solid #bae6fd;
  border-left: 4px solid #0ea5e9;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 60%);
}
.card-import-primary .card-head h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.recommended-pill {
  display: inline-block;
  background: #0ea5e9;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 4px;
}
.io-grid-prominent {
  margin-top: 14px;
}
.io-block-import {
  background: #fff;
  border: 1px dashed #0ea5e9;
  border-radius: 8px;
  padding: 16px;
}
.io-block-import h4 {
  margin: 0 0 10px;
  color: #0c4a6e;
}
.io-block-import input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

/* Make the "Import LSA CSV" tab visually flag itself */
.tab-import {
  position: relative;
}
.tab-import::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 6px;
  width: 6px;
  height: 6px;
  background: #0ea5e9;
  border-radius: 50%;
}

/* Recent leads header row (column titles for LSA-style table) */
.leads-list.leads-list-lsa::before {
  content: '';
  display: grid;
  grid-template-columns: 1.6fr 1.4fr 110px 90px 1.1fr auto;
}

@media (max-width: 880px) {
  .lead-row.lead-row-lsa {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 14px 12px;
  }
  .lead-row-lsa .cell-jobtype,
  .lead-row-lsa .cell-charge,
  .lead-row-lsa .cell-date,
  .lead-row-lsa .cell-booking {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .lead-row-lsa .cell-jobtype { flex-direction: row; }
  .lead-row-lsa .intent-sub { margin-top: 0; }
  .lead-row-lsa .lead-actions {
    grid-row: 1;
    grid-column: 2;
  }
}

/* BGM CTA strip polish */
.bgm-cta-strip {
  border-left: 3px solid var(--accent);
  background: #f0f9ff;
}
.bgm-cta-strip .btn-primary {
  padding: 10px 20px;
}

/* Keyboard shortcut hint chips on the tabs */
.tab .kbd {
  display: none;
}
@media (min-width: 768px) {
  .tab .kbd {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--bg-soft);
    color: var(--text-muted);
    border: 0.5px solid var(--border);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    line-height: 1.2;
    vertical-align: middle;
  }
  .tab.active .kbd { background: var(--bg); color: var(--accent-dark); }
}

/* Inline contextual CTA inside high-severity rec cards + the top recommendation card */
.rec-inline-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(14,165,233,.08);
  border-left: 3px solid #0ea5e9;
  font-size: 0.88rem;
}
.rec-inline-cta-text {
  color: #1e293b;
  font-weight: 500;
}
.rec-inline-cta-link {
  color: #0c4a6e;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.rec-inline-cta-link:hover {
  color: #0ea5e9;
  text-decoration: underline;
}
.top-recommendation .rec-inline-cta {
  background: rgba(255,255,255,.55);
  border-left-color: #b91c1c;
}
.top-recommendation .rec-inline-cta-link {
  color: #991b1b;
}
.top-recommendation .rec-inline-cta-link:hover {
  color: #b91c1c;
}

/* Lead row: tap-to-expand on mobile (whole row clickable) */
@media (max-width: 640px) {
  .lead-row {
    cursor: pointer;
    padding: 14px 12px;
    border-radius: var(--radius);
  }
  .lead-row:hover { background: var(--bg-soft); }
  .lead-row .lead-actions { gap: 4px; }
}

/* Sample-data badge on dashboard when sample is loaded */
.sample-data-banner {
  background: #fef9c3;
  border: 0.5px solid #fde68a;
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.88rem;
  color: #78350f;
}
.sample-data-banner strong { color: #713f12; }
.sample-data-banner button {
  background: #fff;
  color: #78350f;
  border: 0.5px solid #fde68a;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.sample-data-banner button:hover { background: #fef3c7; }

