:root {
  --bg: #f3f4f6;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #fff;
  --surface-soft: #f7f8fa;
  --text: #14161a;
  --muted: #6f7480;
  --hairline: rgba(15, 19, 25, 0.09);
  --blue: #2f6df6;
  --blue-deep: #1f55cf;
  --blue-soft: #eaf0ff;
  --green: #1e9d69;
  --green-soft: #e8f7f0;
  --orange: #d57716;
  --orange-soft: #fff2df;
  --red: #d64b4b;
  --red-soft: #fff0ef;
  --purple: #7159c8;
  --purple-soft: #f0ecff;
  --shadow: 0 18px 60px rgba(26, 33, 48, 0.08), 0 2px 8px rgba(26, 33, 48, 0.04);
  --drawer-shadow: -24px 0 70px rgba(13, 18, 28, 0.18);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --safe-top: max(18px, env(safe-area-inset-top));
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100%; background: var(--bg); overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ambient { position: fixed; border-radius: 999px; filter: blur(2px); pointer-events: none; opacity: .45; }
.ambient-one { width: 420px; height: 420px; top: -250px; left: -160px; background: radial-gradient(circle, #dfe8ff, transparent 68%); }
.ambient-two { width: 520px; height: 520px; top: 15%; right: -360px; background: radial-gradient(circle, #eee6ff, transparent 68%); }
.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: var(--safe-top) 0 64px; position: relative; z-index: 1; }

.topbar { min-height: 62px; display: flex; align-items: center; justify-content: space-between; }
.brand-block { display: flex; align-items: center; gap: 13px; }
.brand-block h1 { margin: 1px 0 0; font-size: 22px; line-height: 1; letter-spacing: -.03em; }
.eyebrow { font-size: 10px; letter-spacing: .14em; font-weight: 700; color: var(--muted); }
.brand-mark { width: 36px; height: 36px; padding: 7px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; border-radius: 11px; background: #101318; box-shadow: 0 8px 20px rgba(16,19,24,.16); }
.brand-mark span { background: #fff; border-radius: 2px; }
.brand-mark span:nth-child(2) { opacity: .78; }
.brand-mark span:nth-child(3) { opacity: .54; }
.brand-mark span:nth-child(4) { background: #75a0ff; }
.profile { display: flex; align-items: center; gap: 13px; }
.sync-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.sync-state i { width: 7px; height: 7px; background: #29af73; border-radius: 50%; box-shadow: 0 0 0 4px rgba(41,175,115,.1); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(145deg, #1f252f, #485466); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em; }

.hero-row { padding: 55px 2px 30px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.hero-kicker { margin: 0 0 7px; color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.hero-row h2 { margin: 0; font-size: clamp(34px, 5vw, 56px); line-height: 1.02; letter-spacing: -.055em; font-weight: 720; }
.hero-copy { margin: 14px 0 0; color: var(--muted); font-size: 16px; max-width: 570px; line-height: 1.48; }
.primary-button { border: 0; border-radius: 14px; background: var(--text); color: #fff; padding: 13px 18px; font-weight: 650; cursor: pointer; box-shadow: 0 9px 22px rgba(20,22,26,.16); transition: transform .2s, box-shadow .2s; }
.primary-button:active { transform: scale(.98); }
.plus-icon { font-size: 20px; font-weight: 400; margin-right: 5px; vertical-align: -1px; }

.funnel-dashboard { margin-bottom: 18px; padding: 18px; border-radius: var(--radius-xl); background: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.72); box-shadow: 0 10px 38px rgba(35,42,57,.045); backdrop-filter: blur(22px); }
.dashboard-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 15px; }
.dashboard-head h3 { margin: 4px 0 0; font-size: 20px; letter-spacing: -.025em; }
.dashboard-eyebrow { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.funnel-tabs { display: flex; gap: 3px; padding: 4px; border-radius: 13px; background: rgba(120,127,140,.09); }
.funnel-tabs button { border: 0; border-radius: 10px; padding: 9px 13px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.funnel-tabs button.active { background: var(--surface-solid); color: var(--text); box-shadow: 0 3px 10px rgba(25,30,40,.08); }
.stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 13px; }
.stat-card { min-height: 124px; padding: 18px 19px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid rgba(255,255,255,.75); box-shadow: 0 8px 30px rgba(35,42,57,.04); backdrop-filter: blur(18px); cursor: pointer; transition: transform .2s, border-color .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card.active { border-color: rgba(47,109,246,.28); box-shadow: 0 12px 35px rgba(47,109,246,.1); }
.stat-label { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.stat-value { display: block; margin-top: 12px; font-size: 32px; line-height: 1; letter-spacing: -.045em; font-weight: 700; }
.stat-note { display: block; margin-top: 9px; color: var(--muted); font-size: 11px; }
.stat-card[data-filter="overdue"] .stat-dot { background: var(--red); }
.stat-card[data-filter="no_next_action"] .stat-dot { background: var(--orange); }
.stat-card[data-filter="unassigned"] .stat-dot { background: var(--purple); }
.stat-card[data-filter="unsuitable"] .stat-dot,
.stat-card[data-filter="deferred"] .stat-dot { background: var(--orange); }
.stat-card[data-filter="suitable"] .stat-dot,
.stat-card[data-filter="transferred"] .stat-dot { background: var(--green); }
.pipeline-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(145px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 1px; scrollbar-width: none; }
.pipeline-strip::-webkit-scrollbar { display: none; }
.pipeline-stage { position: relative; min-height: 72px; padding: 12px; border-radius: 15px; background: var(--surface); border: 1px solid var(--hairline); cursor: pointer; }
.pipeline-stage::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 8px; height: 3px; border-radius: 99px; background: var(--hairline); }
.pipeline-stage i { position: absolute; left: 12px; bottom: 8px; height: 3px; max-width: calc(100% - 24px); border-radius: 99px; background: var(--blue); }
.pipeline-stage small { display: block; color: var(--muted); font-size: 9px; font-weight: 650; }
.pipeline-stage strong { display: block; margin-top: 6px; font-size: 18px; }
.skeleton-card span, .lead-skeleton, .detail-skeleton { display: block; background: linear-gradient(90deg, #edf0f4 25%, #f8f9fa 42%, #edf0f4 65%); background-size: 400% 100%; animation: shimmer 1.35s ease infinite; }
.skeleton-card span { width: 72%; height: 52px; border-radius: 12px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.catalog-panel { background: var(--surface); border: 1px solid rgba(255,255,255,.78); border-radius: var(--radius-xl); padding: 19px; box-shadow: var(--shadow); backdrop-filter: blur(24px); }
.entity-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-bottom: 13px; padding: 5px; border-radius: 16px; background: var(--surface-soft); }
.entity-tabs button { min-height: 43px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 680; cursor: pointer; }
.entity-tabs button.active { background: var(--surface-solid); color: var(--text); box-shadow: 0 4px 13px rgba(24,29,39,.07); }
.entity-tabs b { min-width: 23px; padding: 4px 6px; border-radius: 999px; background: rgba(128,136,151,.11); color: inherit; font-size: 9px; }
.entity-tabs button.active b { background: var(--blue-soft); color: var(--blue-deep); }
.catalog-toolbar { display: flex; gap: 10px; }
.search-box { min-height: 47px; flex: 1; display: flex; align-items: center; gap: 10px; background: var(--surface-soft); border: 1px solid transparent; border-radius: 15px; padding: 0 13px; transition: background .2s, border-color .2s, box-shadow .2s; }
.search-box:focus-within { background: var(--surface-solid); border-color: rgba(47,109,246,.35); box-shadow: 0 0 0 4px rgba(47,109,246,.08); }
.search-box svg { width: 19px; color: #858b96; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 14px; }
.search-box input::placeholder { color: #979ca5; }
.search-box kbd { padding: 3px 6px; border-radius: 6px; background: #fff; color: #9a9ea7; border: 1px solid var(--hairline); font: 10px/1.2 inherit; box-shadow: 0 1px 2px rgba(20,22,26,.05); }
.icon-button { width: 44px; height: 44px; border: 0; background: var(--surface-soft); border-radius: 14px; display: grid; place-items: center; cursor: pointer; }
.icon-button svg { width: 20px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 13px 0 17px; border-bottom: 1px solid var(--hairline); }
.filter-select { position: relative; }
.filter-select > span { position: absolute; left: 12px; top: 6px; color: var(--muted); font-size: 9px; font-weight: 650; pointer-events: none; }
.filter-select select { min-width: 150px; height: 45px; padding: 15px 31px 3px 11px; border: 1px solid var(--hairline); border-radius: 13px; background: var(--surface-solid); outline: none; font-size: 12px; font-weight: 600; cursor: pointer; }
.clear-filters { border: 0; padding: 0 11px; background: transparent; color: var(--blue); font-size: 12px; font-weight: 650; cursor: pointer; }
.catalog-heading { padding: 20px 3px 10px; display: flex; justify-content: space-between; align-items: center; }
.catalog-heading h3 { margin: 0; font-size: 19px; letter-spacing: -.025em; }
.catalog-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.view-control { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-soft); }
.view-control button { width: 32px; height: 29px; border: 0; border-radius: 8px; background: transparent; color: #969ba5; display: grid; place-items: center; cursor: pointer; }
.view-control button.active { background: #fff; color: var(--text); box-shadow: 0 2px 7px rgba(25,30,40,.08); }
.view-control svg { width: 16px; }

.lead-list { display: grid; gap: 7px; }
.lead-row { width: 100%; display: grid; grid-template-columns: minmax(210px, 1.7fr) minmax(125px, .8fr) minmax(160px, 1fr) minmax(180px, 1fr) 28px; align-items: center; gap: 14px; padding: 14px 13px; border: 1px solid transparent; border-radius: 16px; background: transparent; text-align: left; cursor: pointer; transition: background .18s, border-color .18s, transform .18s; }
.lead-row:hover { background: var(--surface-soft); border-color: rgba(20,22,26,.04); }
.lead-row:active { transform: scale(.995); }
.lead-primary, .lead-contact, .lead-next { min-width: 0; }
.lead-title-line { display: flex; align-items: center; gap: 8px; }
.entity-avatar { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: linear-gradient(145deg, #dce7ff, #edf2ff); color: var(--blue-deep); font-size: 8px; font-weight: 780; }
.company-avatar { background: linear-gradient(145deg, #e7e2ff, #f3f0ff); color: var(--purple); }
.lead-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 670; font-size: 14px; letter-spacing: -.01em; }
.lead-id { color: #a1a6af; font-size: 10px; font-weight: 650; }
.lead-company, .contact-role, .next-date { margin-top: 5px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-pill, .tag { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 5px 9px; font-size: 10px; line-height: 1; font-weight: 700; white-space: nowrap; }
.stage-new { background: var(--blue-soft); color: var(--blue-deep); }
.stage-qualification, .stage-in_work { background: var(--purple-soft); color: var(--purple); }
.stage-contacted, .stage-proposal, .stage-negotiation { background: var(--orange-soft); color: var(--orange); }
.stage-won { background: var(--green-soft); color: var(--green); }
.stage-nurture { background: #f0f1f3; color: #6f7480; }
.stage-lost { background: var(--red-soft); color: var(--red); }
.lead-contact strong, .lead-next strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 630; }
.next-overdue strong, .next-overdue .next-date { color: var(--red); }
.row-chevron { color: #a6abb4; font-size: 24px; font-weight: 300; }
.lead-list.grid-view { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-view .lead-row { height: 210px; display: flex; flex-direction: column; align-items: stretch; gap: 14px; padding: 18px; background: var(--surface-soft); }
.grid-view .lead-stage { order: -1; }
.grid-view .lead-contact, .grid-view .lead-next { margin-top: auto; }
.grid-view .row-chevron { display: none; }
.lead-skeleton { height: 74px; border-radius: 16px; }
.empty-state { padding: 58px 20px; text-align: center; color: var(--muted); }
.empty-state-icon { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; background: var(--surface-soft); display: grid; place-items: center; font-size: 24px; }
.empty-state h4 { margin: 0 0 6px; color: var(--text); }
.empty-state p { margin: 0; font-size: 13px; }
.load-more { width: 100%; margin-top: 12px; border: 0; border-radius: 14px; padding: 12px; color: var(--blue); background: var(--blue-soft); font-weight: 650; cursor: pointer; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(12,16,24,.28); backdrop-filter: blur(5px); opacity: 0; transition: opacity .3s; }
.drawer-backdrop.visible { opacity: 1; }
.lead-drawer { position: fixed; z-index: 21; right: 0; top: 0; bottom: 0; width: min(620px, 100%); background: var(--surface-solid); box-shadow: var(--drawer-shadow); transform: translateX(103%); transition: transform .34s cubic-bezier(.22,.72,.2,1); overflow: hidden; }
.lead-drawer.open { transform: translateX(0); }
.drawer-handle { display: none; }
.drawer-toolbar { height: 68px; padding: max(10px, env(safe-area-inset-top)) 18px 8px; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; border-bottom: 1px solid var(--hairline); }
.drawer-toolbar > span { text-align: center; color: var(--muted); font-size: 12px; font-weight: 650; }
.drawer-content { height: calc(100% - 68px); overflow-y: auto; overscroll-behavior: contain; padding: 26px 28px max(42px, env(safe-area-inset-bottom)); }
.detail-skeleton { height: 75vh; border-radius: 22px; }
.detail-hero { padding-bottom: 23px; border-bottom: 1px solid var(--hairline); }
.detail-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.tag { background: var(--surface-soft); color: var(--muted); }
.detail-hero h2 { margin: 0; font-size: clamp(26px, 5vw, 38px); line-height: 1.08; letter-spacing: -.045em; }
.detail-company { margin: 9px 0 0; color: var(--muted); font-size: 14px; }
.owner-line { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.owner { display: flex; align-items: center; gap: 10px; min-width: 0; }
.owner-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #e9edf4; color: #657085; font-size: 11px; font-weight: 750; }
.owner small { display: block; color: var(--muted); font-size: 10px; }
.owner strong { display: block; margin-top: 2px; font-size: 12px; }
.secondary-button { border: 1px solid var(--hairline); border-radius: 11px; background: var(--surface-solid); padding: 9px 12px; color: var(--blue); font-size: 11px; font-weight: 680; cursor: pointer; }
.route-card { padding: 16px; border-radius: 18px; background: linear-gradient(145deg, #f6f8ff, #f1f4fb); border: 1px solid #e5e9f4; }
.route-owner { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.route-owner strong { font-size: 13px; }
.route-owner span { color: var(--muted); font-size: 10px; }
.route-progress { display: flex; align-items: center; gap: 5px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.route-progress::-webkit-scrollbar { display: none; }
.route-step { flex: 0 0 auto; border: 0; border-radius: 999px; padding: 7px 9px; background: rgba(255,255,255,.78); color: var(--muted); font-size: 9px; font-weight: 700; cursor: pointer; }
.route-step.current { background: var(--text); color: #fff; }
.route-actions { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 4px; }
.route-action { border: 0; border-radius: 11px; padding: 10px 12px; background: var(--blue); color: #fff; font-size: 10px; font-weight: 720; cursor: pointer; }
.route-action.secondary { background: var(--surface-solid); color: var(--blue); border: 1px solid var(--hairline); }
.route-action.defer { margin-left: auto; background: transparent; color: var(--muted); border: 1px solid var(--hairline); }
.detail-section { padding: 23px 0; border-bottom: 1px solid var(--hairline); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.section-title h3 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.section-title span { color: var(--muted); font-size: 11px; }
.next-card { border-radius: 17px; padding: 16px; background: linear-gradient(145deg, #f5f7ff, #eef2ff); border: 1px solid #e0e7ff; }
.next-card.overdue { background: linear-gradient(145deg, #fff7f5, #fff0ee); border-color: #ffe0dc; }
.next-card strong { display: block; font-size: 14px; }
.next-card p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.inline-form { display: grid; gap: 9px; margin-top: 13px; }
.inline-form input, .note-form textarea { width: 100%; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface-solid); padding: 11px 12px; outline: none; font-size: 12px; }
.inline-form input:focus, .note-form textarea:focus { border-color: rgba(47,109,246,.4); box-shadow: 0 0 0 3px rgba(47,109,246,.07); }
.form-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.form-submit { border: 0; border-radius: 11px; background: var(--blue); color: #fff; padding: 0 14px; font-size: 11px; font-weight: 700; cursor: pointer; }
.contact-grid { display: grid; gap: 9px; }
.contact-card { padding: 14px; border-radius: 15px; background: var(--surface-soft); }
.clickable-card { cursor: pointer; transition: transform .18s, box-shadow .18s; }
.clickable-card:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(30,38,54,.06); }
.company-link-card { width: 100%; border: 0; color: inherit; text-align: left; cursor: pointer; }
.contact-head { display: flex; align-items: center; gap: 10px; }
.contact-initials { width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(145deg, #dce7ff, #edf2ff); color: var(--blue-deep); display: grid; place-items: center; font-size: 11px; font-weight: 750; }
.contact-head strong { display: block; font-size: 13px; }
.contact-head span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.contact-links a { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 7px 9px; border-radius: 9px; background: #fff; border: 1px solid var(--hairline); color: var(--text); text-decoration: none; font-size: 10px; }
.company-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.info-item { min-height: 58px; padding: 11px; border-radius: 12px; background: var(--surface-soft); }
.info-item small { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; }
.info-item strong, .info-item a { display: block; margin-top: 5px; color: var(--text); font-size: 11px; text-decoration: none; overflow-wrap: anywhere; }
.description { color: #3f444d; font-size: 13px; line-height: 1.62; }
.description p { margin: 0 0 11px; }
.source-details { margin-top: 14px; border: 1px solid var(--hairline); border-radius: 13px; background: var(--surface-soft); overflow: hidden; }
.source-details summary { padding: 13px; cursor: pointer; font-size: 11px; font-weight: 680; }
.source-details .description { max-height: 320px; overflow: auto; padding: 0 13px 13px; }
.facts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.fact { padding: 7px 9px; border-radius: 9px; background: var(--blue-soft); color: var(--blue-deep); font-size: 10px; }
.note-form { margin-bottom: 18px; }
.note-form textarea { min-height: 80px; resize: vertical; }
.note-form button { margin-top: 8px; }
.timeline { position: relative; display: grid; gap: 0; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 14px; width: 1px; background: var(--hairline); }
.timeline-item { position: relative; padding: 0 0 19px 24px; }
.timeline-dot { position: absolute; left: 0; top: 5px; width: 11px; height: 11px; border: 3px solid #fff; background: #aab1bd; border-radius: 50%; box-shadow: 0 0 0 1px var(--hairline); }
.timeline-item:first-child .timeline-dot { background: var(--blue); }
.timeline-item strong { display: block; font-size: 11px; line-height: 1.45; }
.timeline-meta { margin-top: 4px; color: var(--muted); font-size: 9px; }
.timeline-lead { margin: 6px 0 0; padding: 0; border: 0; background: transparent; color: var(--blue); font-size: 10px; font-weight: 650; cursor: pointer; text-align: left; }
.entity-detail-hero { position: relative; }
.entity-detail-avatar { width: 54px; height: 54px; margin-bottom: 16px; display: grid; place-items: center; border-radius: 17px; background: linear-gradient(145deg, #dce7ff, #edf2ff); color: var(--blue-deep); font-size: 15px; font-weight: 780; }
.entity-detail-avatar.company-avatar { background: linear-gradient(145deg, #e7e2ff, #f3f0ff); color: var(--purple); }
.related-leads { display: grid; gap: 8px; }
.related-lead { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 13px; border: 1px solid var(--hairline); border-radius: 14px; background: var(--surface-soft); color: inherit; text-align: left; cursor: pointer; }
.related-lead strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.related-lead span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.related-lead-state { display: grid; justify-items: end; gap: 6px; }
.related-lead-state .stage-pill { margin: 0; color: inherit; }
.related-lead-state small { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 9px; }
.empty-state.compact { padding: 24px 12px; border-radius: 14px; background: var(--surface-soft); }

.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); padding: 11px 15px; border-radius: 12px; background: rgba(20,22,26,.94); color: #fff; font-size: 12px; font-weight: 600; box-shadow: 0 10px 35px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.fatal-state { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.fatal-card { width: min(360px, 100%); padding: 30px; border-radius: 24px; background: var(--surface-solid); text-align: center; box-shadow: var(--shadow); }
.fatal-symbol { width: 48px; height: 48px; margin: 0 auto 15px; border-radius: 50%; display: grid; place-items: center; color: var(--red); background: var(--red-soft); font-weight: 800; }
.fatal-card h2 { margin: 0; font-size: 20px; }
.fatal-card p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.fatal-card button { border: 0; border-radius: 11px; padding: 10px 15px; background: var(--text); color: #fff; font-weight: 650; }
.mobile-nav { display: none; }

@media (max-width: 860px) {
  .app-shell { width: min(100% - 24px, 720px); padding-bottom: 100px; }
  .hero-row { padding-top: 38px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .lead-row { grid-template-columns: minmax(190px, 1.6fr) 120px minmax(140px, 1fr) 24px; }
  .lead-contact { display: none; }
  .lead-list.grid-view { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .app-shell { width: 100%; padding: var(--safe-top) 12px 108px; }
  .topbar { min-height: 46px; padding: 0 2px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-block h1 { font-size: 19px; }
  .eyebrow { font-size: 8px; }
  .sync-state { display: none; }
  .avatar { width: 34px; height: 34px; }
  .hero-row { padding: 31px 3px 22px; align-items: start; }
  .hero-row h2 { max-width: 300px; font-size: 36px; }
  .hero-copy { font-size: 13px; max-width: 340px; }
  .hero-action { display: none; }
  .funnel-dashboard { margin: 0 -1px 11px; padding: 12px; border-radius: 22px; }
  .dashboard-head { align-items: flex-start; flex-direction: column; gap: 11px; }
  .funnel-tabs { width: 100%; overflow-x: auto; }
  .funnel-tabs button { flex: 1; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
  .stat-card { min-height: 103px; padding: 14px; border-radius: 17px; }
  .stat-value { margin-top: 10px; font-size: 27px; }
  .stat-note { font-size: 9px; }
  .catalog-panel { margin: 0 -1px; padding: 11px; border-radius: 22px; }
  .entity-tabs { position: sticky; top: 0; z-index: 5; margin-bottom: 9px; }
  .entity-tabs button { min-height: 40px; font-size: 10px; }
  .catalog-toolbar { position: sticky; top: 0; z-index: 4; padding-top: 1px; }
  .search-box { min-height: 44px; }
  .search-box kbd, #refresh-button { display: none; }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -11px; padding: 11px 11px 14px; }
  .filters::-webkit-scrollbar { display: none; }
  .filter-select { flex: 0 0 auto; }
  .filter-select select { min-width: 140px; height: 42px; }
  .clear-filters { flex: 0 0 auto; }
  .catalog-heading { padding: 15px 4px 8px; }
  .view-control { display: none; }
  .lead-list, .lead-list.grid-view { display: grid; grid-template-columns: 1fr; gap: 5px; }
  .lead-row, .grid-view .lead-row { height: auto; display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px 12px; border-radius: 15px; background: transparent; }
  .lead-primary { grid-column: 1; }
  .lead-stage { grid-column: 2; grid-row: 1; justify-self: end; }
  .lead-next { grid-column: 1 / 3; display: flex; align-items: baseline; gap: 7px; padding-top: 8px; border-top: 1px solid var(--hairline); }
  .lead-next .next-date { margin-top: 0; }
  .lead-contact, .row-chevron { display: none; }
  .mobile-nav { position: fixed; z-index: 12; left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); height: 65px; display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px; border: 1px solid rgba(255,255,255,.7); border-radius: 21px; background: rgba(248,249,251,.9); box-shadow: 0 14px 38px rgba(22,27,37,.16); backdrop-filter: blur(20px); }
  .mobile-nav button { border: 0; background: transparent; color: #848a95; border-radius: 15px; display: grid; justify-items: center; align-content: center; gap: 3px; font-size: 9px; font-weight: 650; }
  .mobile-nav button.active { color: var(--blue); background: #fff; box-shadow: 0 3px 12px rgba(31,48,79,.07); }
  .mobile-nav svg { width: 20px; height: 20px; }
  .lead-drawer { top: 7%; width: 100%; border-radius: 25px 25px 0 0; transform: translateY(103%); box-shadow: 0 -20px 60px rgba(13,18,28,.2); }
  .lead-drawer.open { transform: translateY(0); }
  .drawer-handle { display: block; position: absolute; z-index: 2; top: 7px; left: 50%; width: 34px; height: 4px; border-radius: 99px; background: #d7d9de; transform: translateX(-50%); }
  .drawer-toolbar { height: 61px; padding: 15px 12px 5px; }
  .drawer-content { height: calc(100% - 61px); padding: 19px 17px max(38px, env(safe-area-inset-bottom)); }
  .detail-section { padding: 20px 0; }
  .company-grid { grid-template-columns: 1fr 1fr; }
  .related-lead { grid-template-columns: 1fr; }
  .related-lead-state { justify-items: start; }
  .related-lead-state small { max-width: 100%; }
  .toast { bottom: calc(87px + env(safe-area-inset-bottom)); }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317;
    --surface: rgba(27, 30, 36, .9);
    --surface-solid: #1b1e24;
    --surface-soft: #23272e;
    --text: #f5f6f8;
    --muted: #999faa;
    --hairline: rgba(255,255,255,.09);
    --blue-soft: #202d4d;
    --purple-soft: #30294a;
    --orange-soft: #3b2c1e;
    --green-soft: #18392d;
    --red-soft: #3d2426;
    --shadow: 0 18px 60px rgba(0,0,0,.25);
  }
  :root:not([data-theme="light"]) .search-box kbd,
  :root:not([data-theme="light"]) .view-control button.active,
  :root:not([data-theme="light"]) .contact-links a,
  :root:not([data-theme="light"]) .entity-tabs button.active { background: #2b3038; }
  :root:not([data-theme="light"]) .next-card { background: #20283b; border-color: #2d3954; }
  :root:not([data-theme="light"]) .next-card.overdue { background: #382527; border-color: #533034; }
  :root:not([data-theme="light"]) .funnel-dashboard { background: rgba(27,30,36,.8); border-color: rgba(255,255,255,.08); }
  :root:not([data-theme="light"]) .route-card { background: #20242c; border-color: #303641; }
  :root:not([data-theme="light"]) .description { color: #c8ccd3; }
  :root:not([data-theme="light"]) .timeline-dot { border-color: var(--surface-solid); }
  :root:not([data-theme="light"]) .mobile-nav { background: rgba(27,30,36,.92); border-color: rgba(255,255,255,.08); }
  :root:not([data-theme="light"]) .mobile-nav button.active { background: #282d35; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
