:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --card: rgba(255, 255, 255, 0.72);
  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.65);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --accent-2: #5856d6;
  --call: #34c759;
  --call-text: #043814;
  --danger: #ff3b30;
  --border: rgba(0, 0, 0, 0.08);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
  --radius: 18px;
  --radius-lg: 22px;
  --pill: 980px;
  --tabbar-h: 72px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(0,113,227,.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(88,86,214,.10), transparent 50%),
    radial-gradient(700px 400px at 50% 100%, rgba(255,45,85,.06), transparent 45%),
    var(--bg);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}
body.sheet-open { overflow: hidden; }
.hidden { display: none !important; }
a { color: var(--accent); }

#app { min-height: 100vh; padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px); }
.view { padding: 16px; padding-top: calc(16px + var(--safe-top)); max-width: 720px; margin: 0 auto; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box {
  width: min(420px, 100%); padding: 32px 28px; border-radius: var(--radius-lg);
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  backdrop-filter: blur(26px) saturate(165%); box-shadow: var(--shadow);
}
.brand { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
h1 { margin: 8px 0; font-size: 30px; font-weight: 800; letter-spacing: -0.03em; }
.login-box p { margin: 0 0 18px; color: var(--muted); line-height: 1.4; }
label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
input, textarea, select {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: rgba(255,255,255,.9); color: inherit; font-size: 16px; font-family: inherit;
}
textarea { resize: vertical; min-height: 88px; }
.btn, button.btn {
  appearance: none; border: 0; cursor: pointer; font-family: inherit; font-weight: 700;
  border-radius: var(--pill); padding: 14px 18px; font-size: 16px; min-height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.btn.block { width: 100%; display: block; text-align: center; text-decoration: none; }
.btn.ghost {
  background: var(--glass); color: var(--text); border: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
.btn.call { background: var(--call); color: var(--call-text); }
.btn.sm { min-height: 40px; padding: 8px 14px; font-size: 14px; }
.err { color: var(--danger); min-height: 18px; margin-top: 10px; font-size: 14px; }
.ok { color: #15803d; font-size: 14px; }

/* Header */
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.topbar h1 { font-size: 28px; margin: 4px 0 0; }
.counts { color: var(--muted); font-size: 14px; font-weight: 600; }

/* Glass cards / KPIs */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.kpi {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
  backdrop-filter: blur(26px) saturate(165%); padding: 14px 16px; box-shadow: var(--shadow);
}
.kpi .n { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.progress {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px; backdrop-filter: blur(20px);
}
.progress-bar { height: 8px; border-radius: 980px; background: rgba(0,0,0,.06); overflow: hidden; margin-top: 10px; }
.progress-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--call)); border-radius: 980px; transition: width .35s ease; }

/* Filters */
.filter-glass {
  background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: var(--radius);
  backdrop-filter: blur(26px); padding: 12px; margin-bottom: 12px; display: grid; gap: 8px;
}
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-glass input[type="search"] { grid-column: 1 / -1; }

/* Lead cards */
.lead-list { display: grid; gap: 10px; }
.hunt-mcard {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
  backdrop-filter: blur(22px); padding: 14px 16px; box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.hunt-mcard:active { transform: scale(0.985); }
.hunt-mcard h2 { margin: 0 0 4px; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.hunt-mcard .sub { color: var(--muted); font-size: 13px; line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: var(--pill);
  background: rgba(255,255,255,.7); border: 1px solid var(--border); color: var(--muted);
}
.card-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; margin-top: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 8px; }
.meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, rgba(0,0,0,.04), rgba(0,0,0,.08), rgba(0,0,0,.04)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* Tabbar */
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(8px + var(--safe-bottom));
  height: var(--tabbar-h); display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 8px; border-radius: 24px; z-index: 40;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  backdrop-filter: blur(28px) saturate(180%); box-shadow: 0 12px 40px rgba(0,0,0,.12);
}
.tabbar button {
  border: 0; background: transparent; border-radius: 16px; font-family: inherit;
  font-size: 11px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; cursor: pointer;
}
.tabbar button .ico { font-size: 18px; line-height: 1; }
.tabbar button.is-on { color: var(--accent); background: rgba(0,113,227,.1); }

/* Focus sheet */
.sheet { position: fixed; inset: 0; z-index: 80; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.35); backdrop-filter: blur(4px); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 94vh; overflow: auto;
  background: rgba(255,255,255,.92); border-radius: 22px 22px 0 0;
  border: 1px solid var(--glass-border); backdrop-filter: blur(28px) saturate(170%);
  padding: 10px 16px calc(20px + var(--safe-bottom)); box-shadow: 0 -20px 60px rgba(0,0,0,.18);
}
.sheet-handle { width: 36px; height: 5px; border-radius: 980px; background: rgba(0,0,0,.15); margin: 4px auto 12px; }
.lead-focus-kicker { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.lead-focus-title { margin: 4px 0 2px; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.lead-focus-sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.lead-focus-call {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; border-radius: var(--pill); background: var(--call); color: var(--call-text);
  font-weight: 800; text-decoration: none; margin-bottom: 10px;
}
.lead-focus-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.lead-focus-sec-btn {
  text-align: center; text-decoration: none; color: var(--text); font-weight: 700; font-size: 14px;
  min-height: 44px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--pill); background: var(--glass); border: 1px solid var(--border);
}
.lead-focus-sec-btn.is-muted { opacity: .4; pointer-events: none; }
.lead-focus-grid { display: grid; gap: 8px; margin-bottom: 12px; }
.lead-focus-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px;
  border-radius: 14px; background: rgba(255,255,255,.65); border: 1px solid var(--border);
}
.lead-focus-row-k { color: var(--muted); font-size: 12px; font-weight: 600; }
.lead-focus-row-v { font-size: 13px; font-weight: 700; text-align: right; }
.lead-focus-section {
  border-radius: 16px; background: rgba(255,255,255,.7); border: 1px solid var(--border);
  margin-bottom: 10px; overflow: hidden;
}
.lead-focus-section > summary {
  list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 800; font-size: 15px;
}
.lead-focus-section > summary::-webkit-details-marker { display: none; }
.lead-focus-section-body { padding: 0 16px 16px; }
.lead-focus-tips { margin: 0; padding-left: 18px; color: var(--text); font-size: 14px; line-height: 1.45; }
.lead-focus-tips li { margin-bottom: 8px; }
.lead-focus-outcomes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.lead-outcome {
  border: 1px solid var(--border); background: #fff; border-radius: 14px; min-height: 48px;
  font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit;
}
.lead-outcome.is-on { border-color: var(--accent); background: rgba(0,113,227,.1); color: var(--accent); }
.lead-outcome.is-good.is-on { border-color: var(--call); background: rgba(52,199,89,.12); color: #15803d; }
.lead-outcome.is-bad.is-on { border-color: var(--danger); background: rgba(255,59,48,.08); color: var(--danger); }
.lead-stars { display: flex; gap: 6px; margin-bottom: 10px; }
.lead-star {
  border: 0; background: transparent; font-size: 28px; color: rgba(0,0,0,.18); cursor: pointer; line-height: 1;
}
.lead-star.is-on { color: #f5a524; }
.lead-focus-note { width: 100%; margin-bottom: 10px; }
.lead-focus-save { width: 100%; }
.score-row { display: flex; flex-wrap: wrap; gap: 6px; }
.score-pick {
  min-width: 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; font-weight: 700; cursor: pointer; font-family: inherit;
}
.score-pick.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.call-history { display: grid; gap: 6px; margin-top: 8px; }
.call-history .item {
  font-size: 12px; color: var(--muted); padding: 8px 10px; border-radius: 12px;
  background: rgba(0,0,0,.03); border: 1px solid var(--border);
}

/* More tab */
.more-card {
  background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius);
  backdrop-filter: blur(22px); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.more-card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 800; }
.more-card p, .help li { color: var(--muted); font-size: 14px; line-height: 1.45; }
.quick-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-filters button { font-size: 13px; }

@media (min-width: 900px) {
  .sheet-panel { left: 50%; transform: translateX(-50%); width: min(560px, 100%); border-radius: 22px; bottom: 24px; max-height: 90vh; }
}
