:root {
  --bg: #0c0c0e;
  --surface-top: #111115;
  --surface: #18181b;
  --surface-nested: #0c0c0e;
  --border: #2a2a32;
  --orange: #f97316;
  --orange-bg: rgba(249,115,22,0.12);
  --orange-border: rgba(249,115,22,0.25);
  --amber: #eab308;
  --amber-bg: rgba(234,179,8,0.12);
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.12);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.10);
  --purple: #a855f7;
  --purple-bg: rgba(168,85,247,0.12);
  --muted-bg: rgba(82,82,91,0.20);
  --text: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #6b6b78;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0; padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-tap-highlight-color: transparent;
  font-size: 16px;
}

a { color: inherit; text-decoration: none; }

input, textarea, button, select {
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
}

textarea {
  background: var(--surface-nested);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  width: 100%;
  resize: vertical;
  line-height: 1.5;
}
textarea:focus, input:focus { outline: 2px solid var(--orange); outline-offset: -1px; }

button {
  cursor: pointer; border: none; background: none;
  min-height: 44px;
}

.page { padding: 16px 16px 96px; max-width: 760px; margin: 0 auto; }
.page-call { padding-bottom: 220px; }

/* ── Header ────────────────────────────────────────────── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px 16px; gap: 12px;
}
.header-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.header-date { font-size: 12px; color: var(--text-secondary); }
.header-logout { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── Banners ───────────────────────────────────────────── */
.banner {
  padding: 10px 14px; border-radius: 10px;
  font-size: 13px; margin-bottom: 14px;
  border: 1px solid;
}
.banner-amber {
  background: var(--amber-bg); border-color: rgba(234,179,8,0.3);
  color: var(--amber);
}
.banner-red {
  background: var(--red-bg); border-color: rgba(239,68,68,0.3);
  color: var(--red);
}
.banner code { background: rgba(255,255,255,0.05); padding: 1px 5px; border-radius: 4px; }

/* ── Strip (scanner status) ─────────────────────────────── */
.strip {
  background: var(--surface-top); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px;
}
.strip-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.strip-value { font-size: 13px; }
.strip-value.muted { color: var(--text-muted); }

/* ── Block ─────────────────────────────────────────────── */
.block { margin-bottom: 22px; }
.block-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
}
.block-title { font-size: 15px; font-weight: 600; margin: 0; }
.block-link { font-size: 12px; color: var(--orange); }

/* ── Card ──────────────────────────────────────────────── */
.card {
  display: block;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
  margin-bottom: 10px;
}
.card-callback { border-left: 2.5px solid var(--orange); }
.card-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-name { font-size: 16px; font-weight: 600; }
.card-meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.card-note { font-size: 12px; color: var(--text-secondary); margin-top: 6px; font-style: italic; }
.card-cta { font-size: 12px; color: var(--orange); margin-top: 8px; }
.card-phone { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ── Score badge ───────────────────────────────────────── */
.score {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.score-high { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-border); }
.score-mid { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(234,179,8,0.3); }
.score-low { background: var(--muted-bg); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Chips ─────────────────────────────────────────────── */
.chip {
  display: inline-block;
  padding: 4px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 500;
  margin-top: 6px; margin-right: 6px;
  border: 1px solid var(--border);
  background: var(--muted-bg);
  color: var(--text-secondary);
}
.chip-amber { background: var(--amber-bg); color: var(--amber); border-color: rgba(234,179,8,0.3); }
.chip-orange { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-border); }
.chip-assigned { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-border); }
.chip-form-only { background: var(--purple-bg); color: var(--purple); border-color: rgba(168,85,247,0.3); }
.chip-assign { cursor: pointer; }
.chip-dnc { cursor: pointer; padding: 4px 10px; }

.card-actions { display: flex; gap: 8px; margin-top: 8px; }
.card-actions .chip { margin-top: 0; }
.lead-card-wrap { margin-bottom: 10px; }
.lead-card-wrap .card { margin-bottom: 0; }

/* ── Pipeline ──────────────────────────────────────────── */
.pipeline-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}
.pipeline-cell {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; text-align: center;
}
.pipeline-count { font-size: 22px; font-weight: 700; color: var(--orange); }
.pipeline-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.pipeline-revenue { margin-top: 8px; font-size: 12px; color: var(--text-secondary); text-align: right; }

/* ── Team ──────────────────────────────────────────────── */
.team-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 6px;
}
.team-name { font-size: 13px; font-weight: 600; }
.team-stat { font-size: 12px; color: var(--text-secondary); }
.team-conversion .team-stat { color: var(--orange); font-weight: 600; }

/* ── Calendar ──────────────────────────────────────────── */
.calendar { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.cal-day {
  text-align: center; padding: 8px 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; position: relative;
}
.cal-today { background: var(--orange-bg); border-color: var(--orange-border); }
.cal-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.cal-num { font-size: 16px; font-weight: 600; margin-top: 2px; }
.cal-dot { width: 4px; height: 4px; background: var(--orange); border-radius: 50%; margin: 4px auto 0; }

/* ── Empty / Status ────────────────────────────────────── */
.empty {
  text-align: center; padding: 30px 14px;
  color: var(--text-muted); font-size: 13px;
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: 12px;
}

.status-badge {
  display: inline-block; padding: 2px 8px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  border-radius: 6px; margin-top: 6px;
  background: var(--muted-bg); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.status-badge.status-callback { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-border); }
.status-badge.status-booked { background: var(--green-bg); color: var(--green); border-color: rgba(34,197,94,0.3); }
.status-badge.status-not-interested, .status-badge.status-dnc { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,0.3); }

.pain-preview { font-size: 12px; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }

/* ── Filters ───────────────────────────────────────────── */
.filter-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.filter-chip {
  padding: 6px 14px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; white-space: nowrap;
  color: var(--text-secondary);
}
.filter-active { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-border); }

/* ── Login ─────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface-top); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px 24px;
}
.login-title {
  font-size: 26px; font-weight: 700; text-align: center; margin: 0 0 28px;
  letter-spacing: -0.02em;
}
.login-title span { color: var(--orange); }
.login-input {
  width: 100%; padding: 16px;
  background: var(--surface-nested); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text);
  margin-bottom: 14px;
  text-align: center; letter-spacing: 0.04em;
}
.login-button {
  width: 100%; padding: 16px;
  background: var(--orange); color: #000;
  border-radius: 12px; font-weight: 700; font-size: 15px;
  letter-spacing: 0.02em;
}
.login-error {
  font-size: 12px; color: var(--red); text-align: center;
  background: var(--red-bg); border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px; padding: 8px; margin-bottom: 12px;
}

/* ── Bottom nav ────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: var(--surface-top); border-top: 1px solid var(--border);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  z-index: 30;
}
.nav-item {
  flex: 1; text-align: center;
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 6px 0;
}
.nav-icon { display: block; font-size: 18px; margin-bottom: 2px; }
.nav-item.active { color: var(--orange); }

/* ── Call screen ───────────────────────────────────────── */
.call-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--surface-top);
  border-bottom: 1px solid var(--border);
  margin: -16px -16px 14px;
}
.call-back { font-size: 22px; color: var(--text); width: 32px; }
.call-business { flex: 1; font-size: 14px; font-weight: 600; }
.call-timer {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  color: var(--orange); font-weight: 700; font-size: 16px;
  min-width: 56px; text-align: right;
}

.call-history { font-size: 11px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
.call-history.has-history { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }

.phone-bar {
  background: var(--orange-bg); border: 1px solid var(--orange-border);
  border-radius: 12px; padding: 14px;
  margin-bottom: 12px; text-align: center;
}
.phone-link { font-size: 22px; font-weight: 700; color: var(--orange); display: block; }
.phone-owner { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.phone-missing { font-size: 13px; color: var(--text-muted); }

.quick-links { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.ql-btn {
  flex-shrink: 0; padding: 8px 14px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-secondary);
}
.ql-dnc { color: var(--red); border-color: rgba(239,68,68,0.3); }

#email-warning {
  background: var(--amber-bg); border: 1px solid rgba(234,179,8,0.3);
  color: var(--amber); border-radius: 10px; padding: 10px 14px;
  font-size: 12px; margin-bottom: 12px;
}
#email-warning:empty { display: none; }

.cs-section { margin-bottom: 16px; }
.cs-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--orange); margin-bottom: 6px; font-weight: 600;
}
.cs-textarea { font-size: 14px; line-height: 1.6; }
.cs-script, .cs-objections { min-height: 160px; }
.cs-notes { background: var(--amber-bg); border-color: rgba(234,179,8,0.3); }

.badge {
  display: inline-block; font-size: 9px;
  padding: 2px 6px; border-radius: 4px;
  margin-left: 6px; font-weight: 500;
  text-transform: none; letter-spacing: 0;
}
.badge-purple { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(168,85,247,0.3); }

/* ── Bottom action bar ─────────────────────────────────── */
.bottom-actions {
  position: fixed; bottom: 56px; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(6,1fr);
  gap: 4px; padding: 6px 6px;
  background: var(--surface-top); border-top: 1px solid var(--border);
  z-index: 25;
}
.action-btn {
  height: 56px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text);
  font-weight: 500; padding: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
}
.action-booked { background: var(--green-bg); color: var(--green); border-color: rgba(34,197,94,0.3); }
.action-callback { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-border); }
.action-not { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,0.3); }
.action-save { background: var(--orange); color: #000; height: 50px; font-size: 14px; font-weight: 700; }
.action-form { background: var(--purple-bg); color: var(--purple); border-color: rgba(168,85,247,0.3); }

/* ── Bottom sheet ──────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 40;
}
.bottom-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--surface-top); border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0; padding: 14px 16px 24px;
  z-index: 50; transform: translateY(100%);
  transition: transform 0.25s ease;
  max-height: 80vh; overflow-y: auto;
}
.bottom-sheet.open { transform: translateY(0); }
.sheet-handle { width: 44px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 14px; }
.bottom-sheet h3 { margin: 0 0 12px; font-size: 16px; }
.bottom-sheet label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; display: block; margin: 10px 0 4px; }
.bottom-sheet input[type=date] { width: 100%; padding: 10px; background: var(--surface-nested); border: 1px solid var(--border); border-radius: 8px; color: var(--text); margin-bottom: 8px; }
.sheet-meta { font-size: 12px; color: var(--text-muted); margin: 12px 0; }

/* ── Next lead card ────────────────────────────────────── */
.next-lead-card {
  position: fixed; bottom: 130px; left: 16px; right: 16px;
  background: var(--surface-top); border: 1px solid var(--orange-border);
  border-radius: 12px; padding: 14px; z-index: 35;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.nl-label { font-size: 10px; text-transform: uppercase; color: var(--orange); letter-spacing: 0.08em; }
.nl-name { font-size: 16px; font-weight: 600; margin: 4px 0 2px; }
.nl-meta { font-size: 12px; color: var(--text-secondary); }
.nl-cta { display: block; margin-top: 10px; color: var(--orange); font-weight: 600; }
.nl-back { display: block; margin-top: 8px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; }

/* ── Claude sidebar ────────────────────────────────────── */
.claude-toggle {
  position: fixed; bottom: 130px; right: 16px;
  background: var(--purple); color: #000; padding: 10px 14px;
  border-radius: 22px; font-weight: 600; font-size: 13px;
  z-index: 30; box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  min-height: auto;
}
.claude-sidebar {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 100%; max-width: 420px;
  background: var(--surface-top); border-left: 1px solid var(--border);
  z-index: 60; display: flex; flex-direction: column;
}
.claude-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px; border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.claude-close { font-size: 22px; color: var(--text-secondary); }
.claude-thread { flex: 1; overflow-y: auto; padding: 14px; font-size: 13px; }
.claude-msg { margin-bottom: 12px; line-height: 1.5; }
.claude-msg.you { color: var(--text-secondary); }
.claude-msg.bot { color: var(--text); padding: 10px 12px; background: var(--surface); border-radius: 10px; }
.claude-input-row { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--border); }
.claude-input-row input { flex: 1; padding: 10px; background: var(--surface-nested); border: 1px solid var(--border); border-radius: 8px; }
.claude-input-row button { background: var(--orange); color: #000; padding: 0 16px; border-radius: 8px; font-weight: 600; }

/* ── Email modal ───────────────────────────────────────── */
#email-modal input { width: 100%; padding: 10px; background: var(--surface-nested); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
#email-modal textarea { width: 100%; }
.email-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.email-actions button { background: var(--surface); border: 1px solid var(--border); padding: 12px 14px; border-radius: 10px; font-size: 13px; flex: 1; min-height: 44px; }
#email-copy { background: var(--orange); color: #000; font-weight: 600; }

/* ── Form modal ────────────────────────────────────────── */
.form-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.form-actions button { background: var(--surface); border: 1px solid var(--border); padding: 12px 14px; border-radius: 10px; font-size: 13px; flex: 1; min-height: 44px; }
.form-btn-copy { background: var(--purple); color: #000; font-weight: 700; border-color: var(--purple) !important; flex: 2 !important; }
.form-btn-log { background: var(--green-bg); color: var(--green); border-color: rgba(34,197,94,0.3) !important; }
.form-btn-regen { flex: 0 0 auto !important; color: var(--text-muted); font-size: 12px; }

/* ── Suggestions ───────────────────────────────────────── */
.card-suggestion .suggestion-text { background: var(--surface-nested); padding: 10px; border-radius: 8px; font-size: 12px; line-height: 1.5; white-space: pre-wrap; max-height: 200px; overflow-y: auto; }
.suggestion-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-accept { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.3); padding: 8px 14px; border-radius: 8px; flex: 1; }
.btn-dismiss { background: var(--muted-bg); color: var(--text-secondary); border: 1px solid var(--border); padding: 8px 14px; border-radius: 8px; flex: 1; }

/* ── Toast ─────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 130px; left: 50%; transform: translateX(-50%);
  z-index: 100; display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
}
.toast {
  background: var(--surface-top); border: 1px solid var(--orange-border);
  color: var(--orange); padding: 10px 16px; border-radius: 10px;
  font-size: 13px; opacity: 0; transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

@media (min-width: 720px) {
  .pipeline-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
