/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f1f1f3;
  --surface-3: #e9e9ec;
  --border: rgba(15, 15, 20, 0.07);
  --border-strong: rgba(15, 15, 20, 0.12);
  --text: #0e0e11;
  --text-2: #55565e;
  --text-3: #8a8b93;
  --accent: #3d5afe;
  --accent-soft: rgba(61, 90, 254, 0.1);
  --primary-bg: #111113;
  --primary-fg: #ffffff;
  --danger: #d93a3f;
  --grid: rgba(15, 15, 20, 0.06);
  --bar: #2a78d6;
  --overlay: rgba(10, 10, 12, 0.32);
  --shadow: 0 1px 2px rgba(10, 10, 15, 0.04), 0 8px 24px rgba(10, 10, 15, 0.06);
  --shadow-lg: 0 20px 60px rgba(10, 10, 15, 0.16);

  --st-new: #2f6fe4;
  --st-no_answer: #8b8d97;
  --st-callback: #d99100;
  --st-meeting: #7a5af0;
  --st-qualified: #1a9a54;
  --st-follow_up: #0b9bb0;
  --st-unqualified: #dc4b4b;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --tab-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0b0b0c;
    --surface: #141416;
    --surface-2: #1b1b1e;
    --surface-3: #242428;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --text: #ededef;
    --text-2: #a3a4ac;
    --text-3: #6f7078;
    --accent: #7088ff;
    --accent-soft: rgba(112, 136, 255, 0.14);
    --primary-bg: #f2f2f3;
    --primary-fg: #0b0b0c;
    --danger: #f06469;
    --grid: rgba(255, 255, 255, 0.06);
    --bar: #3987e5;
    --overlay: rgba(0, 0, 0, 0.55);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
    --st-new: #4f8cf5;
    --st-no_answer: #8d8f99;
    --st-callback: #e6a521;
    --st-meeting: #9580f5;
    --st-qualified: #34b36c;
    --st-follow_up: #22b5c9;
    --st-unqualified: #ec6a6a;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0b0b0c;
  --surface: #141416;
  --surface-2: #1b1b1e;
  --surface-3: #242428;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #ededef;
  --text-2: #a3a4ac;
  --text-3: #6f7078;
  --accent: #7088ff;
  --accent-soft: rgba(112, 136, 255, 0.14);
  --primary-bg: #f2f2f3;
  --primary-fg: #0b0b0c;
  --danger: #f06469;
  --grid: rgba(255, 255, 255, 0.06);
  --bar: #3987e5;
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
  --st-new: #4f8cf5;
  --st-no_answer: #8d8f99;
  --st-callback: #e6a521;
  --st-meeting: #9580f5;
  --st-qualified: #34b36c;
  --st-follow_up: #22b5c9;
  --st-unqualified: #ec6a6a;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
.i { flex: none; display: block; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Shell ---------- */
.shell { min-height: 100dvh; }
.main { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 24px); }
.page { max-width: 720px; margin: 0 auto; padding: 0 16px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  box-shadow: 0 0 0 1px var(--border);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 500; color: var(--text-3); letter-spacing: 0.01em; transition: color 0.15s;
}
.tab.on { color: var(--text); }
.tab .badge { position: absolute; top: 7px; left: calc(50% + 6px); }
.sidebar { display: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .main { padding-bottom: 48px; margin-left: 240px; }
  .page { padding: 0 32px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: fixed; inset: 0 auto 0 0; width: 240px; padding: 22px 14px;
    background: var(--surface); box-shadow: 0 0 0 1px var(--border);
  }
  .sidebar .brand { padding: 0 10px 22px; }
  .side-link {
    position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm);
    color: var(--text-2); font-weight: 500; font-size: 14px; transition: background 0.15s, color 0.15s;
  }
  .side-link:hover { background: var(--surface-2); color: var(--text); }
  .side-link.on { background: var(--surface-2); color: var(--text); }
  .side-link .badge { margin-left: auto; }
  .side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-sm); }
  .side-foot:hover { background: var(--surface-2); }
}

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 20;
  padding-top: calc(var(--safe-t) + 14px); padding-bottom: 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 640; letter-spacing: -0.025em; }
.h1 .count { font-size: 15px; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-left: 8px; }
.h2 { margin: 0; font-size: 13px; font-weight: 550; color: var(--text-2); letter-spacing: 0.005em; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 10px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.back-btn { display: inline-flex; align-items: center; gap: 2px; margin-left: -8px; padding: 6px 8px 6px 2px; color: var(--text-2); font-weight: 500; border-radius: 10px; }
.back-btn:hover { color: var(--text); }

/* ---------- Primitives ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 0 0 1px var(--border); }
.card-pad { padding: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px;
  border-radius: var(--r); font-weight: 550; font-size: 14.5px; letter-spacing: -0.005em;
  background: var(--surface-2); color: var(--text); transition: background 0.15s, opacity 0.15s, transform 0.1s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--primary-bg); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-bg); opacity: 0.88; }
.btn-danger { color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input, .textarea {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r); border: 0;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); outline: none;
  transition: box-shadow 0.15s, background 0.15s; font-size: 16px;
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong), 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.hint { font-size: 12.5px; color: var(--text-3); }
.form-error { font-size: 13px; color: var(--danger); }
.form-error:empty { display: none; }

.badge {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 99px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 650; font-variant-numeric: tabular-nums;
}

/* Status pill: neutral text, colored dot on a faint tint. */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 8px; border-radius: 99px;
  font-size: 12px; font-weight: 550; white-space: nowrap; color: var(--text);
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.pill::before, .dot { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.dot { display: inline-block; }
.s-new { --c: var(--st-new); } .s-no_answer { --c: var(--st-no_answer); } .s-callback { --c: var(--st-callback); }
.s-meeting { --c: var(--st-meeting); } .s-qualified { --c: var(--st-qualified); } .s-follow_up { --c: var(--st-follow_up); }
.s-unqualified { --c: var(--st-unqualified); }

.flag {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); font-size: 20px; line-height: 1; font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
.flag.initials { font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--text-2); }
.flag-sm { font-size: 14px; line-height: 1; }

/* Segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--text-2); transition: background 0.15s, color 0.15s; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border); }
.seg-full { display: flex; }
.seg-full button { flex: 1; }

/* Switch */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); transition: background 0.2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform 0.2s; }
.switch input:checked + span { background: var(--st-qualified); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: 0.45; }
.switch input:disabled { cursor: not-allowed; }

/* ---------- Leads list ---------- */
.search { position: relative; margin-top: 14px; }
.search .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 40px; height: 42px; background: var(--surface); }

.chips { display: flex; gap: 6px; overflow-x: auto; margin: 12px -16px 0; padding: 0 16px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none; height: 32px; padding: 0 12px; border-radius: 99px;
  font-size: 13px; font-weight: 550; color: var(--text-2); background: var(--surface); box-shadow: 0 0 0 1px var(--border);
  transition: background 0.15s, color 0.15s;
}
.chip .n { color: var(--text-3); font-variant-numeric: tabular-nums; font-weight: 500; }
.chip.on { background: var(--primary-bg); color: var(--primary-fg); box-shadow: none; }
.chip.on .n { color: inherit; opacity: 0.6; }

.day-label { margin: 22px 4px 8px; font-size: 12.5px; font-weight: 550; color: var(--text-3); text-transform: capitalize; }
.lead-list, .notif-list, .timeline, .hbars, .reasons, .kv, .lead-main, .hbar, .stack, .field, .notif-main { grid-template-columns: minmax(0, 1fr); }
.lead-list { display: grid; gap: 8px; }
.lead-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: 0 0 0 1px var(--border); transition: background 0.15s, transform 0.1s;
}
.lead-row:hover { background: color-mix(in srgb, var(--surface) 70%, var(--surface-2)); }
.lead-row:active { transform: scale(0.995); }
.lead-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.lead-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lead-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-time { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.lead-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lead-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 56px 24px; }
.empty .ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); color: var(--text-2); margin-bottom: 6px; }
.empty h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.empty p { margin: 0 0 10px; color: var(--text-2); max-width: 340px; font-size: 14px; }

/* ---------- Lead detail ---------- */
.detail-hero { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 10px 0 4px; }
.detail-hero .flag { width: 64px; height: 64px; font-size: 32px; margin-bottom: 6px; }
.detail-hero .flag.initials { font-size: 22px; }
.detail-name { margin: 0; font-size: 24px; font-weight: 640; letter-spacing: -0.025em; line-height: 1.2; }
.detail-meta { font-size: 13.5px; color: var(--text-2); }
.detail-meta .num { color: var(--text); font-weight: 500; }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; }
.action {
  display: grid; justify-items: center; gap: 6px; padding: 12px 6px 10px; border-radius: var(--r-lg);
  background: var(--surface); box-shadow: 0 0 0 1px var(--border); font-size: 12.5px; font-weight: 550; color: var(--text);
  transition: background 0.15s;
}
.action:hover { background: var(--surface-2); }
.action .i { color: var(--text-2); }
.action.disabled { opacity: 0.4; pointer-events: none; }

.status-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; width: 100%; text-align: left; }
.status-card .lbl { font-size: 13px; color: var(--text-2); font-weight: 500; }
.status-card .val { display: flex; align-items: center; gap: 8px; color: var(--text-3); }
.reason { margin-top: 8px; padding: 14px 16px; border-radius: var(--r-lg); background: color-mix(in srgb, var(--st-unqualified) 7%, var(--surface)); box-shadow: 0 0 0 1px var(--border); }
.reason .lbl { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.reason p { margin: 0; white-space: pre-wrap; }

.kv { display: grid; padding: 4px 0; }
.kv-row { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 12px; padding: 11px 16px; align-items: baseline; }
.kv-row dt { font-size: 13px; color: var(--text-2); }
.kv-row dd { margin: 0; font-size: 14px; word-break: break-word; display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.kv-row dd a:hover { color: var(--accent); }
.copy-btn { color: var(--text-3); padding: 2px; border-radius: 6px; flex: none; }
.copy-btn:hover { color: var(--text); }
.qa { display: grid; gap: 4px; padding: 12px 16px; }
.qa dt { font-size: 13px; color: var(--text-2); }
.qa dd { margin: 0; font-size: 14.5px; font-weight: 500; white-space: pre-wrap; word-break: break-word; }

.composer { padding: 12px; display: grid; gap: 10px; }
.composer .textarea { min-height: 72px; background: var(--surface-2); }
.composer-foot { display: flex; justify-content: flex-end; }
.timeline { display: grid; gap: 4px; margin-top: 8px; }
.ev { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 6px 10px 4px; }
.ev-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1px var(--border); color: var(--text-3); }
.ev-ico .dot { width: 8px; height: 8px; }
.ev-title { font-size: 14px; font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ev-title .pill { height: 22px; font-size: 11.5px; }
.ev-date { font-size: 12.5px; color: var(--text-3); margin-top: 1px; font-variant-numeric: tabular-nums; }
.ev-body { margin-top: 8px; padding: 10px 12px; border-radius: var(--r); background: var(--surface); box-shadow: 0 0 0 1px var(--border); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.ev-body.reason-body { background: color-mix(in srgb, var(--st-unqualified) 7%, var(--surface)); }

/* ---------- Sheets & dialogs ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--overlay); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.18s ease-out; }
.sheet {
  width: 100%; max-width: 520px; max-height: 88dvh; overflow: auto; background: var(--surface);
  border-radius: 20px 20px 0 0; padding: 8px 16px calc(16px + var(--safe-b)); box-shadow: var(--shadow-lg);
  animation: up 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-grip { width: 36px; height: 4px; border-radius: 99px; background: var(--surface-3); margin: 2px auto 12px; }
.sheet-title { font-size: 17px; font-weight: 620; letter-spacing: -0.015em; margin: 0 4px 4px; }
.sheet-sub { font-size: 14px; color: var(--text-2); margin: 0 4px 16px; }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 12px; border-radius: var(--r);
  font-weight: 500; text-align: left; transition: background 0.12s;
}
.option:hover { background: var(--surface-2); }
.option .dot { width: 9px; height: 9px; }
.option .check { margin-left: auto; color: var(--text); }
.option.on { background: var(--surface-2); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.quick button { height: 30px; padding: 0 11px; border-radius: 99px; font-size: 13px; color: var(--text-2); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.quick button:hover { color: var(--text); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }

@media (min-width: 640px) {
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 20px; padding: 18px 20px 20px; }
  .sheet-grip { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0.6; } }

/* ---------- Toasts & tooltip ---------- */
#toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); top: calc(var(--safe-t) + 12px); display: grid; gap: 8px; width: min(92vw, 380px); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; pointer-events: auto;
  background: var(--primary-bg); color: var(--primary-fg); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: drop 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.out { opacity: 0; transform: translateY(-6px); transition: 0.2s; }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }
#tooltip {
  position: fixed; z-index: 90; pointer-events: none; opacity: 0; transition: opacity 0.1s;
  padding: 7px 10px; border-radius: 9px; background: var(--primary-bg); color: var(--primary-fg);
  font-size: 12.5px; font-weight: 500; white-space: nowrap; box-shadow: var(--shadow-lg); font-variant-numeric: tabular-nums;
}
#tooltip.on { opacity: 1; }
#tooltip b { font-weight: 650; }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b)); }
.auth-box { width: 100%; max-width: 380px; }
.auth-logo { width: 44px; height: 44px; border-radius: 12px; margin-bottom: 22px; }
.auth h1 { margin: 0; font-size: 26px; font-weight: 640; letter-spacing: -0.025em; }
.auth .sub { margin: 6px 0 26px; color: var(--text-2); }
.auth form { display: grid; gap: 14px; }
.auth .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-foot { display: flex; justify-content: center; margin-top: 28px; }

/* ---------- Analytics ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { padding: 14px 14px 13px; display: grid; gap: 4px; }
.kpi .lbl { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.kpi .val { font-size: 26px; font-weight: 640; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .sub { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--st-qualified); } .delta.down { color: var(--st-unqualified); }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(4, 1fr); } }

.chart-card { padding: 16px 16px 12px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.chart-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.chart-note { font-size: 12.5px; color: var(--text-3); }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .bar { fill: var(--bar); }
.chart .hit { fill: transparent; }
.chart .hit:hover + .bar, .chart g.col:hover .bar { opacity: 0.8; }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.hbars { display: grid; gap: 12px; }
.hbar { display: grid; gap: 6px; }
.hbar-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13.5px; }
.hbar-label { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-val { font-variant-numeric: tabular-nums; font-weight: 550; flex: none; }
.hbar-val .pct { color: var(--text-3); font-weight: 500; margin-left: 6px; }
.track { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.fill { height: 100%; border-radius: 99px; background: var(--c, var(--bar)); transition: width 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }

.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 92px 1fr 64px; align-items: center; gap: 10px; font-size: 13.5px; }
.funnel-row .track { height: 26px; border-radius: 7px; }
.funnel-row .fill { border-radius: 7px; }
.funnel-row .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; }
.funnel-row .v small { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 500; }

.reasons { display: grid; gap: 6px; }
.reason-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); font-size: 14px; }
.reason-item .n { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 550; }
details.data-table { margin-top: 10px; }
details.data-table summary { font-size: 12.5px; color: var(--text-3); cursor: pointer; list-style: none; }
details.data-table summary::-webkit-details-marker { display: none; }
details.data-table table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
details.data-table td { padding: 4px 0; color: var(--text-2); }
details.data-table td:last-child { text-align: right; color: var(--text); }

/* ---------- Notifications ---------- */
.notif {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: var(--r-lg); width: 100%; text-align: left;
  background: transparent; transition: background 0.15s;
}
.notif:hover { background: var(--surface); }
.notif.unread { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.notif-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.notif-title { font-size: 14px; color: var(--text-2); }
.notif-title b { color: var(--text); font-weight: 600; }
.notif-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-list { display: grid; gap: 4px; }

/* ---------- Account ---------- */
.profile-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.avatar { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); font-weight: 620; font-size: 18px; color: var(--text-2); flex: none; letter-spacing: -0.02em; }
.profile-name { font-weight: 620; font-size: 17px; letter-spacing: -0.015em; }
.stack { display: grid; gap: 14px; padding: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; }
.setting-text { min-width: 0; }
.setting-title { font-size: 14.5px; font-weight: 500; }
.setting-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.setting + .setting { padding-top: 4px; }
.conn { display: flex; align-items: center; gap: 12px; padding: 16px; }
.conn-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: #ff4f00; color: #fff; flex: none; }
.conn-title { font-weight: 600; font-size: 15px; }
.conn-state { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.conn-state .dot { --c: var(--text-3); }
.conn-state.ok .dot { --c: var(--st-qualified); }
.url-box { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.url-box code { flex: 1; min-width: 0; font: 12.5px/1.4 ui-monospace, 'SF Mono', Menlo, monospace; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.warn { display: flex; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 10px 12px; border-radius: var(--r); background: color-mix(in srgb, var(--st-callback) 10%, var(--surface)); }
.warn .dot { --c: var(--st-callback); margin-top: 6px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 24px 1fr; gap: 10px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text); }
.steps b { color: var(--text); font-weight: 600; }
.steps code { font: 12px ui-monospace, 'SF Mono', Menlo, monospace; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); color: var(--text); }
details.howto summary { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; cursor: pointer; list-style: none; font-weight: 550; font-size: 14px; }
details.howto summary::-webkit-details-marker { display: none; }
details.howto summary .i { color: var(--text-3); transition: transform 0.2s; }
details.howto[open] summary .i { transform: rotate(180deg); }
details.howto .steps { padding: 0 16px 16px; }
.foot-note { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 24px; }

.skeleton { height: 66px; border-radius: var(--r-lg); background: var(--surface); box-shadow: 0 0 0 1px var(--border); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (min-width: 900px) {
  .chips { flex-wrap: wrap; overflow: visible; margin: 12px 0 0; padding: 0; }
}

/* ---------- Onboarding (install & push) ---------- */
.onboard { display: grid; justify-items: center; text-align: center; padding-top: 6px; }
.onboard .sheet-title { font-size: 19px; margin: 0 0 6px; }
.onboard .sheet-sub { max-width: 340px; margin: 0 0 18px; }
.onboard-icon { width: 64px; height: 64px; border-radius: 15px; margin-bottom: 14px; box-shadow: 0 0 0 1px var(--border); }
.onboard-bell { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; margin-bottom: 14px; background: var(--surface-2); color: var(--text); }
.onboard .steps { text-align: left; width: 100%; padding: 14px; border-radius: var(--r-lg); background: var(--surface-2); }
.steps.big li { font-size: 14.5px; color: var(--text); }
.steps.big li::before { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.inline-ico { display: inline-grid; place-items: center; vertical-align: -3px; width: 22px; height: 22px; border-radius: 6px; background: var(--surface); color: var(--accent); box-shadow: 0 0 0 1px var(--border); }
.onboard .dialog-actions { width: 100%; }
.dialog-actions.single { grid-template-columns: 1fr; }
.onboard .form-error { margin: -6px 0 6px; }
.push-banner { display: flex; align-items: center; gap: 12px; width: 100%; margin: 6px 0 4px; padding: 14px 16px; text-align: left; font-size: 14px; line-height: 1.35; }
.push-banner > .i:first-child { color: var(--accent); }
.push-banner > span { flex: 1; }
.push-banner > .i:last-child { color: var(--text-3); }
.unread-dot.inline { display: inline-block; margin-right: 7px; vertical-align: 2px; }
#push-card .conn-state b { color: var(--text); font-weight: 550; }

/* ---------- Brand & nav icons ---------- */
.brand .logo { height: 20px; width: auto; display: block; }
.brand .logo-sub { font-size: 15px; font-weight: 550; color: var(--text-2); letter-spacing: -0.01em; }
.brand-mobile { margin-bottom: 10px; }
.brand-mobile .logo { height: 18px; }
@media (min-width: 900px) { .brand-mobile { display: none; } }
:root[data-theme='dark'] .brand .logo { filter: brightness(1.55) saturate(1.1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .brand .logo { filter: brightness(1.55) saturate(1.1); } }
.nav-ico { display: grid; place-items: center; }
.nav-ico.on, [data-nav].on .nav-ico.off { display: none; }
[data-nav].on .nav-ico.on { display: grid; }

/* ---------- Lead tabs ---------- */
.detail-tabs { margin-top: 12px; }
.detail-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; font-size: 14px; }
.detail-tabs button .i { color: var(--text-3); }
.detail-tabs button.on .i { color: var(--text); }
.tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--surface-3); font-size: 11px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tab-panel { margin-top: 12px; }
.brand img.logo { border-radius: 0; }

[hidden] { display: none !important; }

/* ---------- Accounts ---------- */
.auth-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.auth-brand .logo { height: 26px; width: auto; display: block; }
.auth-brand .logo-sub { font-size: 18px; font-weight: 550; color: var(--text-2); letter-spacing: -0.01em; }
:root[data-theme='dark'] .auth-brand .logo { filter: brightness(1.55) saturate(1.1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .auth-brand .logo { filter: brightness(1.55) saturate(1.1); } }
.auth-switch { margin: 20px 0 0; text-align: center; font-size: 14px; color: var(--text-2); }
.link-btn { color: var(--text); font-weight: 600; margin-left: 4px; }
.link-btn:hover { color: var(--accent); }
.account-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.account-email { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn { margin-top: 8px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
