:root {
  --bg: #141414;
  --bg-card: #1e1e1e;
  --bg-muted: #242424;
  --ink: #e6e6e6;
  --muted: #a0a0a0;
  --accent: #f05010;
  --accent-2: #d05010;
  --green: #2ecc71;
  --amber: #f5b041;
  --red: #e74c3c;
  --border: #2a2a2a;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

/* Top bar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: #181818;
  flex-wrap: wrap;
  gap: 8px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.brand-sep { color: var(--muted); }
.brand-client { color: var(--accent); }
.live { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.live-dot.grey { background: var(--muted); }
.live-label { color: var(--green); font-weight: 700; letter-spacing: 0.5px; }
.updated { font-size: 11px; }

main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }

.headline { margin-bottom: 24px; }
.headline h1 { font-size: 26px; font-weight: 700; }
.sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.kpi .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-bottom: 8px; }
.kpi .value { font-size: 34px; font-weight: 700; line-height: 1.1; }
.kpi .note { font-size: 12px; color: var(--muted); margin-top: 8px; min-height: 32px; }
.kpi .note.hot { color: var(--amber); }
.kpi .note.good { color: var(--green); }
.kpi.organic .accent-bar { background: var(--green); }
.kpi.paid .accent-bar { background: var(--accent); }
.kpi .accent-bar { height: 3px; border-radius: 3px; margin-top: 10px; }

/* Funnel */
.funnel { margin-bottom: 24px; }
.card h2 { font-size: 16px; margin-bottom: 14px; }
.rate-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.rate-item .r-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.rate-item .r-value { font-size: 26px; font-weight: 700; }
.rate-item .r-note { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Leads table */
.leads { margin-bottom: 24px; }
.leads-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.filters select {
  background: var(--bg-muted);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}
.leads-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.leads-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; }
.leads-table td { padding: 10px; border-bottom: 1px solid #222; }
.leads-table tr:hover td { background: #232323; }
.muted { color: var(--muted); }
.pill { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.pill.organic { background: rgba(46,204,113,.15); color: var(--green); }
.pill.paid { background: rgba(240,80,16,.15); color: var(--accent); }
.pill.landing { background: rgba(245,176,65,.15); color: var(--amber); }
.pill.whatsapp_sent { background: rgba(52,152,219,.15); color: #3498db; }
.pill.visit_booked { background: rgba(46,204,113,.18); color: var(--green); }
.pill.new { background: rgba(160,160,160,.15); color: var(--muted); }
.pill.contacted { background: rgba(245,176,65,.15); color: var(--amber); }

/* Error state */
.err { text-align: center; padding: 40px 20px; color: var(--muted); }
.err h3 { color: var(--red); margin-bottom: 8px; }

footer.foot { text-align: center; padding: 20px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
footer code { background: var(--bg-muted); padding: 2px 6px; border-radius: 4px; }

@media (max-width: 600px) {
  main { padding: 20px 14px 40px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 28px; }
  .leads-table { font-size: 12px; }
}