/* ============================================ */
/* Pipeline (Lead Inbox) styles — v10            */
/* ============================================ */

/* === TOP NAV === */
.topnav {
  background: #FFFFFF;
  border-bottom: 1px solid var(--slate-200);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  overflow-x: auto;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav::-webkit-scrollbar { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--brand);
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.brand-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -.5px;
  white-space: nowrap;
}

/* KPI strip */
.kpi-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.kpi-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--r);
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  cursor: pointer;
  transition: all .15s;
  min-width: 96px;
  height: 40px;
}
.kpi-tile:hover {
  background: #fff;
  border-color: var(--slate-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.kpi-tile.booked { background: var(--success-light); border-color: var(--success-border); }
.kpi-tile.booked .kpi-tile-value { color: var(--success); }
.kpi-tile.booked .kpi-tile-label { color: var(--success); }
.kpi-tile.hot { background: var(--danger-light); border-color: var(--danger-border); }
.kpi-tile.hot .kpi-tile-value { color: var(--danger); }
.kpi-tile.hot .kpi-tile-label { color: var(--danger); }
.kpi-tile-icon { font-size: 16px; flex-shrink: 0; }
.kpi-tile-info { display: flex; flex-direction: column; line-height: 1.1; gap: 1px; }
.kpi-tile-value { font-size: 15px; font-weight: 800; color: var(--slate-900); letter-spacing: -.3px; }
.kpi-tile-label { font-size: 11px; font-weight: 700; color: var(--slate-500); text-transform: none; letter-spacing: .5px; }

/* Nav menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: var(--r);
  color: var(--slate-600);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-link:hover { background: var(--slate-100); color: var(--slate-900); text-decoration: none; }
.nav-link.active { background: var(--brand-light); color: var(--brand-hover); }
.nav-link-badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 2px;
}
.nav-divider {
  width: 1px;
  height: 22px;
  background: var(--slate-200);
  flex-shrink: 0;
  margin: 0 4px;
}

/* Top nav right side */
.topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.search-wrap { position: relative; }
.search-wrap::before {
  content: '🔍';
  position: absolute;
  left: 11px; top: 50%; transform: translateY(-50%);
  font-size: 13px;
}
.search-input {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--r);
  padding: 8px 12px 8px 32px;
  width: 200px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all .15s;
}
.search-input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .15); }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B 0%, #EA580C 100%);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

/* === PAGE HEADER === */
.page-header {
  background: #fff;
  padding: 18px 24px;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-actions { display: flex; gap: 8px; }
.filter-pill {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.filter-pill:hover { background: var(--slate-50); color: var(--slate-900); border-color: var(--slate-300); }

/* === PIPELINE === */
.pipeline-wrap { padding: 24px; background: var(--page-bg); min-height: calc(100vh - 130px); }

.filter-banner {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--brand-light);
  border: 1px solid var(--brand-border);
  border-radius: var(--r-md);
  margin-bottom: 16px;
  color: var(--brand-hover);
  font-size: 14px;
  font-weight: 600;
}
.filter-banner.active { display: flex; }
.filter-banner-close {
  margin-left: auto;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: rgba(var(--brand-rgb), .1);
  font-size: 12px;
}
.filter-banner-close:hover { background: rgba(var(--brand-rgb), .2); }

.pipeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  overflow-x: auto;
}
.pipeline.filtered .col { opacity: .4; }
.pipeline.filtered .col.col-active {
  opacity: 1;
  background: #fff;
  border-color: var(--slate-300);
  box-shadow: var(--shadow-md);
}

.col {
  background: var(--slate-100);
  border-radius: var(--r-lg);
  padding: 14px;
  min-height: 400px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
}
.col:hover { background: #ECEEF3; border-color: var(--slate-200); }

.col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 4px;
  margin-bottom: 6px;
}
.col-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -.2px;
}
.col-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.col-count {
  background: #fff;
  color: var(--slate-600);
  padding: 3px 10px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--slate-200);
}
.col-sum {
  color: var(--slate-600);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  padding: 0 4px;
}

/* Column colors */
.col-dot.new { background: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.col-dot.estimate { background: var(--warning); box-shadow: 0 0 0 3px rgba(217, 119, 6, .15); }
.col-dot.sent { background: var(--info); box-shadow: 0 0 0 3px rgba(2, 132, 199, .15); }
.col-dot.followup { background: var(--ai); box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }
.col-dot.approved { background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .15); }

/* === LEAD CARD === */
.lead-card {
  background: #fff;
  border-radius: var(--r);
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--slate-200);
  border-left: 3px solid var(--slate-200);
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--card-shadow);
}
.lead-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-1px);
}
.col-new .lead-card { border-left-color: var(--danger); }
.col-estimate .lead-card { border-left-color: var(--warning); }
.col-sent .lead-card { border-left-color: var(--info); }
.col-followup .lead-card { border-left-color: var(--ai); }
.col-approved .lead-card { border-left-color: #10B981; }

.lead-name {
  font-weight: 800;
  font-size: 14px;
  color: var(--slate-900);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -.2px;
}
.lead-service {
  color: var(--slate-600);
  font-size: 12.5px;
  margin-bottom: 8px;
  line-height: 1.4;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead-date-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.lead-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
}
.lead-date.no-date { background: var(--slate-100); color: var(--slate-500); border: 1px dashed var(--slate-300); }
.lead-date.scheduled { background: var(--brand-light); color: var(--brand-hover); border: 1px solid var(--brand-border); }
.lead-date.today { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }

.lead-tags { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.tag {
  background: var(--slate-100);
  color: var(--slate-600);
  padding: 3px 9px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.tag.hot { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger-border); }
.tag.ai { background: var(--ai-light); color: var(--ai); border: 1px solid var(--ai-border); }
.tag.warm { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning-border); }

.lead-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.lead-price {
  font-weight: 800;
  color: var(--slate-900);
  font-size: 14px;
}
.lead-price.empty { color: var(--slate-400); }
.lead-time { color: var(--slate-400); font-size: 11px; }

.empty-state {
  text-align: center;
  color: var(--slate-400);
  font-size: 12px;
  padding: 40px 0;
}

/* Loading state */
.pipeline-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--slate-500);
}

/* Responsive */
@media (max-width: 1400px) {
  .search-input { width: 140px; }
}
@media (max-width: 1280px) {
  .nav-link span:not(.nav-link-badge) { display: none; }
  .nav-link { padding: 8px 10px; }
}
@media (max-width: 1024px) {
  .search-wrap { display: none; }
  .pipeline { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
  .topnav { padding: 10px 14px; gap: 10px; }
  .nav-menu { display: none; }
  .kpi-strip { gap: 4px; }
  .kpi-tile { padding: 6px 10px; min-width: 80px; }
  .pipeline { grid-template-columns: 1fr; }
  .page-header { padding: 14px 16px; }
  .pipeline-wrap { padding: 14px; }
}

/* ============================================
   Leads: view toggle + unanswered filter (segmented)
   ============================================ */
.seg { display: inline-flex; background: var(--slate-100); border: 1px solid var(--slate-200); border-radius: var(--r-md); padding: 2px; gap: 2px; }
.seg-btn { border: none; background: transparent; color: var(--slate-600); font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s; }
.seg-btn:hover { color: var(--slate-800); }
.seg-btn.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }

/* ============================================
   Leads list view (newest first, unanswered = red)
   ============================================ */
.lead-list { display: flex; flex-direction: column; gap: 8px; max-width: 980px; margin: 0 auto; }
.lead-list-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 6px; font-size: 12.5px; }
.llh-count { font-weight: 700; color: var(--slate-700); }
.llh-unans { font-weight: 800; color: var(--danger); }
.lead-list-empty { text-align: center; color: var(--slate-500); padding: 48px; font-size: 14px; }

.lead-row { position: relative; display: flex; align-items: stretch; gap: 12px; background: #fff; border: 1px solid var(--slate-200); border-radius: var(--r-md); padding: 11px 14px 11px 0; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow .12s, transform .12s, border-color .12s; overflow: hidden; }
.lead-row:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); border-color: var(--slate-300); }
.lead-row.unans { background: var(--danger-light); border-color: var(--danger-border); }

.lr-stripe { flex: 0 0 5px; align-self: stretch; }
.lrs-new { background: var(--warning); }
.lrs-estimate { background: var(--info); }
.lrs-sent { background: var(--ai); }
.lrs-followup { background: var(--brand); }
.lrs-approved { background: var(--success); }
.lrs-lost { background: var(--slate-400); }
.lrs-neutral { background: var(--slate-300); }

.lr-main { flex: 1; min-width: 0; }
.lr-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lr-name { font-size: 14.5px; font-weight: 800; color: var(--slate-900); }
.lr-unans-pill { font-size: 11px; font-weight: 800; color: #fff; background: var(--danger); padding: 2px 9px; border-radius: 20px; letter-spacing: .2px; }
.lr-status { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; text-transform: none; letter-spacing: .3px; color: #fff; }
.lr-status.lrs-neutral { background: var(--slate-400); }
.lr-service { font-size: 13px; color: var(--slate-600); margin-top: 4px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lr-city { font-size: 12px; color: var(--slate-500); margin-top: 3px; }

.lr-right { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 2px; text-align: right; min-width: 80px; }
.lr-ago { font-size: 13px; font-weight: 800; color: var(--slate-700); white-space: nowrap; }
.lead-row.unans .lr-ago { color: var(--danger); }
.lr-exact { font-size: 11px; color: var(--slate-400); white-space: nowrap; }
.lr-price { font-size: 13px; font-weight: 800; color: var(--success); margin-top: 4px; }

/* Tech conversations (audience = Техники) */
.lrs-tech { background: #0E7490; }
.lr-status.lrs-tech { background: #0E7490; }
.tech-row { background: #F0FDFA; border-color: #99F6E4; }
.tech-row:hover { border-color: #5EEAD4; }

/* Tech conversation row count + tech chat modal */
.lr-count-pill { font-size: 11px; font-weight: 800; color: #0E7490; background: #CCFBF1; padding: 1px 8px; border-radius: 20px; }

.techchat-area { padding: 16px 20px; min-height: 320px; background: #EEF2F7; display: flex; flex-direction: column; gap: 10px; }
.tc-msg { display: flex; }
.tc-msg.in { justify-content: flex-start; }
.tc-msg.out { justify-content: flex-end; }
.tc-bubble { max-width: 76%; padding: 9px 12px; border-radius: 14px; box-shadow: var(--shadow-sm); }
.tc-msg.in .tc-bubble { background: #fff; border: 1px solid #99F6E4; border-bottom-left-radius: 4px; }
.tc-msg.out .tc-bubble { background: #DCFCE7; border: 1px solid #86EFAC; border-bottom-right-radius: 4px; }
.tc-text { font-size: 14px; color: var(--slate-800); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.tc-time { font-size: 11px; color: var(--slate-400); margin-top: 4px; text-align: right; }
.tc-photo { margin-top: 6px; width: 180px; max-width: 100%; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: var(--slate-100); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.tc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-photo-load { opacity: .5; }
.tc-file { margin-top: 6px; font-size: 13px; font-weight: 700; color: #0E7490; }

/* Audience switch: informative tabs with counts (Клиенты / Техники) */
.page-actions { flex-wrap: wrap; row-gap: 8px; }
.aud-switch { display: inline-flex; gap: 6px; margin-right: 6px; }
.aud-tab { display: inline-flex; align-items: center; gap: 7px; border: 1.5px solid var(--slate-200); background: #fff; color: var(--slate-600); font-size: 13px; font-weight: 700; padding: 7px 13px; border-radius: var(--r-md); cursor: pointer; transition: border-color .12s, background .12s, color .12s; }
.aud-tab:hover { border-color: var(--slate-300); }
.aud-ico { font-size: 14px; }
.aud-num { font-size: 11.5px; font-weight: 800; background: var(--slate-100); color: var(--slate-600); padding: 1px 8px; border-radius: 20px; min-width: 20px; text-align: center; }
.aud-tab.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }
.aud-tab.active .aud-num { background: var(--brand); color: #fff; }
.aud-tab.aud-tech.active { border-color: #0E7490; background: #CCFBF1; color: #0E7490; }
.aud-tab.aud-tech.active .aud-num { background: #0E7490; color: #fff; }

/* AI estimate button in tech chat header */
.tc-est-btn {
  background: var(--ai, #7C3AED);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .12s;
}
.tc-est-btn:hover { opacity: .9; }
.tc-est-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Mobile: KPI tiles wrap to rows (2 per row) instead of scrolling off-screen; smaller ── */
@media (max-width: 768px) {
  .topnav { flex-wrap: wrap; overflow-x: visible; row-gap: 8px; }
  .topnav-right { margin-left: auto; }
  /* N KPI tiles in ONE row, equal width — works for 3, 4, or 5 tiles across screens */
  .kpi-strip { flex: 1 1 100%; order: 5; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
  .kpi-tile {
    display: flex; flex: none; min-width: 0;
    flex-direction: column; align-items: center; justify-content: center; text-align: center;
    height: auto; min-height: 62px; padding: 10px 6px; gap: 3px;
  }
  .kpi-tile-icon { font-size: 18px; }
  .kpi-tile-info { align-items: center; text-align: center; gap: 1px; }
  .kpi-tile-value { font-size: 17px; letter-spacing: -.4px; }
  .kpi-tile-label { font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--slate-500); }
}

/* ── Mobile: uniform + compact Leads header controls -> more room for the list ── */
@media (max-width: 768px) {
  .page-header { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 10px; padding: 14px 16px; }
  .page-title { font-size: 18px; }
  .page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

  /* ===== Leads toolbar: 3 segmented toggles + refresh — grouping shows the logic ===== */
  .lead-toolbar { display: flex; flex-wrap: nowrap; gap: 8px; align-items: stretch; }

  /* each toggle = ONE segmented pill (its two buttons are joined => "pick one of these") */
  .lead-toolbar .aud-switch,
  .lead-toolbar #lead-view-seg,
  .lead-toolbar #lead-filter-seg {
    display: flex; flex: 1 1 0; min-width: 0;
    border: 1.5px solid var(--slate-200); border-radius: 11px; overflow: hidden; background: #fff;
  }
  /* the two halves of a segment: equal, flat, joined by a divider line */
  .lead-toolbar .aud-tab,
  .lead-toolbar .seg-btn {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; height: 48px; padding: 5px 4px;
    border: none; background: transparent; border-radius: 0;
    font-size: 11px; box-shadow: none;
  }
  .lead-toolbar .aud-tab + .aud-tab,
  .lead-toolbar .seg-btn + .seg-btn { border-left: 1.5px solid var(--slate-200); }
  /* active half = filled, so the current choice is obvious */
  .lead-toolbar .aud-tab.active,
  .lead-toolbar .seg-btn.active { background: var(--brand-light); }
  .lead-toolbar .active .tb-lbl { color: var(--brand); }
  .lead-toolbar .aud-tab.aud-tech.active { background: #CCFBF1; }
  .lead-toolbar .aud-tab.aud-tech.active .tb-lbl { color: #0E7490; }

  /* refresh = standalone square action (not a toggle) */
  .lead-toolbar .filter-pill {
    flex: 0 0 auto; width: 44px; height: 48px; min-width: 0; padding: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border: 1.5px solid var(--slate-200); border-radius: 11px; background: #fff; font-size: 11px;
  }

  .lead-toolbar .tb-ico { font-size: 16px; line-height: 1; }
  .lead-toolbar .tb-lbl { font-size: 11px; font-weight: 600; color: var(--slate-500); line-height: 1.15; white-space: nowrap; }
  /* counts (79 / 5) sit inline under the label, centered (works inside a segment) */
  .lead-toolbar .tb-badge { font-size: 11px; font-weight: 800; background: var(--slate-100); color: var(--slate-600); border-radius: 6px; padding: 0 5px; line-height: 1.5; margin-top: 1px; }
  .lead-toolbar .aud-tab.active .tb-badge { background: var(--brand); color: #fff; }
  .lead-toolbar .aud-tab.aud-tech.active .tb-badge { background: #0E7490; color: #fff; }

  /* + Add Lead: compact (override inline style) */
  .add-lead-btn { padding: 0 16px !important; font-size: 13px !important; min-height: 44px; border-radius: 9px; display: inline-flex; align-items: center; }

  /* Unify header action buttons on all NON-Leads screens (Jobs/Techs/Finance/Clients):
     Refresh / Add / advance / payout -> same compact pill, fill the row evenly */
  .page-actions:not(.lead-toolbar) .filter-pill,
  .page-actions:not(.lead-toolbar) .filter-pill-add,
  .page-actions:not(.lead-toolbar) .fin-add-btn,
  .page-actions:not(.lead-toolbar) .fin-pay-btn {
    flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 14px;
    font-size: 13px; font-weight: 700; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 5px; white-space: nowrap;
  }

  /* Calendar nav compact */
  .cal-nav { flex-wrap: wrap; gap: 5px; }
  .cal-label { flex: 1 1 auto; min-width: 0; }
  .cal-vtab { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 5px 8px; font-size: 11px; }
}

/* ── Leads status-filter chips (B redesign: replaces money KPI tiles) ── */
.lead-filters { display: flex; gap: 8px; margin-bottom: 10px; }
.lf-chip { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 8px 12px; cursor: pointer; background: #fff; border: 1.5px solid var(--slate-200); border-radius: 12px; transition: border-color .12s, background .12s; }
.lf-chip:hover { border-color: var(--slate-300); }
.lf-label { font-size: 12px; font-weight: 700; color: var(--slate-500); }
.lf-count { font-size: 20px; font-weight: 800; color: var(--slate-900); line-height: 1.1; }
.lf-chip.active { background: var(--brand-light); border-color: var(--brand); }
.lf-chip.active .lf-label, .lf-chip.active .lf-count { color: var(--brand); }
.lf-hot.has-hot .lf-count { color: var(--danger); }
.lf-hot.has-hot.active { background: var(--danger-light); border-color: var(--danger); }
.lf-hot.has-hot.active .lf-label, .lf-hot.has-hot.active .lf-count { color: var(--danger); }
@media (max-width: 768px) {
  .lead-filters { gap: 7px; margin-bottom: 8px; }
  .lf-chip { padding: 8px 10px; min-height: 48px; }
  .lf-label { font-size: 11px; }
  .lf-count { font-size: 18px; }
}

/* ── Quick actions on cards (Call / WhatsApp / Navigate) — one tap, card stays closed ── */
.lr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.qa-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: var(--r-md); background: var(--slate-50); border: 1px solid var(--slate-200); color: var(--slate-700); font-size: 13px; font-weight: 600; text-decoration: none; }
.qa-btn:hover { background: var(--slate-100); border-color: var(--slate-300); color: var(--slate-900); text-decoration: none; }
.qa-ico { font-size: 16px; line-height: 1; }
.qa-lbl { line-height: 1; }

/* mark-answered quick action */
.qa-btn.qa-done { background: var(--success, #16a34a); border-color: var(--success, #16a34a); color: #fff; }
.qa-btn.qa-done .qa-ico, .qa-btn.qa-done .qa-lbl { color: #fff; }
.qa-btn.qa-done:active { transform: scale(.97); }

/* ════════════════════════════════════════════
   UNIFIED Leads header controls — one pill style.
   Filters (Все / Не отвечено / Open / Hot) + Audience (Клиенты / Техники)
   + View (Список / Канбан) + Refresh — all identical horizontal pills.
   ════════════════════════════════════════════ */
.lead-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.aud-switch, #lead-view-seg, .lead-toolbar .seg {
  display: inline-flex; gap: 8px; margin: 0; padding: 0;
  background: none; border: 0; border-radius: 0; overflow: visible;
}
.lf-chip, .aud-tab, .seg-btn, .filter-pill {
  display: inline-flex; flex: 0 0 auto; flex-direction: row;
  align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; height: auto; padding: 0 14px;
  background: #fff; border: 1.5px solid var(--slate-200); border-radius: 10px;
  color: var(--slate-600); font-size: 13px; font-weight: 700; font-family: inherit;
  line-height: 1; white-space: nowrap; cursor: pointer; box-shadow: none;
  transition: border-color .12s, background .12s, color .12s;
}
.lf-chip:hover, .aud-tab:hover, .seg-btn:hover, .filter-pill:hover { border-color: var(--slate-300); background: var(--slate-50); }
.lf-chip.active, .aud-tab.active, .seg-btn.active { background: var(--brand-light); border-color: var(--brand); color: var(--brand); box-shadow: none; }
.lf-label, .tb-lbl { font-size: 13px; font-weight: 700; color: inherit; line-height: 1; }
.tb-ico, .aud-ico { font-size: 15px; line-height: 1; }
.lf-chip.active .lf-label { color: var(--brand); }
.lf-count, .aud-num, .tb-badge {
  font-size: 12px; font-weight: 800; line-height: 1; margin: 0;
  background: var(--slate-100); color: var(--slate-600);
  border-radius: 6px; padding: 3px 6px; min-width: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.lf-chip.active .lf-count, .aud-tab.active .aud-num, .aud-tab.active .tb-badge { background: var(--brand); color: #fff; }
.aud-tab.aud-tech.active { background: #CCFBF1; border-color: #0E7490; color: #0E7490; }
.aud-tab.aud-tech.active .tb-lbl, .aud-tab.aud-tech.active .aud-ico { color: #0E7490; }
.aud-tab.aud-tech.active .aud-num, .aud-tab.aud-tech.active .tb-badge { background: #0E7490; color: #fff; }
.lf-hot.active, .lf-hot.has-hot.active { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.lf-hot.active .lf-label, .lf-hot.has-hot.active .lf-label { color: var(--danger); }
.lf-hot.active .lf-count, .lf-hot.has-hot.active .lf-count { background: var(--danger); color: #fff; }

@media (max-width: 768px) {
  .lead-filters { gap: 7px; margin-bottom: 8px; }
  .lead-toolbar { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
  .lead-toolbar .aud-switch, .lead-toolbar #lead-view-seg, .lead-toolbar .seg {
    display: inline-flex; flex: 0 0 auto; gap: 7px;
    border: 0; background: none; border-radius: 0; overflow: visible;
  }
  .lf-chip, .lead-toolbar .aud-tab, .lead-toolbar .seg-btn, .lead-toolbar .filter-pill {
    flex: 0 0 auto; flex-direction: row; gap: 6px;
    min-height: 44px; height: auto; width: auto; padding: 0 12px;
    border: 1.5px solid var(--slate-200); border-radius: 10px; background: #fff;
    font-size: 12.5px; box-shadow: none;
  }
  .lead-toolbar .aud-tab + .aud-tab, .lead-toolbar .seg-btn + .seg-btn { border-left: 1.5px solid var(--slate-200); }
  .lead-toolbar .aud-tab.active, .lead-toolbar .seg-btn.active { background: var(--brand-light); }
  .lead-toolbar .aud-tab.aud-tech.active { background: #CCFBF1; }
  .lead-toolbar .tb-ico { font-size: 15px; }
  .lead-toolbar .tb-lbl { font-size: 12.5px; font-weight: 700; color: inherit; }
  .lf-label { font-size: 12.5px; }
  .lf-count { font-size: 12px; }
}

/* ── Mobile: compact Leads header (less height, more list) ── */
@media (max-width: 768px) {
  .page-header { gap: 8px; padding: 9px 12px; }
  .page-title { display: none; }
  .pipeline-wrap { padding: 10px 12px; min-height: 0; }
  .lead-filters { margin-bottom: 0; }
  .lead-toolbar { gap: 7px; }
  /* view + refresh = icon-only pills (save width, fit one row) */
  .lead-toolbar .seg-btn .tb-lbl,
  .lead-toolbar .filter-pill .tb-lbl { display: none; }
  .lead-toolbar .seg-btn,
  .lead-toolbar .filter-pill { padding: 0; width: 44px; min-width: 44px; }
  .lead-toolbar .seg-btn .tb-ico,
  .lead-toolbar .filter-pill .tb-ico { font-size: 17px; }
}

/* ════════ Mobile 2-row pill header (nav + status filters) ════════ */
/* nav action pills (Лид / Обновить) — mobile only */
.nav-action { display: none; }
/* status filter row scrolls horizontally instead of wrapping */
.lead-filters { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; flex-wrap: nowrap; }
.lead-filters::-webkit-scrollbar { display: none; }
.lead-filters .lf-chip { flex: 0 0 auto; }

@media (max-width: 768px) {
  /* bottom .mnav bar is the ONLY navigation on mobile — keep the top nav hidden (no duplicate) */
  .topnav .nav-menu { display: none !important; }
  /* status filters stay; trim page chrome */
  .page-title { display: none; }
  #lead-aud-seg, #lead-view-seg { display: none; }
  .page-header { gap: 8px; padding: 9px 12px; }
  .pipeline-wrap { padding: 10px 12px; min-height: 0; }
}

/* ════════ FIX: status filters on their own full-width row (no collision) ════════ */
.page-header { flex-wrap: wrap; }
.page-header > .page-title { order: 1; }
.page-header > .page-actions { order: 2; }
.page-header > .lead-filters { order: 3; flex: 1 1 100%; min-width: 0; max-width: 100%; margin-bottom: 0; margin-top: 2px; }

@media (max-width: 768px) {
  /* nav row already handles sections + refresh, so drop the whole toolbar on mobile */
  .lead-toolbar { display: none !important; }
}

/* view is driven by status-filter pills now (Все = Канбан, фильтр = список) */
#lead-view-seg { display: none !important; }

/* ── Mobile Kanban: horizontal scroll (columns side-by-side, swipe) instead of stacked ── */
@media (max-width: 768px) {
  .pipeline {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 86%;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    align-items: start;
    padding-bottom: 10px;
  }
  .pipeline::-webkit-scrollbar { display: none; }
  .col { min-height: 220px; scroll-snap-align: start; }
}

/* ════════ Polish: compact cards + uniform KPI tiles ════════ */
/* shorter lead list cards — compact quick-action buttons */
.lr-actions { gap: 6px; margin-top: 8px; }
.qa-btn { min-height: 36px; padding: 0 12px; font-size: 12.5px; gap: 5px; border-radius: 8px; }
.qa-ico { font-size: 14px; }

@media (max-width: 768px) {
  /* uniform + compact KPI tiles on EVERY page (same fixed height) */
  .kpi-tile { height: 58px; min-height: 58px; padding: 7px 6px; gap: 2px; overflow: hidden; }
  .kpi-tile-icon { font-size: 16px; }
  .kpi-tile-value { font-size: 16px; }
  .kpi-tile-label { font-size: 10.5px; line-height: 1.15; white-space: nowrap; }
  /* a touch shorter lead rows */
  .lead-row { padding-top: 10px; padding-bottom: 10px; }
}

/* ════════ Status filters = single horizontal scroll row (no wrap) ════════ */
.lead-filters { flex-wrap: nowrap !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; scrollbar-width: none; min-width: 0; }
.lead-filters::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
  /* restore the Leads "Обновить" button: show toolbar with refresh only (audience/view stay hidden) */
  .lead-toolbar { display: flex !important; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; order: 2; }
  .lead-toolbar .filter-pill { order: 0; }
}

/* ═══════════════ Leads redesign: pills + Add Lead pill + lead cards (mockup) ═══════════════ */

/* Add Lead pill — mobile only (desktop keeps the topnav Add Lead button) */
.lf-add { display: none; }
@media (max-width: 768px) {
  #lead-filters .lf-add {
    display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
    position: sticky; left: 0; z-index: 2;
    min-height: 44px; padding: 0 13px;
    background: var(--danger); color: #fff; border: 1.5px solid var(--danger);
    border-radius: 10px; font-weight: 800; white-space: nowrap; cursor: pointer;
    box-shadow: 5px 0 7px -3px rgba(15,23,42,.12);
  }
  #lead-filters .lf-add .lf-label { color: #fff; font-size: 13px; font-weight: 800; }
  #lead-filters .lf-add .lf-plus { font-size: 17px; line-height: 1; margin-top: -1px; }
}

/* Active pill = red (brand) */
#lead-filters .lf-chip.active { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
#lead-filters .lf-chip.active .lf-label { color: var(--danger); }
#lead-filters .lf-chip.active .lf-count { background: var(--danger); color: #fff; }

/* Status-coloured pills (semantic outline + tinted count) */
#lead-filters .lf-chip.lfc-estimate { border-color: var(--warning); color: var(--warning); }
#lead-filters .lf-chip.lfc-estimate .lf-label { color: var(--warning); }
#lead-filters .lf-chip.lfc-estimate .lf-count { background: var(--warning-light); color: var(--warning); }
#lead-filters .lf-chip.lfc-followup { border-color: var(--info); color: var(--info); }
#lead-filters .lf-chip.lfc-followup .lf-label { color: var(--info); }
#lead-filters .lf-chip.lfc-followup .lf-count { background: var(--info-light); color: var(--info); }
#lead-filters .lf-chip.lfc-approved { border-color: var(--success); color: var(--success); }
#lead-filters .lf-chip.lfc-approved .lf-label { color: var(--success); }
#lead-filters .lf-chip.lfc-approved .lf-count { background: var(--success-light); color: var(--success); }
#lead-filters .lf-chip.lfc-progress { border-color: var(--ai); color: var(--ai); }
#lead-filters .lf-chip.lfc-progress .lf-label { color: var(--ai); }
#lead-filters .lf-chip.lfc-progress .lf-count { background: #EDE9FE; color: var(--ai); }

/* ── Lead cards (list view) ── */
.lcards { display: flex; flex-direction: column; gap: 12px; }
.lcard {
  position: relative; display: flex; gap: 11px;
  background: #fff; border: 0.5px solid var(--slate-200); border-left: 4px solid var(--sc, var(--slate-300));
  border-radius: 0 14px 14px 0; box-shadow: var(--card-shadow); padding: 13px; cursor: pointer;
  transition: box-shadow .12s, border-color .12s;
}
.lcard:hover { box-shadow: 0 4px 14px rgba(15,23,42,.10); }
.lcard.unans { background: #FFF7F7; border-color: var(--danger); }
.lcard.s-new      { --sc: var(--danger);    --sct: var(--danger-light); }
.lcard.s-estimate { --sc: var(--warning);   --sct: var(--warning-light); }
.lcard.s-sent     { --sc: var(--slate-400); --sct: var(--slate-100); }
.lcard.s-followup { --sc: var(--info);      --sct: var(--info-light); }
.lcard.s-approved { --sc: var(--success);   --sct: var(--success-light); }
.lcard.s-progress { --sc: var(--ai);        --sct: #EDE9FE; }
.lcard.s-lost     { --sc: var(--slate-300); --sct: var(--slate-100); }
.lcard.s-neutral  { --sc: var(--slate-400); --sct: var(--slate-100); }

.lcard-av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; background: var(--sct, var(--slate-100)); color: var(--sc, var(--slate-600)); }
.lcard-mid { flex: 1; min-width: 0; }
.lcard-name { font-size: 16.5px; font-weight: 800; color: var(--slate-900); letter-spacing: -.3px; margin-bottom: 3px; }
.lcard-desc { font-size: 13.5px; color: var(--slate-600); line-height: 1.35; margin-bottom: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lcard-chan { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--slate-500); min-width: 0; }
.lcard-chan .lcard-ci { display: grid; place-items: center; flex: none; }
.lcard-chan.ch-wa .lcard-ci { color: #25D366; }
.lcard-chan.ch-app .lcard-ci, .lcard-chan.ch-web .lcard-ci { color: var(--slate-400); }
.lcard-chl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lcard-rt { flex: none; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px; }
.lcard-badge { border: 1.5px solid var(--sc, var(--slate-300)); color: var(--sc, var(--slate-600)); border-radius: 9px; padding: 4px 9px; font-size: 11.5px; font-weight: 700; white-space: nowrap; line-height: 1.1; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.lcard-amt { text-align: right; }
.lcard-amt-v { font-size: 19px; font-weight: 800; color: var(--slate-900); line-height: 1; }
.lcard-amt-v.dash { color: var(--slate-400); }
.lcard-amt-l { font-size: 11px; color: var(--slate-400); font-weight: 600; margin-top: 2px; }
.lcard-acts { display: flex; gap: 7px; }
.lab { width: 38px; height: 38px; border: 1.5px solid var(--slate-200); border-radius: 10px; display: grid; place-items: center; background: #fff; cursor: pointer; text-decoration: none; color: var(--slate-600); }
.lab.msg { border-color: var(--danger-border); color: var(--danger); }
.lab.call { border-color: #A7F3D0; color: var(--success); }
.lab.est { border-color: var(--brand-border); color: var(--brand); }
.lab:active { transform: translateY(1px); }
.lead-list-empty { text-align: center; color: var(--slate-400); padding: 40px 0; font-size: 14px; }

@media (max-width: 768px) {
  .lcard { padding: 12px; gap: 10px; }
  .lcard-name { font-size: 16px; }
}

/* ═══════ Leads mobile top cleanup: remove duplicate Add Lead + empty toolbar band; refresh moves into the pill row ═══════ */
.lf-refresh { display: none; }
@media (max-width: 768px) {
  /* hide the duplicate indigo Add Lead in the header (the red pill covers it) */
  #page-leads .add-lead-btn { display: none !important; }
  /* kill the empty toolbar band (its controls are hidden on mobile; refresh now lives in the pill row) */
  #page-leads .lead-toolbar { display: none !important; }
  /* tighten so the pills sit right under the brand — no dead space */
  #page-leads .page-header { padding-top: 8px; padding-bottom: 8px; }
  #page-leads .pipeline-wrap { padding-top: 8px; }
  /* refresh = pinned-right icon pill in the filter row */
  #page-leads #lead-filters .lf-refresh {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    position: sticky; right: 0; z-index: 2;
    width: 44px; min-height: 44px; padding: 0;
    background: #fff; border: 1.5px solid var(--slate-200); border-radius: 10px; cursor: pointer;
    box-shadow: -5px 0 7px -3px rgba(15,23,42,.10);
  }
  #page-leads #lead-filters .lf-refresh .lf-rico { font-size: 17px; line-height: 1; }
}

/* ─── Leads: single filter-select dropdown button (replaces pill row) ─── */
#lead-filters { overflow: visible; }
.lf-filter-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.lf-filter { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--danger-border); background: var(--danger-light); border-radius: 10px; padding: 0 14px; font-size: 14.5px; font-weight: 800; color: var(--danger); cursor: pointer; white-space: nowrap; }
.lf-filter-label { overflow: hidden; text-overflow: ellipsis; }
.lf-filter-count { font-size: 12px; font-weight: 800; color: #fff; background: var(--danger); padding: 1px 8px; border-radius: 9px; }
.lf-filter-chev { margin-left: auto; font-size: 10px; color: var(--danger); opacity: .75; }
.lf-filter-menu { display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 100; background: #fff; border: 1px solid var(--slate-200); border-radius: 12px; box-shadow: 0 12px 36px rgba(15,23,42,.18); padding: 5px; max-height: 62vh; overflow-y: auto; }
.lf-fm-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 12px; border-radius: 8px; font-size: 14.5px; font-weight: 600; color: var(--slate-700); cursor: pointer; white-space: nowrap; }
.lf-fm-item:active { background: var(--slate-50); }
.lf-fm-item.active { background: var(--brand-light); color: var(--brand); }
.lf-fm-c { font-size: 11px; font-weight: 800; color: var(--slate-500); background: var(--slate-100); padding: 1px 8px; border-radius: 9px; }
.lf-fm-item.active .lf-fm-c { background: var(--brand); color: #fff; }
@media (max-width:768px){ .lf-filter { padding: 0 12px; } }

/* ─── Leads mobile: hide the brand header (topnav), move logo into the action row ─── */
.lf-logo-wrap { display: none; }
@media (max-width: 768px) {
  #page-leads .topnav { display: none !important; }
  #page-leads .page-header { padding-top: 10px; }
  #lead-filters .lf-logo-wrap { display: block; position: relative; flex: 0 0 auto; }
  #lead-filters .lf-logo {
    width: 46px; min-height: 44px; border: 0; border-radius: 12px;
    background: linear-gradient(135deg,#6E6CE0,#5856D6); color: #fff;
    font-size: 21px; display: grid; place-items: center; cursor: pointer; padding: 0;
  }
  #lead-filters .lf-logo:active { transform: translateY(1px); }
  #lead-filters .lf-logo-menu {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 101;
    min-width: 182px; background: #fff; border: 1px solid var(--slate-200);
    border-radius: 12px; box-shadow: 0 12px 36px rgba(15,23,42,.18); padding: 6px;
  }
  #lead-filters .lf-logo-menu .llm-head { padding: 9px 12px 6px; font-size: 11px; font-weight: 800; color: var(--slate-500); text-transform: uppercase; letter-spacing: .04em; }
  #lead-filters .lf-logo-menu .llm-item { padding: 11px 12px; border-radius: 8px; font-size: 14.5px; font-weight: 700; color: var(--danger); cursor: pointer; }
  #lead-filters .lf-logo-menu .llm-item:active { background: var(--slate-50); }
}

/* ════════════════════════════════════════════════════════════
   iOS v2 polish (additive layer — overrides only visual chrome,
   no layout/handler changes). Design system v11.
   ════════════════════════════════════════════════════════════ */

/* Frosted translucent sticky top bar (iOS navigation bar) */
.topnav {
  background: rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--slate-200);
}
.brand-name { letter-spacing: -.3px; }
.brand-icon { border-radius: var(--r-md); }

/* Large-title page header — iOS feel */
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }

/* Nav links / pills get the iOS pressed micro-interaction */
.nav-link, .lf-chip, .aud-tab, .seg-btn, .filter-pill,
.qa-btn, .lab, .lf-add, .lf-refresh, .lf-filter {
  transition: transform .12s ease, background .15s ease,
              border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.lf-chip:active, .aud-tab:active, .seg-btn:active, .filter-pill:active,
.qa-btn:active, .lab:active, .nav-link:active { transform: scale(.97); }

/* Segmented control — closer to iOS UISegmentedControl */
.seg { background: rgba(118,118,128,.12); border: 0; border-radius: var(--r); padding: 2px; }
.seg-btn { border-radius: 8px; font-weight: 600; }
.seg-btn.active { background: #fff; color: var(--slate-900); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Lead cards — softer iOS elevation + rounder corners */
.lead-card { border-radius: var(--r-md); border: .5px solid var(--slate-200); }
.lead-card:hover { transform: translateY(-1px); }
.lcard { border-radius: var(--r-lg); border-top: .5px solid var(--slate-200);
         border-right: .5px solid var(--slate-200); border-bottom: .5px solid var(--slate-200); }
.lead-row { border-radius: var(--r-md); border: .5px solid var(--slate-200); }

/* Rounder avatar tiles & action buttons */
.lab { border-radius: var(--r-md); }
.lcard-av { font-weight: 700; }

/* Tech-chat modal bubbles — iОS Messages tail radius already present; round photos a bit more */
.tc-bubble { border-radius: 18px; }
.tc-photo { border-radius: var(--r-md); }

/* ============================================================
   STANDARD MONITOR — Э3: Lead Inbox (PDF p2). Desktop-only.
   New blocks hidden by default; grid STRICTLY @media(min-width:1366px).
   Mobile (<1366) untouched.
   ============================================================ */
.leads-kpis, .leads-aside { display:none; }

@media (min-width:1366px){
  /* KPI / filter chip row (real counts from existing #lead-filters loop) */
  #leads-kpis{display:flex; gap:10px; margin-top:10px; flex-wrap:wrap}
  #leads-kpis .lkpi{display:flex; flex-direction:column; align-items:flex-start; gap:1px; background:#fff; border:1px solid #E6E8EE; border-radius:14px; padding:9px 14px; min-width:104px; cursor:pointer; box-shadow:0 1px 3px rgba(16,24,40,.06)}
  #leads-kpis .lkpi.active, #leads-kpis .lkpi:hover{border-color:#5856D6}
  #leads-kpis .lkpi-n{font-size:20px; font-weight:800; letter-spacing:-.01em; color:#0B1220}
  #leads-kpis .lkpi-l{font-size:12px; color:#6B7280; font-weight:600}

  /* 2-column workspace: leads left, context panel right */
  .pipeline-wrap{display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:18px; align-items:start}
  .pipeline-wrap .filter-banner{grid-column:1 / -1}
  .pipeline-wrap #pipeline-area{grid-column:1; min-width:0}
  .pipeline-wrap .leads-aside{grid-column:2; display:flex; flex-direction:column; gap:10px; align-self:start; background:#fff; border:1px solid #E6E8EE; border-radius:18px; padding:16px; position:sticky; top:78px}

  /* right panel */
  .leads-aside .la-h{font-size:18px; font-weight:800; letter-spacing:-.01em; color:#0B1220}
  .leads-aside .la-sub{font-size:12.5px; color:#6B7280; line-height:1.35}
  .leads-aside .la-card{background:linear-gradient(135deg,#5856D6,#7A78E6); color:#fff; border-radius:14px; padding:14px; cursor:pointer}
  .leads-aside .la-name{font-size:16px; font-weight:800}
  .leads-aside .la-meta{font-size:12.5px; opacity:.9; margin-top:2px}
  .leads-aside .la-open{margin-top:4px; background:#ECECFB; color:#5856D6; border:none; border-radius:999px; height:38px; font-size:14px; font-weight:700; font-family:inherit; cursor:pointer}

  /* leads list → horizontal "Priority queue" rows (list view) */
  #pipeline-area .lcards{display:flex; flex-direction:column; gap:10px}
  #pipeline-area .lcards .lead-row{display:flex; align-items:center; gap:14px; padding:14px 16px; border-radius:16px}
}
@media (min-width:1536px){ .pipeline-wrap{grid-template-columns:minmax(0,1fr) 360px} }

/* Promote button on Unverified (quarantined) lead cards */
.lab.promote{ width:auto; padding:0 12px; height:38px; gap:4px; border:none; border-radius:10px; background:var(--brand,#4F46E5); color:#fff; font-size:12.5px; font-weight:700; font-family:inherit; }
.lab.promote:hover{ background:var(--brand-hover,#4338CA); }
.lab.promote:active{ transform:scale(.96); }

/* Reminder button on a lead due for a Phase-1 nudge (l.reminder_due) — amber accent, distinct from Promote */
.lab.remind{ width:auto; padding:0 12px; height:38px; gap:4px; border:none; border-radius:10px; background:var(--warning,#FF9500); color:#fff; font-size:12.5px; font-weight:700; font-family:inherit; white-space:nowrap; }
.lab.remind:hover{ filter:brightness(.94); }
.lab.remind:active{ transform:scale(.96); }

/* ── Action Center ──────────────────────────────────────────── */
.action-center {
  margin: 0 12px 8px;
  background: var(--surface, #fff);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.ac-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--slate-400, #9AA0A6);
  padding: 10px 14px 4px;
}
.ac-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-top: 1px solid var(--separator, rgba(60,60,67,.1));
  transition: background .15s;
}
.ac-item:first-of-type { border-top: none; }
.ac-item:active { background: var(--slate-50, #F8F9FA); }
.ac-ico { font-size: 15px; flex-shrink: 0; }
.ac-lbl { flex: 1; font-size: 14px; font-weight: 500; color: var(--slate-800, #1C1C1E); }
.ac-arr { font-size: 13px; color: var(--slate-400, #9AA0A6); }
.ac-warn .ac-lbl { color: #FF9500; }
.ac-info .ac-lbl { color: var(--brand, #5856D6); }
.ac-success .ac-lbl { color: #34C759; }

/* ── Wait timer chips ───────────────────────────────────────── */
.wait-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  flex-shrink: 0;
  margin-left: 6px;
}
.wait-green { background: rgba(52,199,89,.12); color: #34C759; }
.wait-orange { background: rgba(255,149,0,.14); color: #FF9500; }
.wait-red { background: rgba(255,59,48,.12); color: #FF3B30; }

/* ── lcard top row (name + wait chip) ─────────────────────── */
.lcard-top-row {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
}
.lcard-top-row .lcard-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Next Action button ─────────────────────────────────────── */
.lcard-na {
  margin-top: 6px;
}
.na-btn {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  pointer-events: none;
}
.na-reply    { background: rgba(255,59,48,.1);   color: #FF3B30; }
.na-estimate { background: rgba(88,86,214,.1);  color: var(--brand, #5856D6); }
.na-followup { background: rgba(255,149,0,.12); color: #FF9500; }
.na-schedule { background: rgba(52,199,89,.1);  color: #34C759; }

/* ac-sub: secondary line inside an action-center item */
.ac-sub { display: block; font-size: 11px; font-weight: 400; color: var(--slate-400, #9AA0A6); margin-top: 1px; }
