/* CRM v4 — multi-page layout */

.crm-boot-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.crm-boot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 44px 32px;
  border-radius: 22px;
  background: rgba(15, 17, 23, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  min-width: 220px;
}

.crm-boot-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  font-size: 26px;
}

.crm-boot-title {
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.crm-boot-sub {
  margin-top: -6px;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.crm-boot-spinner {
  width: 28px;
  height: 28px;
  margin-top: 8px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: crm-boot-spin 0.75s linear infinite;
}

.crm-boot-hint {
  font-size: 13px;
  color: #94a3b8;
}

@keyframes crm-boot-spin {
  to { transform: rotate(360deg); }
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── App shell: sidebar + content ── */
#crm-root.crm-app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  min-height: 100vh;
  max-width: 1920px;
  margin: 0 auto;
  padding: 12px;
  gap: 12px;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.crm-sidebar,
#crm-sidebar.crm-sidebar {
  grid-column: 1;
  grid-row: 1;
  width: 248px;
  min-width: 248px;
  max-width: 248px;
  position: sticky;
  top: 12px;
  align-self: start;
  max-height: calc(100vh - 24px);
  min-height: auto;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg, #0f1117);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--border-radius-xl, 18px);
  padding: 14px 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  border-right: 1px solid var(--sidebar-border);
  backdrop-filter: none;
}

.crm-sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.crm-sidebar .sidebar-user-block {
  padding: 12px 6px;
  flex-shrink: 0;
}

.crm-sidebar .sidebar-user {
  width: 100%;
  box-sizing: border-box;
}

.crm-sidebar .fun-bank-chip {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  margin-bottom: 0;
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
}

.crm-sidebar .sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 4px;
  margin: 0;
  border: none;
}

.crm-sidebar .sidebar-footer {
  flex-shrink: 0;
  padding: 12px 6px 4px;
  margin-top: auto;
}

.crm-sidebar .lite-mode-toggle {
  margin: 0 0 8px;
  width: 100%;
  box-sizing: border-box;
}

.crm-sidebar .sidebar-btn,
.crm-sidebar .toolbar-btn.logout {
  width: 100%;
  height: 36px;
  justify-content: center;
  box-sizing: border-box;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  font-weight: 600;
  border-radius: 10px;
}

.crm-sidebar .toolbar-btn.logout:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
  transform: none;
}

.crm-main,
#crm-content.crm-main {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--content-bg, #f4f5f7);
  border: 1px solid var(--border-tertiary, #e5e7eb);
  border-radius: var(--border-radius-xl, 18px);
  padding: 24px 28px 32px;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
  overflow: auto;
  max-height: calc(100vh - 24px);
  width: auto;
  gap: 0;
}

.page-root {
  flex: 1;
  min-width: 0;
}

/* Dashboard */
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.dash-grid .dash-card {
  grid-column: span 6;
}

.dash-grid .dash-card--wide {
  grid-column: span 12;
}

.dash-grid .dash-card:nth-child(2) {
  grid-column: span 6;
}

.dash-card {
  background: linear-gradient(165deg, #ffffff 0%, #fafbff 100%);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px rgba(99, 102, 241, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.dash-card:hover {
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.05),
    0 12px 32px rgba(99, 102, 241, 0.1);
}

.dash-card--wide {
  grid-column: 1 / -1;
}

.dash-card--warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: linear-gradient(165deg, #fffbeb 0%, #fff7ed 100%);
}

.dash-card__title {
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.02em;
}

.dash-card__title i {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: #4f46e5;
  font-size: 17px;
  flex-shrink: 0;
}

.dash-donut-wrap,
.dash-funnel-wrap,
.dash-daily-wrap,
.dash-mgr-wrap {
  min-height: 80px;
}

.dash-split-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.dash-card--funnel,
.dash-card--fortune {
  min-height: 0;
}

/* ── Колесо фортуны ── */
.fortune-wheel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.fortune-wheel__frame {
  position: relative;
  width: min(100%, 260px);
  aspect-ratio: 1;
  margin: 0 auto;
}

.fortune-wheel__rotor {
  position: absolute;
  inset: 0;
  transition: transform 4.2s cubic-bezier(0.15, 0.85, 0.2, 1);
  will-change: transform;
}

.fortune-wheel__disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid #fff;
  box-shadow:
    0 0 0 4px rgba(99, 102, 241, 0.25),
    0 12px 32px rgba(79, 70, 229, 0.2);
}

.fortune-wheel__pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 22px solid #f59e0b;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  z-index: 3;
}

.fortune-wheel__labels {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.fortune-wheel__label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: rotate(var(--lbl-angle)) translateY(-78px) rotate(calc(-1 * var(--lbl-angle)));
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  width: 28px;
  text-align: center;
}

.fortune-wheel__hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: linear-gradient(145deg, #4f46e5, #7c3aed);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.fortune-wheel__hub:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.05);
}

.fortune-wheel__hub:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: linear-gradient(145deg, #94a3b8, #64748b);
}

.fortune-wheel__hub-icon {
  font-size: 18px;
  line-height: 1;
}

.fortune-wheel__hub-text {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fortune-wheel__hub--cd .fortune-wheel__hub-text {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-transform: none;
}

.fortune-wheel__status {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  text-align: center;
}

.fortune-wheel__result {
  margin: 0;
  min-height: 1.2em;
  font-size: 14px;
  font-weight: 700;
  color: #4f46e5;
  text-align: center;
}

.fortune-wheel__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  justify-content: center;
  max-width: 280px;
}

.fortune-wheel__legend li {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #475569;
}

.fortune-wheel__legend span {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.dash-recent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-recent-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 10px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--border-tertiary);
  border-radius: var(--border-radius-md);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dash-recent-item:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.dash-recent-phone {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

.dash-recent-comment {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-link-more {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.dash-link-more:hover {
  text-decoration: underline;
}

.dash-empty,
.page-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Donut chart */
.donut-chart {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  align-items: start;
  gap: 20px 24px;
  padding: 4px 0;
}

.donut-chart--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 16px;
  grid-template-columns: 1fr;
}

.donut-chart__empty-msg {
  margin: 0;
  font-size: 14px;
  color: #64748b;
}

.donut-chart__viz {
  position: relative;
  width: 188px;
  height: 188px;
  flex-shrink: 0;
  justify-self: center;
  filter: drop-shadow(0 6px 18px rgba(99, 102, 241, 0.14));
}

.donut-chart__svg {
  width: 100%;
  height: 100%;
  display: block;
}

.donut-chart__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  padding: 0 12px;
}

.donut-chart__total {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -0.03em;
}

.donut-chart__hint {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

.donut-chart__side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.donut-chart__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.donut-chart__tip {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.35;
}

.donut-chart__reset {
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: #f5f7ff;
  color: #4f46e5;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.donut-chart__reset:hover {
  background: #eef2ff;
}

.donut-chart__legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.donut-legend-item {
  display: grid;
  grid-template-columns: 18px 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: #f8fafc;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.donut-legend-item:hover {
  background: #f5f7ff;
  border-color: rgba(99, 102, 241, 0.22);
}

.donut-legend-item.is-off {
  opacity: 0.55;
  background: #fff;
}

.donut-legend-item.is-off .donut-legend-label {
  text-decoration: line-through;
  color: #94a3b8;
}

.donut-legend-item.is-off .donut-legend-swatch {
  filter: grayscale(0.85);
  opacity: 0.45;
}

.donut-legend-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: transparent;
  flex-shrink: 0;
}

.donut-legend-item.is-on .donut-legend-check {
  background: #6366f1;
  border-color: #6366f1;
  color: #fff;
}

.donut-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.donut-legend-label {
  min-width: 0;
  color: #334155;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.donut-legend-value {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

/* Pipeline kanban */
.pipeline-board-host {
  overflow: hidden;
}

.pipeline-board__scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}

.pipeline-column {
  flex: 0 0 260px;
  max-width: 280px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-tertiary);
  border-radius: var(--border-radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.pipeline-column__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-tertiary);
  background: var(--st-bg, var(--bg-primary));
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.pipeline-column__title {
  font-size: 12px;
  font-weight: 700;
  color: var(--st-fg, var(--text-primary));
}

.pipeline-column__count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-secondary);
}

.pipeline-column__body {
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.pipeline-column__empty {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 16px 8px;
}

.pipeline-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-tertiary);
  border-radius: var(--border-radius-md);
  padding: 10px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  text-align: left;
}

.pipeline-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.pipeline-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.pipeline-card__phone {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.pipeline-card__mgr {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
}

.pipeline-card__name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.pipeline-card__comment {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0 0 4px;
  line-height: 1.35;
}

.pipeline-card__meta {
  font-size: 10px;
  color: var(--text-tertiary);
}

/* Analytics page grid */
.analytics-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-page-grid .dash-card--wide {
  grid-column: 1 / -1;
}

.calendly-block--page {
  padding: 16px;
}

.fun-sticker-pack-wrap {
  margin-bottom: 16px;
}

.shop-hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* KPI cards from charts */
.kpi-card-mini {
  background: var(--bg-primary);
  border: 1px solid var(--border-tertiary);
  border-radius: var(--border-radius-md);
  padding: 12px 14px;
}

.kpi-card-mini__value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.kpi-card-mini__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-card-mini__hint {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Sidebar nav v4 */
#sidebar-nav .side-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  margin-bottom: 0;
  border: 1px solid transparent;
}

#sidebar-nav .side-nav-link span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sidebar-nav .side-nav-link i {
  font-size: 18px;
  width: 20px;
  text-align: center;
  opacity: 0.85;
  flex-shrink: 0;
}

#sidebar-nav .side-nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
  border-color: var(--sidebar-border);
}

#sidebar-nav .side-nav-link.is-active {
  background: var(--sidebar-active);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.35);
  font-weight: 600;
}

body {
  padding: 0 !important;
  background: var(--content-bg, #f4f5f7) !important;
}

@media (max-width: 980px) {
  #crm-root.crm-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    padding: 8px;
    gap: 8px;
  }
  .crm-sidebar,
  #crm-sidebar.crm-sidebar {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: none;
    grid-column: 1;
    grid-row: 1;
  }
  .crm-sidebar .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    overflow: visible;
    gap: 6px;
    padding: 4px;
  }
  #sidebar-nav .side-nav-link {
    width: auto;
    flex: 1 1 calc(50% - 6px);
    min-width: 120px;
    padding: 8px 10px;
    font-size: 12px;
  }
  #sidebar-nav .side-nav-link i {
    font-size: 16px;
  }
  .crm-main,
  #crm-content.crm-main {
    grid-column: 1;
    grid-row: 2;
    max-height: none;
    padding: 16px;
  }
  .dash-grid,
  .analytics-page-grid,
  .admin-page-grid {
    grid-template-columns: 1fr;
  }
  .dash-grid .dash-card,
  .dash-grid .dash-card--wide {
    grid-column: span 1;
  }
  .pipeline-column {
    flex: 0 0 220px;
  }
}

/* ═══ Funnel v3 — чистая воронка ═══ */
.funnel-v3 {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 2px 0;
}

.funnel-v3__hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f5f7ff 0%, #eef2ff 100%);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.funnel-v3__hero-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.funnel-v3__hero-value {
  font-size: 32px;
  font-weight: 800;
  color: #4f46e5;
  line-height: 1;
  letter-spacing: -0.03em;
}

.funnel-v3__hero-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.funnel-v3__hero-sub {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(99, 102, 241, 0.12);
}

.funnel-v3__stages {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.funnel-v3__bridge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 4px 18px;
}

.funnel-v3__bridge-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
  max-width: 48px;
}

.funnel-v3__bridge-pill {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.funnel-v3__step {
  padding: 12px 14px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e8ecf4;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.funnel-v3__step:hover {
  border-color: rgba(99, 102, 241, 0.22);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.08);
}

.funnel-v3__head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  margin-bottom: 10px;
}

.funnel-v3__num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #4f46e5;
  background: #eef2ff;
  flex-shrink: 0;
}

.funnel-v3__step--t2 .funnel-v3__num { color: #6d28d9; background: #f5f3ff; }
.funnel-v3__step--t3 .funnel-v3__num { color: #b45309; background: #fffbeb; }
.funnel-v3__step--t4 .funnel-v3__num { color: #047857; background: #ecfdf5; }
.funnel-v3__step--t5 .funnel-v3__num { color: #0f766e; background: #f0fdfa; }

.funnel-v3__copy {
  min-width: 0;
}

.funnel-v3__title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.funnel-v3__hint {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.35;
}

.funnel-v3__metrics {
  text-align: right;
  flex-shrink: 0;
  min-width: 52px;
}

.funnel-v3__count {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.funnel-v3__pct {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 700;
  color: #6366f1;
}

.funnel-v3__track {
  height: 10px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}

.funnel-v3__fill {
  height: 100%;
  width: var(--bar-w, 100%);
  border-radius: 999px;
  background: linear-gradient(90deg, #a5b4fc, #6366f1);
  transition: width 0.45s cubic-bezier(0.34, 1.1, 0.64, 1);
  min-width: 4px;
}

.funnel-v3__step--t2 .funnel-v3__fill {
  background: linear-gradient(90deg, #c4b5fd, #8b5cf6);
}
.funnel-v3__step--t3 .funnel-v3__fill {
  background: linear-gradient(90deg, #fcd34d, #f59e0b);
}
.funnel-v3__step--t4 .funnel-v3__fill {
  background: linear-gradient(90deg, #6ee7b7, #10b981);
}
.funnel-v3__step--t5 .funnel-v3__fill {
  background: linear-gradient(90deg, #5eead4, #14b8a6);
}

/* ═══ Bar chart — новые лиды по дням ═══ */
.chart-bars {
  --chart-cols: 14;
  --bar-min-width: 36px;
  padding: 4px 0 8px;
}

.chart-bars__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #64748b;
}

.chart-bars__meta strong {
  color: #0f172a;
  font-weight: 800;
}

.chart-bars__hint {
  margin-left: auto;
  font-size: 11px;
  color: #94a3b8;
}

.chart-bars__scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.35) transparent;
}

.chart-bars__scroll::-webkit-scrollbar {
  height: 6px;
}

.chart-bars__scroll::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.35);
  border-radius: 999px;
}

.chart-bars__plot {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--chart-cols), minmax(var(--bar-min-width, 28px), 1fr));
  gap: 4px;
  align-items: end;
  min-width: calc(var(--chart-cols) * var(--bar-min-width, 28px));
  min-height: 200px;
  padding: 12px 10px 6px;
  background:
    linear-gradient(180deg, rgba(99, 102, 241, 0.03) 0%, transparent 40%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      rgba(99, 102, 241, 0.06) 39px,
      rgba(99, 102, 241, 0.06) 40px
    );
  border-radius: 16px;
  border: 1px solid rgba(99, 102, 241, 0.1);
}

.chart-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 176px;
  min-width: var(--bar-min-width, 28px);
  z-index: 1;
  cursor: default;
}

.chart-bar--has-value {
  cursor: pointer;
}

.chart-bar__tip {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%) scale(0.92);
  padding: 5px 8px;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.35);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  text-align: center;
  line-height: 1.25;
}

.chart-bar__tip-date {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.chart-bar__tip-count {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.chart-bar:hover {
  z-index: 25;
}

.chart-bar--has-value:hover .chart-bar__tip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

.chart-bar__value {
  font-size: 11px;
  font-weight: 800;
  color: #4f46e5;
  min-height: 14px;
  line-height: 1;
  white-space: nowrap;
}

.chart-bar__value--on-hover {
  opacity: 0;
}

.chart-bar--has-value:hover .chart-bar__value--on-hover {
  opacity: 1;
}

.chart-bar__track {
  position: relative;
  width: 100%;
  max-width: 28px;
  height: 120px;
  display: flex;
  align-items: flex-end;
  border-radius: 10px 10px 5px 5px;
  background: rgba(148, 163, 184, 0.12);
  overflow: visible;
}

.chart-bar__fill {
  width: 100%;
  height: var(--bar-height, 0%);
  border-radius: 10px 10px 5px 5px;
  background: linear-gradient(180deg, #c7d2fe 0%, #818cf8 40%, #6366f1 100%);
  transition: height 0.4s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.chart-bar--zero .chart-bar__track {
  background: rgba(148, 163, 184, 0.08);
  height: 120px;
}

.chart-bar--zero .chart-bar__fill {
  display: none;
}

.chart-bar--has-value .chart-bar__fill {
  min-height: 8px;
  box-shadow: 0 -4px 16px rgba(99, 102, 241, 0.35);
}

.chart-bar--has-value .chart-bar__track {
  background: rgba(99, 102, 241, 0.1);
}

.chart-bar:hover .chart-bar__fill {
  filter: brightness(1.08);
}

.chart-bar__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  text-align: center;
  min-height: 28px;
  width: 100%;
}

.chart-bar__label--hidden .chart-bar__day {
  visibility: hidden;
}

.chart-bar__day {
  font-size: 10px;
  font-weight: 700;
  color: #334155;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.chart-bar__month {
  font-size: 9px;
  font-weight: 600;
  color: #94a3b8;
  font-family: var(--font-mono);
}

/* KPI cards v2 */
.analytics-kpi--v2 {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px !important;
  background: linear-gradient(145deg, #fff 0%, #f8fafc 100%) !important;
  border: 1px solid rgba(99, 102, 241, 0.1) !important;
  border-radius: 16px !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.analytics-kpi--v2:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08) !important;
}

.analytics-kpi__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.analytics-kpi--indigo .analytics-kpi__icon { background: linear-gradient(135deg, #eef2ff, #e0e7ff); color: #6366f1; }
.analytics-kpi--violet .analytics-kpi__icon { background: linear-gradient(135deg, #f5f3ff, #ede9fe); color: #8b5cf6; }
.analytics-kpi--amber .analytics-kpi__icon { background: linear-gradient(135deg, #fffbeb, #fef3c7); color: #d97706; }
.analytics-kpi--emerald .analytics-kpi__icon { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #059669; }
.analytics-kpi--teal .analytics-kpi__icon { background: linear-gradient(135deg, #f0fdfa, #ccfbf1); color: #0d9488; }
.analytics-kpi--rose .analytics-kpi__icon { background: linear-gradient(135deg, #fff1f2, #ffe4e6); color: #e11d48; }

.analytics-kpi__body {
  min-width: 0;
}

.analytics-kpi--v2 .analytics-kpi-value {
  font-size: 24px !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em;
  color: #0f172a !important;
}

/* Period chips */
.analytics-inline-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.analytics-chip-btn {
  height: 32px !important;
  padding: 0 14px !important;
  border-radius: 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border: 1px solid #e2e8f0 !important;
  background: #fff !important;
  color: #64748b !important;
  transition: all 0.15s ease !important;
}

.analytics-chip-btn:hover {
  border-color: #c7d2fe !important;
  color: #4f46e5 !important;
  background: #f5f7ff !important;
}

.analytics-chip-btn.is-active {
  background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35) !important;
}

/* Page header polish */
.page-title {
  font-size: 28px !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-subtitle {
  font-size: 14px !important;
  color: #64748b !important;
}

.analytics-page-grid {
  gap: 20px !important;
}

.dash-grid {
  gap: 20px !important;
}

/* Status bars v2 */
.status-bars-v2 {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.status-bars-v2__row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-bars-v2__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-bars-v2__name {
  font-size: 13px;
  font-weight: 700;
}

.status-bars-v2__nums {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

.status-bars-v2__nums strong {
  color: #0f172a;
  font-weight: 800;
}

.status-bars-v2__track {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
}

.status-bars-v2__fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
  transition: width 0.4s ease;
}

/* Horizontal bar charts v2 */
.bar-chart-v2 {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bar-chart-v2__row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bar-chart-v2__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.bar-chart-v2__label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bar-chart-v2__nums {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

.bar-chart-v2__nums strong {
  color: #0f172a;
  font-weight: 800;
}

.bar-chart-v2__track {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
}

.bar-chart-v2__fill {
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
  transition: width 0.4s ease;
}

.bar-chart-v2__fill--geo {
  background: linear-gradient(90deg, #a5b4fc, #6366f1) !important;
}

.dash-recent-item {
  border-radius: 12px;
  background: linear-gradient(135deg, #fafbff 0%, #f8fafc 100%);
  border-color: rgba(99, 102, 241, 0.12);
}

.dash-recent-item:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: linear-gradient(135deg, #f5f7ff 0%, #eef2ff 100%);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

/* ═══ Lead modal v4 ═══ */
.lead-modal-overlay {
  align-items: flex-start;
  padding: 24px 16px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.modal-card--lead {
  width: min(680px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  border: 1px solid rgba(99, 102, 241, 0.12);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
  padding: 0;
}

.lead-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  background: linear-gradient(135deg, #fafbff 0%, #f8fafc 100%);
  border-bottom: 1px solid #e8ecf4;
}

.lead-modal__identity {
  min-width: 0;
  flex: 1;
}

.lead-modal__phone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.lead-modal__phone {
  font-size: 20px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #4f46e5;
  letter-spacing: -0.02em;
}

.lead-modal__status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.lead-modal__name {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  padding: 4px 0;
  margin-bottom: 6px;
}

.lead-modal__name:focus {
  outline: none;
}

.lead-modal__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: #64748b;
}

.lead-modal__mgr {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.lead-modal__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lead-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.lead-modal__btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.lead-modal__btn--primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.lead-modal__btn--primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #fff;
}

.lead-modal__btn--danger {
  background: #fff;
  border-color: #fecaca;
  color: #dc2626;
}

.lead-modal__btn--danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.lead-modal__close {
  width: 36px;
  height: 36px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.lead-modal__close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.lead-modal__body {
  overflow-y: auto;
  padding: 8px 0 16px;
}

.lead-modal__section {
  padding: 16px 22px;
  border-bottom: 1px solid #f1f5f9;
}

.lead-modal__section:last-child {
  border-bottom: none;
}

.lead-modal__section-title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lead-modal__section-title i {
  color: #6366f1;
  font-size: 16px;
}

.lead-modal__hint {
  margin: 10px 0 0;
  font-size: 11px;
  color: #94a3b8;
}

.lead-modal__hint-inline {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  margin-left: 6px;
}

.lead-modal__required {
  color: #ef4444;
}

.lead-modal__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lead-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.lead-field--wide {
  grid-column: 1 / -1;
}

.lead-field__label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lead-field__input {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 14px;
  color: #0f172a;
  width: 100%;
  box-sizing: border-box;
}

.lead-field__input:focus {
  outline: none;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.lead-tranches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.lead-tranche {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid #e8ecf4;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.lead-tranche:hover {
  border-color: #c7d2fe;
  background: #f5f7ff;
}

.lead-tranche--paid {
  border-color: rgba(16, 185, 129, 0.35);
  background: linear-gradient(165deg, #ecfdf5 0%, #f0fdf4 100%);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.15);
}

.lead-tranche__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.lead-tranche__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.lead-tranche--paid .lead-tranche__label {
  color: #047857;
}

.lead-tranche__check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
}

.lead-tranche--paid .lead-tranche__check {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}

.lead-tranche__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 10px;
  color: #94a3b8;
  font-weight: 600;
}

.lead-tranche__field:last-child {
  margin-bottom: 0;
}

.lead-tranche__amount {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  color: #0f172a;
}

.lead-tranche__amount input,
.lead-tranche__date {
  width: 100%;
  height: 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 13px;
  background: #fff;
  box-sizing: border-box;
}

.lead-comment-compose {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.lead-comment-compose__input {
  width: 100%;
  min-height: 80px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

.lead-comment-compose__input:focus {
  outline: none;
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.lead-comment-compose__btn {
  align-self: flex-start;
}

.lead-comments {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.lead-comments__empty {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px dashed #e2e8f0;
}

.lead-comment {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
}

.lead-comment__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.lead-comment__date {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  font-family: var(--font-mono);
}

.lead-comment__delete {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.lead-comment:hover .lead-comment__delete {
  opacity: 1;
}

.lead-comment__delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

.lead-comment__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #334155;
  word-break: break-word;
}

/* ═══ Leads table — status filter ═══ */
.status-filter-cell {
  position: relative;
  overflow: visible;
}

.status-header-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: border-color 0.15s, background 0.15s;
}

.status-header-trigger:hover,
.status-header-trigger[aria-expanded="true"] {
  border-color: #c7d2fe;
  background: #f5f7ff;
  color: #4f46e5;
}

.status-header-trigger__label {
  white-space: nowrap;
}

.status-header-trigger__pill {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-header-trigger__chev {
  font-size: 14px;
  opacity: 0.7;
  flex-shrink: 0;
}

.status-filter-panel {
  position: fixed;
  z-index: 12000;
  width: min(360px, calc(100vw - 24px));
  padding: 12px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.16);
}

.status-filter-panel[hidden] {
  display: none !important;
}

.status-filter-panel__title {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
  padding: 0 4px;
}

.status-filter-panel__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.status-filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #e8ecf4;
  background: #f8fafc;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.status-filter-chip:hover {
  border-color: #c7d2fe;
  background: #f5f7ff;
}

.status-filter-chip.is-active {
  border-color: #6366f1;
  background: #eef2ff;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.status-filter-chip--all {
  grid-column: 1 / -1;
  justify-content: center;
  color: #4f46e5;
}

.status-filter-chip__pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  background: var(--chip-bg, #f1f5f9);
  color: var(--chip-fg, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.leads-table-wrap .status-pill {
  font-size: 11px;
  font-weight: 650;
  padding: 4px 10px;
}

@media (max-width: 640px) {
  .funnel-v3__head {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 8px;
  }
  .funnel-v3__hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .chart-bars__plot {
    min-width: calc(var(--chart-cols) * var(--bar-min-width, 24px));
  }
  .chart-bars__hint {
    margin-left: 0;
    width: 100%;
  }
  .chart-bar__label {
    font-size: 8px;
  }
  .donut-chart {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .donut-chart__legend {
    grid-template-columns: 1fr;
    max-height: none;
    width: 100%;
  }
  .status-filter-panel__grid {
    grid-template-columns: 1fr;
  }
  .dash-split-row {
    grid-template-columns: 1fr;
  }
  .fortune-wheel__frame {
    width: min(100%, 220px);
  }
  .lead-modal__header {
    flex-direction: column;
  }
  .lead-modal__actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .lead-modal__grid {
    grid-template-columns: 1fr;
  }
  .lead-tranches {
    grid-template-columns: 1fr;
  }
  .lead-comment__delete {
    opacity: 1;
  }
}
