:root {
  --bg:           #f5f5f7;
  --card:         #ffffff;
  --text:         #1f1f1f;
  --muted:        #6e6e73;
  --accent:       #6264a7;
  --accent-hover: #4d4f8a;
  --danger:       #c8102e;
  --ok:           #107c10;
  --border:       #e1e1e4;
  --radius:       10px;
  --gap:          12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #1f1f1f;
    --card:   #2d2d2d;
    --text:   #f3f2f1;
    --muted:  #a19f9d;
    --border: #3b3b3b;
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, "Segoe UI", BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 16px; line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

main { max-width: 640px; margin: 0 auto; padding: 16px; }

/* ---- Header ---- */
header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--gap);
}
header h1 { font-size: 1.15rem; margin: 0; }

.brand {
  font-weight: 800;
  background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.icon-btn {
  width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--muted);
  cursor: pointer; font-size: 1.1rem; display: flex;
  align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--border); }

/* ---- Cards ---- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: var(--gap);
}
.card h2 { font-size: 1.05rem; margin: 0 0 4px; }
.result-card { margin-top: 12px; }
.result-card h3 { font-size: 1rem; margin: 0 0 8px; color: var(--muted); }

/* ---- Voice center layout ---- */
.voice-card { display: flex; flex-direction: column; align-items: stretch; }

.voice-center {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 6px;
}

/* ---- Mic button ---- */
.mic-button {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--accent); color: white; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.mic-button:hover:not(:disabled) { background: var(--accent-hover); }
.mic-button:active:not(:disabled) { transform: scale(0.94); }
.mic-button:disabled { opacity: 0.5; cursor: not-allowed; }

.mic-button.recording {
  background: var(--danger);
  animation: pulse-red 1.2s ease-in-out infinite;
}
.mic-button.processing {
  background: var(--muted);
  animation: pulse-grey 1.4s ease-in-out infinite;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200,16,46,.45); }
  50%       { box-shadow: 0 0 0 14px rgba(200,16,46,0); }
}
@keyframes pulse-grey {
  0%, 100% { box-shadow: 0 0 0 0 rgba(110,110,115,.4); }
  50%       { box-shadow: 0 0 0 14px rgba(110,110,115,0); }
}

/* ---- Status label + transcript preview ---- */
.status-label {
  margin: 12px 0 0; font-size: 0.95rem; color: var(--muted); text-align: center;
}
.transcript-preview {
  margin: 8px 16px 0; font-size: 0.85rem; color: var(--muted);
  font-style: italic; text-align: center; word-break: break-word;
}

/* ---- Credential re-entry modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%; max-width: 420px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
}
.modal-card h2 { font-size: 1.05rem; margin: 0 0 6px; }

/* ---- Loading spinner ---- */
.loading-row {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 0; color: var(--muted);
}
.spinner {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Usage hints ---- */
.voice-hints {
  margin: 4px 0 8px;
  padding: 10px 14px;
  /*background: var(--bg);*/
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}
.voice-hints p { margin: 0 0 6px; }
.voice-hints p:last-child { margin-bottom: 0; }
.voice-hints strong { color: var(--text); font-weight: 600; }

/* ---- Response bubble ---- */
.response-bubble {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px; margin-top: 12px;
}
.response-bubble p { margin: 0; font-size: 0.95rem; line-height: 1.5; }

/* ---- Form elements ---- */
.muted { color: var(--muted); font-size: 0.9rem; }
label {
  display: block; margin: 10px 0 0;
  font-size: 0.88rem; color: var(--muted);
}
input, select, textarea {
  display: block; width: 100%; margin-top: 4px;
  padding: 9px 12px; font-size: 0.95rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); border-color: var(--accent);
}
textarea { resize: vertical; min-height: 72px; font-family: inherit; }

/* ---- Buttons ---- */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; font-size: 0.95rem; font-weight: 500;
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
  background: var(--card); color: var(--text);
}
button.primary {
  background: var(--accent); color: white; border-color: var(--accent);
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary {
  background: var(--surface); color: var(--accent);
  border: 1.5px solid var(--accent);
}
button.secondary:hover:not(:disabled) { background: var(--accent); color: white; }
button.secondary:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost { background: transparent; }

.sf-manual-heading {
  margin: 0 0 10px; font-size: .95rem; font-weight: 600;
  border-bottom: 1px solid var(--border); padding-bottom: 6px;
}

.sf-manual-notice {
  margin: 0 0 10px; font-size: .8rem; color: var(--muted, #888);
  font-style: italic;
}

.ci-file-row.battle {
  border-color: var(--accent) !important;
  font-weight: 600;
}

.row {
  display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap;
}

/* ---- Status messages ---- */
.status {
  margin-top: 12px; padding: 10px; border-radius: 8px; font-size: 0.9rem;
  min-height: 0;
}
.status.ok   { background: rgba(16,124,16,.1);  color: var(--ok);     border: 1px solid var(--ok); }
.status.err  { background: rgba(200,16,46,.1);  color: var(--danger); border: 1px solid var(--danger); }
.status.info { background: rgba(98,100,167,.1); color: var(--accent); border: 1px solid var(--accent); }

.hidden { display: none !important; }

a { color: var(--accent); }
small { font-size: 0.8rem; }

/* ---- Password reveal toggles ---- */
.input-with-toggle { position: relative; }
.input-with-toggle input { padding-right: 44px; }
.reveal-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; padding: 0;
  background: transparent; border: none;
  font-size: 1.1rem; line-height: 1; cursor: pointer;
  color: var(--muted); border-radius: 6px;
}
.reveal-btn:hover { background: var(--border); color: var(--text); }

/* ================================================================
   NEW: header action group, bottom bar, sheets, menu overlay
   ================================================================ */

/* ---- Header left group (brand + ToDo) ---- */
.header-left {
  display: flex; align-items: center; gap: 10px;
}

/* ---- Header actions ---- */
.header-actions {
  display: flex; align-items: center; gap: 6px;
}

/* ---- ToDo octagon badge ---- */
.todo-btn {
  /* clip-path octagon */
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  width: 48px; height: 48px; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--accent); color: white; border: none; cursor: pointer;
  font-size: 0.58rem; font-weight: 700; letter-spacing: 0.03em;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}
.todo-btn:active { opacity: 0.8; }

/* ---- Labeled icon button (icon + text stacked vertically) ---- */
.icon-btn-labeled {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--muted);
  cursor: pointer; font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.02em; white-space: nowrap;
}
.icon-btn-labeled:hover { background: var(--border); }
.icon-btn-labeled svg   { color: #f5a623; }

/* ---- Body padding for fixed bottom bar ---- */
body {
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
}

/* ---- Top Picks result list ---- */
.top-pick-item {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 6px;
}
.top-pick-name       { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.top-pick-company    { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-pick-name-right { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.lead-score-badge    { display:inline-block; min-width:28px; padding:2px 6px; border-radius:10px; font-size:0.75rem; font-weight:700; text-align:center; white-space:nowrap; }
.lead-status-tag     { font-size: 0.7rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.top-pick-meta  { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.top-pick-stage {
  background: rgba(98,100,167,.15); color: var(--accent);
  padding: 2px 8px; border-radius: 12px; font-weight: 500;
}
.top-pick-amount { font-weight: 600; color: var(--ok); }
.top-pick-next, .top-pick-close { font-size: 0.8rem; color: var(--muted); }

/* ---- Bottom utility bar ---- */
#bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; align-items: center;
  background: var(--card); border-top: 1px solid var(--border);
  z-index: 200;
}
.bar-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; font-size: 0.65rem; font-weight: 500; color: var(--muted);
  background: transparent; border: none; border-radius: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bar-btn:active { background: var(--bg); }
.bar-btn svg    { color: var(--muted); flex-shrink: 0; }
.bar-btn span   { text-align: center; line-height: 1.2; }

/* ---- Popup sheets (KnowledgeHub / Tools) ---- */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.sheet-backdrop.open {
  opacity: 1; pointer-events: auto;
}
.sheet-panel {
  position: absolute; bottom: 0; left: 50%;
  width: max-content; max-width: 92vw;
  background: var(--card);
  border-radius: 14px 14px 0 0;
  padding: 12px 0 calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sheet-backdrop.open .sheet-panel { transform: translateX(-50%) translateY(0); }

/* KnowledgeHub — anchor to left edge */
#hub-sheet .sheet-panel {
  left: 6px; transform: translateY(100%);
}
#hub-sheet.open .sheet-panel { transform: translateY(0); }

/* Tools — anchor to right edge */
#tools-sheet .sheet-panel {
  left: auto; right: 6px; transform: translateY(100%);
}
#tools-sheet.open .sheet-panel { transform: translateY(0); }
.sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 0 auto 14px;
}
.sheet-title {
  font-size: 0.9rem; font-weight: 600; color: var(--muted);
  padding: 0 20px 10px; margin: 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sheet-list { list-style: none; margin: 0; padding: 6px 0; }
.sheet-item {
  padding: 15px 20px; font-size: 1rem; cursor: pointer;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.sheet-item:last-child { border-bottom: none; }
.sheet-item:active     { background: var(--bg); }

/* ---- Full-screen menu result overlay ---- */
#menu-overlay {
  position: fixed; inset: 0;
  background: var(--card);
  display: flex; flex-direction: column;
  z-index: 400;
  transform: translateY(100%);
  visibility: hidden;
  /* delay visibility hide until slide-out finishes */
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s linear 0.3s;
}
#menu-overlay.open {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s;
}
.menu-overlay-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.menu-overlay-header h2 { margin: 0; font-size: 1.05rem; }
.menu-overlay-body {
  flex: 1; overflow-y: auto; padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.menu-overlay-pdf {
  width: 100%; height: 100%; border: none;
}
.menu-content-text {
  font-size: 0.95rem; line-height: 1.75; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.required-mark { color: var(--danger); margin-left: 2px; }

/* ---- ToDo page sections ---- */
.todo-section       { margin-bottom: 24px; }
.todo-section-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  margin: 0 0 10px; padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
}
.todo-list          { list-style: none; margin: 0; padding: 0; }
.todo-list li       { padding: 7px 0; font-size: 0.9rem; color: var(--text); line-height: 1.45; }
.todo-list li::before {
  content: "•"; color: var(--accent); font-weight: 700;
  margin-right: 8px;
}
.todo-top-link {
  font-size: 0.92rem; color: var(--accent);
  text-decoration: underline; cursor: pointer;
  background: none; border: none; padding: 0; text-align: left;
}
.todo-top-link:active { opacity: 0.7; }

/* memo item row */
.memo-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 0.9rem; color: var(--text); line-height: 1.45;
}
.memo-item:last-child { border-bottom: none; }
.memo-done-btn {
  flex-shrink: 0; width: 26px; height: 26px; padding: 0;
  border: 2px solid var(--accent); border-radius: 50%;
  background: transparent; cursor: pointer; color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, color 0.12s;
}
.memo-done-btn:active { background: var(--accent); color: white; }

/* ---- Voice memo mic overlay ---- */
.voice-memo-overlay {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 16px 16px; text-align: center; gap: 16px;
}
.voice-memo-desc {
  font-size: 0.9rem; color: var(--muted); max-width: 280px; line-height: 1.55;
}
.voice-memo-status { font-size: 0.85rem; color: var(--muted); min-height: 1.4em; }
.voice-memo-result {
  width: 100%; padding: 14px; border-radius: var(--radius);
  background: rgba(98,100,167,.08); border: 1px solid var(--accent);
  font-size: 0.92rem; color: var(--accent); text-align: center;
}

/* ---- Product Intro tile list ---- */
.product-intro-item {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 16px 18px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  font-size: 1rem; font-weight: 500; text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s;
}
.product-intro-item:active { background: var(--border); }
.product-intro-item svg { flex-shrink: 0; color: var(--accent); }

/* ---- Duplicate account match card ---- */
.dup-match-info {
  background: rgba(98,100,167,.08);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 8px;
}
.dup-match-info strong  { display:block; font-size:.95rem; color:var(--text); margin-bottom:2px; }
.dup-address            { font-size:.82rem; color:var(--muted); margin-top:3px; }
.dup-score              { font-size:.78rem; color:var(--muted); margin-top:6px; }

/* ---- Quick Actions ---- */
.quick-actions { margin: 8px 0 4px; }
.quick-actions-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); margin: 0 0 8px;
}
.quick-action-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 11px 2px 11px 0;
  background: transparent; border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer; text-align: left;
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
}
.quick-action-item:last-child { border-bottom: none; }
.quick-action-item:active { background: var(--bg); border-radius: 8px; }
.qa-avatar {
  flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 700; color: white;
}
.qa-text {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.qa-name {
  font-size: 0.92rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qa-desc  { font-size: 0.78rem; color: var(--muted); }
.qa-arrow { flex-shrink: 0; color: var(--muted); font-size: 1.4rem; line-height: 1; }

/* ============================================================
   Process Payment overlay
   ============================================================ */
.payment-ways {
  display: flex; flex-direction: column; gap: 0;
}
.payment-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.payment-item:last-child { border-bottom: none; }
.payment-method {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
}
.payment-link {
  display: inline-block;
  color: var(--accent);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
}
.payment-desc {
  margin: 0;
  font-size: .88rem;
  color: var(--text);
}
.payment-bank-info {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 2px;
}
.payment-bank-row {
  display: flex; gap: 8px; align-items: baseline;
  font-size: .88rem;
}
.bank-label  { color: var(--muted); min-width: 160px; flex-shrink: 0; }
.bank-value  { font-weight: 600; color: var(--text); }

/* ============================================================
   ACH Debit Authorization form
   ============================================================ */
.ach-form {
  display: flex; flex-direction: column; gap: 14px;
  padding-bottom: 16px;
}
.ach-form-title {
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
  margin: 0;
  color: var(--text);
  line-height: 1.4;
}
.ach-form-intro {
  font-size: .85rem;
  color: var(--text);
  margin: 0;
  line-height: 1.5;
}
.ach-account-type {
  display: flex; gap: 20px;
}
.ach-checkbox-label {
  display: flex; align-items: center; gap: 6px;
  font-size: .88rem; cursor: pointer;
}
.ach-field-row { display: flex; flex-direction: column; gap: 0; }
.ach-two-col   { flex-direction: row; gap: 10px; }
.ach-two-col .ach-label { flex: 1; min-width: 0; }
.ach-label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: .82rem; font-weight: 600; color: var(--muted);
}
.ach-input {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  color: var(--text);
  background: var(--card);
  width: 100%;
}
.ach-input:focus {
  outline: none;
  border-color: var(--accent);
}
.ach-notice {
  font-size: .8rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.ach-sig-canvas {
  display: block;
  width: 100%;
  height: 80px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  touch-action: none;
  cursor: crosshair;
}
.ach-actions {
  display: flex; gap: 10px; margin-top: 4px;
}
.ach-footnotes {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.ach-footnotes p {
  margin: 0;
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.5;
  font-style: italic;
}

@media print {
  #bottom-bar, #menu-overlay-close, .ach-actions, .ach-sig-clear,
  header, #loading-section, #settings-panel, #main-section { display: none !important; }
  #menu-overlay { position: static !important; overflow: visible !important; }
  .ach-form { padding: 0; }
}

/* ============================================================
   Contact Info Page
   ============================================================ */

.contact-email {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
  display: inline-block;
}

.contact-email:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 3px;
  transform: scale(1.02);
}

.contact-email:active {
  opacity: 0.8;
  transform: scale(0.98);
}
/* ============================================================
   Sort / Filter bar — Top Picks + My Leads
   ============================================================ */
.sort-bar {
  display: flex; gap: 6px; padding: 8px 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  flex-shrink: 0; border-bottom: 1px solid var(--border);
  background: var(--card); scrollbar-width: none;
}
.sort-bar::-webkit-scrollbar { display: none; }
.sort-btn {
  flex-shrink: 0; padding: 5px 13px; border-radius: 16px;
  border: 1.5px solid var(--border); background: transparent;
  color: var(--text); font-size: 0.8rem; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.sort-btn:active { opacity: 0.75; }
.sort-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.sort-spec-badge {
  display: inline-block; background: rgba(255,255,255,0.9); color: var(--accent);
  border-radius: 8px; font-size: 0.68rem; font-weight: 700;
  padding: 0 4px; margin: 0 1px; min-width: 14px;
  text-align: center; line-height: 1.5; vertical-align: middle;
}
.temp-pill {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 7px; border-radius: 10px;
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
  flex-shrink: 0; line-height: 1.4;
}
.temp-pill-hot  { background: #fde8ec; color: #c8102e; }
.temp-pill-warm { background: #fff4e0; color: #e07b00; }
.temp-pill-cold { background: #eef0f9; color: #4d4f8a; }
.lead-spec-tag {
  font-size: 0.73rem; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}
.lead-dist-tag { font-size: 0.73rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.leads-list {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 12px;
}
.temp-section-header {
  padding: 8px 2px 3px; font-size: 0.78rem; font-weight: 700;
  color: var(--muted); letter-spacing: 0.03em; user-select: none;
}
/* Specialty filter bottom drawer */
.sf-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 600; display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none; transition: opacity 0.22s ease;
}
.sf-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.sf-drawer {
  background: var(--card); border-radius: 18px 18px 0 0; width: 100%;
  max-height: 78vh; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sf-drawer-backdrop.open .sf-drawer { transform: translateY(0); }
.sf-drawer-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 10px auto 0; flex-shrink: 0;
}
.sf-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 10px; flex-shrink: 0; border-bottom: 1px solid var(--border);
}
.sf-drawer-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.sf-drawer-reset {
  font-size: 0.82rem; color: var(--accent); background: none;
  border: none; cursor: pointer; padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}
.sf-drawer-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 0 8px; }
.sf-drawer-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  color: var(--text); font-size: 0.9rem; -webkit-tap-highlight-color: transparent;
}
.sf-drawer-item:last-child { border-bottom: none; }
.sf-drawer-item:active     { background: var(--bg); }
.sf-drawer-all-row         { background: var(--bg); font-weight: 600; }
.sf-drawer-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}
.sf-drawer-check.checked { background: var(--accent); border-color: var(--accent); }
.sf-drawer-check.checked::after {
  content: ""; width: 6px; height: 10px;
  border: 2px solid #fff; border-top: none; border-left: none;
  transform: rotate(45deg) translate(-1px,-2px); display: block;
}
.sf-drawer-footer { flex-shrink: 0; padding: 10px 16px 12px; border-top: 1px solid var(--border); }
.sf-drawer-apply {
  width: 100%; padding: 12px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sf-drawer-apply:active { opacity: 0.85; }
