:root {
  --bg: #09080f;
  --bg-2: #100e1a;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --border-2: rgba(255, 255, 255, 0.16);
  --text: #f3f1ff;
  --muted: #a19cbc;
  --faint: #6f6a8a;
  --accent: #7c5cff;
  --accent-2: #ff5c8a;
  --grad: linear-gradient(135deg, #7c5cff 0%, #b45cff 45%, #ff5c8a 100%);
  --green: #2ed3a0;
  --amber: #ffb547;
  --red: #ff5c6c;
  --blue: #4cc3ff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 0% -10%, rgba(124, 92, 255, 0.22), transparent 60%),
    radial-gradient(700px 400px at 110% 10%, rgba(255, 92, 138, 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  display: none;
  width: 248px; flex-shrink: 0; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--border); background: rgba(9, 8, 15, 0.6); backdrop-filter: blur(20px);
  flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; font-weight: 800; font-size: 16px; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; font-size: 17px; box-shadow: 0 8px 24px rgba(124, 92, 255, 0.45); }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--muted);
  text-decoration: none; font-weight: 600; transition: 0.15s;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); }
.nav-item svg { width: 20px; height: 20px; }
.sidebar .spacer { flex: 1; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface); text-decoration: none; }

main { flex: 1; min-width: 0; padding: 18px 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); max-width: 1180px; margin: 0 auto; width: 100%; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(12, 10, 20, 0.82); backdrop-filter: blur(22px) saturate(160%);
  border-top: 1px solid var(--border);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--faint); text-decoration: none; }
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--text); }
.tab.active svg { color: var(--accent); filter: drop-shadow(0 0 8px rgba(124, 92, 255, 0.7)); }
.tab.fab { position: relative; }
.tab.fab .fab-btn { width: 50px; height: 50px; margin-top: -22px; border-radius: 17px; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: 0 10px 30px rgba(124, 92, 255, 0.55); }
.tab.fab .fab-btn svg { color: #fff; filter: none; }

@media (min-width: 900px) {
  .sidebar { display: flex; }
  .tabbar { display: none; }
  main { padding: 28px 32px 48px; }
}

/* ---------- headers ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 800; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); font-weight: 700; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.section-title h2 { font-size: 17px; font-weight: 700; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card.glow { background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, var(--grad) border-box; border: 1px solid transparent; }
.grid { display: grid; gap: 12px; }
.grid > * { min-width: 0; }
.grid.stats { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .grid.stats { grid-template-columns: repeat(4, 1fr); } }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid.two { grid-template-columns: 1.3fr 1fr; } }

.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--faint); font-size: 12px; }

.hero-stat { position: relative; overflow: hidden; padding: 22px; }
.hero-stat::after { content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: var(--grad); opacity: 0.25; filter: blur(40px); }
.hero-stat .big { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 13px;
  border: 1px solid var(--border-2); background: var(--surface-2); font-weight: 650; cursor: pointer; text-decoration: none;
  transition: transform 0.08s, background 0.15s, opacity 0.15s; white-space: nowrap; min-height: 44px;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 24px rgba(124, 92, 255, 0.35); }
.btn.green { background: var(--green); border-color: transparent; color: #04231a; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 7px 12px; min-height: 36px; font-size: 13.5px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; padding: 12px 14px; border-radius: 13px; border: 1px solid var(--border-2); background: rgba(0, 0, 0, 0.25);
  outline: none; transition: border 0.15s, box-shadow 0.15s; min-height: 46px; font-size: 16px;
}
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.2); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; color: var(--faint); }
.search .input { padding-left: 42px; }

/* ---------- chips / segmented ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip.active { background: var(--text); color: #0b0a12; border-color: var(--text); }
.seg { display: flex; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 14px; gap: 4px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 10px; border-radius: 10px; font-weight: 650; color: var(--muted); cursor: pointer; font-size: 13.5px; }
.seg button.active { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill.none { background: rgba(255, 92, 108, 0.14); color: #ff8b97; }
.pill.social { background: rgba(255, 181, 71, 0.14); color: var(--amber); }
.pill.s-new { background: rgba(76, 195, 255, 0.14); color: var(--blue); }
.pill.s-contacted { background: rgba(161, 156, 188, 0.16); color: #cfcbe6; }
.pill.s-interested { background: rgba(255, 181, 71, 0.15); color: var(--amber); }
.pill.s-demo_ready { background: rgba(124, 92, 255, 0.2); color: #b7a6ff; }
.pill.s-link_sent { background: rgba(255, 92, 138, 0.16); color: #ff8fb0; }
.pill.s-sold, .pill.ok { background: rgba(46, 211, 160, 0.15); color: var(--green); }
.pill.s-not_interested, .pill.s-bad_number, .pill.s-do_not_contact, .pill.bad { background: rgba(255, 92, 108, 0.12); color: #ff8b97; }
.pill.warn { background: rgba(255, 181, 71, 0.15); color: var(--amber); }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex-shrink: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar.lg { width: 58px; height: 58px; font-size: 20px; }

/* ---------- lead list ---------- */
.lead-list { display: grid; gap: 10px; }
@media (min-width: 900px) { .lead-list { grid-template-columns: 1fr 1fr; } }
.lead {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); cursor: pointer; transition: 0.15s; text-decoration: none; position: relative;
}
.lead:hover { border-color: var(--border-2); background: rgba(255, 255, 255, 0.06); }
.lead .ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 20px; background: var(--surface-2); flex-shrink: 0; }
.lead .name { font-weight: 700; font-size: 15.5px; line-height: 1.25; }
.lead .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.lead .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.lead .right { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.stars { color: var(--amber); font-weight: 700; font-size: 13px; }
.quick-call { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: rgba(46, 211, 160, 0.14); color: var(--green); border: 0; text-decoration: none; }
.quick-call svg { width: 20px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 44px; margin-bottom: 8px; }

/* ---------- sheet (lead detail) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px); z-index: 60; opacity: 0; transition: opacity 0.2s; }
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; top: 0; background: var(--bg); overflow-y: auto; overscroll-behavior: contain;
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.open { transform: none; }
@media (min-width: 900px) {
  .sheet { left: auto; width: 620px; transform: translateX(100%); border-left: 1px solid var(--border); box-shadow: var(--shadow); }
}
.sheet-head {
  position: sticky; top: 0; z-index: 2; padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  background: rgba(9, 8, 15, 0.85); backdrop-filter: blur(18px); border-bottom: 1px solid var(--border);
}
.sheet-body { padding: 18px 16px calc(40px + var(--safe-b)); }
.lead-hero h2 { font-size: 24px; font-weight: 800; }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.action { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-weight: 650; color: var(--muted); cursor: pointer; text-decoration: none; }
.action svg { width: 22px; height: 22px; color: var(--text); }
.action.call { background: rgba(46, 211, 160, 0.12); border-color: rgba(46, 211, 160, 0.3); color: var(--green); }
.action.call svg { color: var(--green); }

.preview-card { position: relative; overflow: hidden; }
.preview-frame { width: 100%; aspect-ratio: 9 / 13; border: 0; border-radius: 14px; background: #fff; margin-top: 12px; max-height: 520px; }
.building { display: flex; align-items: center; gap: 14px; padding: 6px 0; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.12); border-top-color: var(--accent); animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.shimmer { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sh 1.4s infinite; border-radius: 12px; height: 120px; margin-top: 12px; }
@keyframes sh { to { background-position: -200% 0; } }

.script-step { border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; margin-bottom: 18px; }
.script-step .tactic { font-size: 11.5px; font-weight: 700; color: #b7a6ff; text-transform: uppercase; letter-spacing: 0.08em; }
.script-step h4 { margin: 2px 0 6px; font-size: 16px; }
.script-step .say { font-size: 16px; line-height: 1.6; }
.script-step .tip { margin-top: 8px; font-size: 13px; color: var(--muted); background: var(--surface); padding: 8px 10px; border-radius: 10px; }
details.obj { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; background: var(--surface); }
details.obj summary { font-weight: 700; cursor: pointer; list-style: none; }
details.obj summary::-webkit-details-marker { display: none; }
details.obj p { margin: 10px 0 0; line-height: 1.6; }

.timeline { display: grid; gap: 10px; }
.tl { display: flex; gap: 10px; font-size: 13.5px; }
.tl .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex-shrink: 0; }
.tl .when { color: var(--faint); font-size: 12px; }

/* ---------- leaderboard ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 10px; align-items: end; margin: 8px 0 18px; }
.pod { text-align: center; padding: 16px 8px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); position: relative; }
.pod.first { background: linear-gradient(180deg, rgba(255, 181, 71, 0.18), var(--surface)); border-color: rgba(255, 181, 71, 0.35); padding-top: 26px; }
.pod .medal { font-size: 26px; }
.pod .nm { font-weight: 800; margin-top: 6px; }
.pod .amt { font-size: 22px; font-weight: 800; margin-top: 2px; }
.pod .avatar { margin: 0 auto; }
.board-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 8px; }
.board-row .rank { width: 22px; font-weight: 800; color: var(--faint); }
.board-row .nums { margin-left: auto; text-align: right; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--grad); border-radius: 99px; }

.feed-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.feed-item:last-child { border-bottom: 0; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--faint); font-weight: 650; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-wrap { overflow-x: auto; }

/* ---------- modal / toast ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: grid; align-items: end; justify-items: center; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); animation: fade 0.15s; }
@media (min-width: 700px) { .modal-wrap { align-items: center; } }
.modal { width: 100%; max-width: 480px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 24px 24px 0 0; padding: 20px 18px calc(20px + var(--safe-b)); max-height: 92vh; overflow-y: auto; animation: up 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
@media (min-width: 700px) { .modal { border-radius: 24px; } }
.modal h3 { font-size: 20px; margin-bottom: 14px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.outcome { padding: 14px 10px; border-radius: 14px; border: 1px solid var(--border-2); background: var(--surface); font-weight: 650; cursor: pointer; text-align: center; }
.outcome.active { border-color: var(--accent); background: rgba(124, 92, 255, 0.18); }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { padding: 12px 16px; border-radius: 14px; background: rgba(28, 25, 44, 0.96); border: 1px solid var(--border-2); box-shadow: var(--shadow); font-weight: 600; animation: up 0.2s; display: flex; gap: 10px; align-items: center; }
.toast.err { border-color: rgba(255, 92, 108, 0.5); }
.toast.win { border-color: rgba(46, 211, 160, 0.5); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 400px; padding: 30px 24px; }
.login h1 { font-size: 30px; font-weight: 800; margin: 18px 0 6px; }

.kbd-hint { color: var(--faint); font-size: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; } .mb { margin-bottom: 12px; }
.flex { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
canvas#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 120; }

/* ---------- opportunity score ---------- */
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; vertical-align: 2px; font-variant-numeric: tabular-nums; }
.score.hot { background: rgba(255, 92, 108, 0.18); color: #ff8b97; }
.score.warm { background: rgba(255, 181, 71, 0.16); color: var(--amber); }
.score.cool { background: var(--surface-2); color: var(--muted); }
.score.lg { min-width: 54px; height: 54px; border-radius: 16px; font-size: 20px; }
.pill.signal { background: rgba(124, 92, 255, 0.14); color: #c4b6ff; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.signals { display: grid; gap: 8px; }
.sig { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); }
.sig .pts { flex-shrink: 0; width: 38px; text-align: center; font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.sig.neg .pts { color: var(--red); }
.roi { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .roi { grid-template-columns: repeat(4, 1fr); } }
.roi > div { background: rgba(0, 0, 0, 0.2); border-radius: 12px; padding: 10px 12px; }
.roi .v { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.demo-card { background: rgba(0, 0, 0, 0.2); border-radius: 14px; padding: 14px; }
.bubble { background: var(--surface-2); border-radius: 16px 16px 16px 4px; padding: 10px 14px; font-size: 15px; }
