:root {
      --bg-app: #0b0e14;
      --bg-surface: #121721;
      --bg-card: #18202c;
      --bg-input: #1d2636;
      --border: #232d3d;
      --primary: #2563eb;
      --primary-hover: #1d4ed8;
      --primary-glow: rgba(37, 99, 235, 0.35);
      --text-main: #f8fafc;
      --text-muted: #94a3b8;
      --text-dim: #64748b;
      --green: #10b981;
      --green-bg: rgba(16, 185, 129, 0.12);
      --yellow: #f59e0b;
      --yellow-bg: rgba(245, 158, 11, 0.12);
      --danger: #ef4444;
      --danger-bg: rgba(239, 68, 68, 0.12);
      --radius-lg: 16px;
      --radius-md: 12px;
      --radius-sm: 8px;
    }

    body.light-theme {
      --bg-app: #f8fafc;
      --bg-surface: #ffffff;
      --bg-card: #f1f5f9;
      --bg-input: #e2e8f0;
      --border: #e2e8f0;
      --primary: #0284c7;
      --primary-hover: #0369a1;
      --primary-glow: rgba(2, 132, 199, 0.25);
      --text-main: #0f172a;
      --text-muted: #475569;
      --text-dim: #64748b;
      --green: #16a34a;
      --danger: #dc2626;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      -webkit-tap-highlight-color: transparent;
    }

    body {
      background-color: var(--bg-app);
      color: var(--text-main);
      line-height: 1.5;
      padding-bottom: 84px;
      user-select: none;
      overflow-x: hidden;
      transition: background-color 0.2s ease, color 0.2s ease;
    }

    .top-header {
      background: var(--bg-surface);
      backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--border);
      padding: 10px 16px;
      position: sticky;
      top: 0;
      z-index: 100;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .brand-title {
      font-weight: 800;
      font-size: 1.12rem;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .brand-badge {
      background: var(--primary);
      color: #fff;
      font-size: 9px;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 4px;
      text-transform: uppercase;
    }

    .header-right {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .theme-toggle-btn {
      background: var(--bg-card);
      color: var(--text-main);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 4px 10px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .status-pill {
      font-size: 0.72rem;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 9999px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .status-online { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.3); }
    .status-offline { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

    .pulse {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--green);
      box-shadow: 0 0 8px var(--green);
    }

    .screen {
      display: none;
      padding: 16px;
      position: relative;
      animation: fadeIn 0.2s ease;
    }
    .screen.active {
      display: block;
    }
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(4px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .section-title {
      font-size: 1.25rem;
      font-weight: 800;
      margin-bottom: 2px;
    }
    .section-subtitle {
      font-size: 0.8rem;
      color: var(--text-muted);
      margin-bottom: 16px;
    }

    .card {
      background: var(--bg-surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 16px;
      margin-bottom: 12px;
    }

    .crm-wrapper {
      position: relative;
      min-height: 480px;
      width: 100%;
    }

    .blurred-content {
      filter: blur(6px) opacity(0.5);
      -webkit-filter: blur(6px) opacity(0.5);
      pointer-events: none !important;
      user-select: none !important;
      transition: filter 0.2s ease, opacity 0.2s ease;
    }

    .crm-blur-overlay {
      display: none;
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100%;
      height: 100%;
      background: rgba(11, 14, 20, 0.45);
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      z-index: 70;
      border-radius: var(--radius-md);
      padding: 20px 16px;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      text-align: center;
      box-sizing: border-box;
    }

    body.light-theme .crm-blur-overlay {
      background: rgba(248, 250, 252, 0.55);
    }

    .lock-box {
      background: var(--bg-surface);
      border: 1px solid rgba(59, 130, 246, 0.5);
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 24px var(--primary-glow);
      border-radius: var(--radius-lg);
      padding: 24px 18px;
      max-width: 330px;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-top: 30px;
      animation: fadeIn 0.25s ease;
    }

    .btn-upgrade-crm {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      width: 100%;
      background: var(--primary);
      color: #fff;
      border: none;
      padding: 12px 16px;
      border-radius: 10px;
      font-weight: 700;
      font-size: 0.9rem;
      cursor: pointer;
      text-decoration: none;
      box-shadow: 0 4px 14px var(--primary-glow);
      transition: all 0.2s ease;
    }
    .btn-upgrade-crm:active {
      transform: scale(0.98);
      background: var(--primary-hover);
    }

    .pipeline-summary {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
      margin-bottom: 14px;
    }
    .pipeline-step {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 10px 6px;
      text-align: center;
    }
    .pipeline-num {
      font-size: 1.25rem;
      font-weight: 800;
      color: #60a5fa;
    }
    .pipeline-label {
      font-size: 0.68rem;
      color: var(--text-muted);
      text-transform: uppercase;
      font-weight: 600;
    }

    .lead-item {
      display: flex;
      flex-direction: column;
      gap: 8px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 14px;
      margin-bottom: 10px;
      cursor: pointer;
      transition: transform 0.15s ease, border-color 0.15s ease;
    }
    .lead-item:active {
      transform: scale(0.98);
      border-color: rgba(59, 130, 246, 0.4);
    }
    .lead-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 6px;
    }
    .lead-title {
      font-weight: 700;
      font-size: 0.9rem;
      color: var(--text-main);
    }
    .lead-badges-row {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-wrap: nowrap;
    }
    .lead-badge {
      font-size: 0.68rem;
      font-weight: 700;
      padding: 3px 8px;
      border-radius: 6px;
      text-transform: uppercase;
      white-space: nowrap;
    }
    .badge-hot { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
    .badge-warm { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(245, 158, 11, 0.3); }
    .badge-ready { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.3); }

    .score-badge {
      font-size: 0.68rem;
      font-weight: 800;
      padding: 2px 6px;
      border-radius: 6px;
      background: #1e3a8a;
      color: #93c5fd;
      border: 1px solid rgba(59, 130, 246, 0.4);
    }

    .lead-desc {
      font-size: 0.8rem;
      color: var(--text-muted);
      line-height: 1.4;
    }
    .lead-actions {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-top: 6px;
      border-top: 1px solid rgba(255, 255, 255, 0.05);
    }
    .time-stamp {
      font-size: 0.72rem;
      color: var(--text-dim);
    }
    .btn-tg-chat {
      background: #172554;
      color: #93c5fd;
      border: 1px solid #1e40af;
      padding: 5px 12px;
      border-radius: 6px;
      font-size: 0.75rem;
      font-weight: 600;
      text-decoration: none;
      cursor: pointer;
    }

    .cal-day-heading {
      font-size: 0.84rem;
      font-weight: 800;
      color: #60a5fa;
      margin: 18px 0 8px 4px;
      display: flex;
      align-items: center;
      gap: 6px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .cal-day-heading::after {
      content: "";
      flex-grow: 1;
      height: 1px;
      background: var(--border);
      margin-left: 8px;
    }

    .slot-item {
      display: flex;
      gap: 12px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 12px;
      margin-bottom: 8px;
      align-items: center;
      cursor: pointer;
      transition: transform 0.15s ease, border-color 0.15s ease;
    }
    .slot-item:active {
      transform: scale(0.98);
      border-color: rgba(59, 130, 246, 0.4);
    }
    .slot-time-col {
      background: #111a2e;
      border: 1px solid #1e3a8a;
      border-radius: var(--radius-sm);
      padding: 8px 10px;
      text-align: center;
      min-width: 64px;
    }
    .slot-time {
      font-size: 1rem;
      font-weight: 800;
      color: #60a5fa;
    }
    .slot-date {
      font-size: 0.7rem;
      color: var(--text-muted);
      font-weight: 700;
      text-transform: uppercase;
    }
    .slot-details {
      flex-grow: 1;
    }
    .slot-obj {
      font-size: 0.86rem;
      font-weight: 700;
      color: var(--text-main);
      margin-bottom: 2px;
    }
    .slot-seller {
      font-size: 0.76rem;
      color: var(--text-muted);
    }

    .slot-phone-row {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 4px;
    }

    .slot-phone {
      font-size: 0.82rem;
      color: var(--green);
      font-weight: 700;
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .slot-phone:active { opacity: 0.75; }

    .btn-contact-pill {
      background: rgba(16, 185, 129, 0.15);
      color: var(--green);
      border: 1px solid rgba(16, 185, 129, 0.35);
      padding: 3px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      transition: background 0.15s;
      cursor: pointer;
    }
    .btn-contact-pill:active { background: rgba(16, 185, 129, 0.3); }

    .slot-actions-row {
      display: flex;
      gap: 6px;
      margin-top: 6px;
      flex-wrap: wrap;
    }

    .btn-cal-action {
      background: #1e293b;
      color: #93c5fd;
      border: 1px solid rgba(59, 130, 246, 0.3);
      padding: 4px 8px;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      gap: 4px;
      cursor: pointer;
    }
    .btn-cal-action:active { background: #334155; }

    .kpi-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 6px;
      margin-bottom: 12px;
    }
    .kpi-box {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 8px 4px;
      text-align: center;
    }
    .kpi-num {
      font-size: 1.15rem;
      font-weight: 800;
      color: #60a5fa;
    }
    .kpi-label {
      font-size: 0.65rem;
      color: var(--text-muted);
      text-transform: uppercase;
      font-weight: 600;
    }

    .agent-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 12px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      margin-bottom: 6px;
      cursor: pointer;
    }
    .agent-avatar {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: #1e2838;
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 0.82rem;
      color: #60a5fa;
      flex-shrink: 0;
    }
    .agent-meta {
      margin-left: 10px;
      flex-grow: 1;
    }
    .agent-name {
      font-size: 0.86rem;
      font-weight: 700;
    }
    .agent-sub {
      font-size: 0.7rem;
      color: var(--text-muted);
    }
    .btn-invite {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: 100%;
      background: var(--bg-card);
      border: 1px dashed var(--primary);
      color: #60a5fa;
      padding: 12px;
      border-radius: var(--radius-md);
      font-size: 0.84rem;
      font-weight: 700;
      cursor: pointer;
      margin-top: 10px;
    }
    .slot-full-banner {
      background: rgba(56, 189, 248, 0.08);
      border: 1px solid rgba(56, 189, 248, 0.25);
      border-radius: var(--radius-md);
      padding: 12px;
      font-size: 0.78rem;
      color: var(--text-muted);
      text-align: center;
      margin-top: 10px;
    }

    .vip-manager-card {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.04) 100%);
      border: 1px solid rgba(245, 158, 11, 0.35);
      border-radius: var(--radius-md);
      padding: 16px 14px;
      margin-top: 14px;
      display: flex;
      flex-direction: column;
      gap: 8px;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    }
    .btn-vip-manager {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: 100%;
      background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
      color: #000;
      border: none;
      padding: 12px 14px;
      border-radius: 10px;
      font-weight: 800;
      font-size: 0.88rem;
      cursor: pointer;
      text-decoration: none;
      box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
      transition: all 0.15s ease;
      margin-top: 4px;
    }
    .btn-vip-manager:active {
      transform: scale(0.98);
      opacity: 0.9;
    }

    .balance-card {
      background: linear-gradient(135deg, #151e30 0%, #101624 100%);
      border: 1px solid rgba(59, 130, 246, 0.4);
      border-radius: var(--radius-lg);
      padding: 18px;
      margin-bottom: 14px;
    }
    .balance-val {
      font-size: 1.9rem;
      font-weight: 800;
      color: #fff;
      margin: 4px 0 10px;
    }
    .progress-bar {
      height: 7px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 4px;
      margin-top: 6px;
      overflow: hidden;
    }
    .progress-fill {
      height: 100%;
      background: var(--primary);
      width: 0%;
      transition: width 0.3s ease;
    }
    .tier-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 14px;
      margin-bottom: 10px;
    }
    .tier-card.active {
      border: 2px solid var(--primary);
      background: rgba(37, 99, 235, 0.08);
    }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: var(--primary);
      color: #fff;
      border: none;
      padding: 9px 14px;
      border-radius: 8px;
      font-weight: 600;
      font-size: 0.84rem;
      cursor: pointer;
      text-decoration: none;
      transition: opacity 0.2s;
    }
    .btn:active { opacity: 0.8; }
    .btn-secondary {
      background: var(--bg-card);
      color: var(--text-main);
      border: 1px solid var(--border);
    }
    .btn-danger {
      background: var(--danger-bg);
      color: var(--danger);
      padding: 8px 12px;
      border-radius: 8px;
      border: none;
      font-weight: 600;
      cursor: pointer;
    }

    .bottom-nav {
      position: fixed;
      bottom: 0;
      left: 0;
      width: 100%;
      background: var(--bg-surface);
      backdrop-filter: blur(16px);
      border-top: 1px solid var(--border);
      display: flex;
      justify-content: space-around;
      padding: 6px 0;
      z-index: 1000;
    }
    .nav-btn {
      background: transparent;
      border: none;
      color: var(--text-dim);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      font-size: 0.65rem;
      font-weight: 600;
      cursor: pointer;
      flex: 1;
      transition: color 0.15s ease;
    }
    .nav-btn.active {
      color: #60a5fa;
    }
    .nav-btn-icon {
      font-size: 1.25rem;
    }

    .modal {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.65);
      z-index: 1100;
      align-items: flex-end;
      backdrop-filter: blur(4px);
    }
    .modal-content {
      background: var(--bg-surface);
      width: 100%;
      max-height: 85vh;
      overflow-y: auto;
      border-radius: 20px 20px 0 0;
      padding: 20px 16px 32px 16px;
      box-sizing: border-box;
      animation: slideUp 0.22s ease-out;
      border-top: 1px solid var(--border);
    }
    @keyframes slideUp {
      from { transform: translateY(100%); }
      to { transform: translateY(0); }
    }
    .modal-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 14px;
    }
    .input-field {
      width: 100%;
      padding: 12px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: var(--bg-input);
      color: var(--text-main);
      font-size: 14px;
      box-sizing: border-box;
      margin-bottom: 10px;
      outline: none;
    }

    .lead-info-row {
      margin-bottom: 12px;
    }
    .lead-info-label {
      font-size: 0.70rem;
      color: var(--text-dim);
      text-transform: uppercase;
      font-weight: 700;
      margin-bottom: 2px;
    }
    .lead-info-val {
      font-size: 0.90rem;
      color: var(--text-main);
      font-weight: 600;
      word-break: break-word;
    }

    .dialog-chat-container {
      margin-top: 12px;
      border-top: 1px dashed var(--border);
      padding-top: 12px;
      display: none;
    }
    .chat-bubble {
      margin-bottom: 8px;
      max-width: 86%;
      padding: 9px 12px;
      border-radius: 12px;
      font-size: 0.82rem;
      line-height: 1.4;
      word-break: break-word;
    }
    .bubble-client {
      background: var(--bg-card);
      border: 1px solid var(--border);
      color: var(--text-main);
      align-self: flex-start;
      margin-right: auto;
      border-bottom-left-radius: 3px;
    }
    .bubble-bot {
      background: #1e3a8a;
      border: 1px solid rgba(59, 130, 246, 0.4);
      color: #eff6ff;
      align-self: flex-end;
      margin-left: auto;
      border-bottom-right-radius: 3px;
    }
    .bubble-time {
      font-size: 0.65rem;
      color: var(--text-dim);
      margin-top: 3px;
      text-align: right;
    }
    .bubble-bot .bubble-time {
      color: #93c5fd;
    }
/* === СТИЛИ ЭКРАНА СЕГОДНЯ (ФОКУС ДНЯ) === */
.today-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.today-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  text-align: center;
  transition: border-color 0.2s;
}

.today-kpi-card.focus-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(30, 58, 138, 0.1) 100%);
  border: 1px solid rgba(59, 130, 246, 0.45);
}

.today-kpi-num {
  font-size: 1.45rem;
  font-weight: 800;
  color: #60a5fa;
  line-height: 1.1;
  margin-bottom: 4px;
}

.today-kpi-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.today-block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.today-badge-count {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: #60a5fa;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
}

.today-empty-card {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === АДАПТАЦИЯ КАЛЕНДАРЯ ДЛЯ СВЕТЛОЙ ТЕМЫ === */
body.light-theme .slot-time-col {
  background: #e0f2fe;
  border: 1px solid #bae6fd;
}

body.light-theme .slot-time {
  color: #0284c7;
}

body.light-theme .slot-date {
  color: #0369a1;
}

body.light-theme .btn-cal-action {
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

body.light-theme .btn-cal-action:active {
  background: #e2e8f0;
}

body.light-theme .btn-avito-link {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.btn-avito-link {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-avito-link:active {
  transform: scale(0.97);
}

/* === СТИЛИ ЭКРАНА АНАЛИТИКИ И ИТОГОВ === */
.period-toggle-row {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 4px;
  margin-bottom: 14px;
}

.period-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.74rem;
  padding: 7px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.period-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

body.light-theme .period-btn.active {
  background: var(--primary);
  color: #fff;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.analytics-kpi-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 4px;
  text-align: center;
}

.analytics-kpi-box.highlight {
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: var(--green-bg);
}

.analytics-kpi-num {
  font-size: 1.18rem;
  font-weight: 800;
  color: #60a5fa;
  line-height: 1.1;
  margin-bottom: 2px;
}

.analytics-kpi-box.highlight .analytics-kpi-num {
  color: var(--green);
}

.analytics-kpi-label {
  font-size: 0.64rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

.object-stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.object-stat-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.object-stat-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* === ТАБЫ ПЕРЕКЛЮЧЕНИЯ АКТИВНЫЕ / АРХИВ === */
.leads-toggle-tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.leads-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
}

.leads-tab-btn.active {
  background: var(--primary);
  color: #fff;
}

#leads-archive-badge {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  padding: 1px 5px;
  border-radius: 10px;
  font-size: 0.65rem;
}

body.light-theme .leads-tab-btn.active #leads-archive-badge {
  background: rgba(255, 255, 255, 0.3);
}

/* === ФИКС СЕТКИ ШАПКИ ВОРОНКИ ЛИДОВ === */
#screen-crm .pipeline-summary {
  margin-top: 10px;
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
}

.leads-toggle-tabs {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

/* === ЧИСТАЯ ШАПКА CRM ВОРОНКИ === */
.crm-top-bar {
  margin-bottom: 14px;
}

.crm-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.crm-title-row .section-title {
  margin: 0;
}

.crm-top-bar .section-subtitle {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.pipeline-summary {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* === ТОЧНЫЙ ФИКС ШАПКИ ВОРОНКИ ЛИДОВ === */
.crm-header-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
  width: 100%;
}

.crm-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.crm-header-top .section-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
}

.crm-header-box .section-subtitle {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.leads-toggle-tabs {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.leads-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.leads-tab-btn.active {
  background: var(--primary);
  color: #fff;
}

body.light-theme .leads-tab-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Фикс плашек этапов */
#screen-crm .pipeline-summary {
  display: flex !important;
  gap: 8px !important;
  margin-top: 4px !important;
  margin-bottom: 16px !important;
  width: 100% !important;
  position: relative !important;
  z-index: 1 !important;
}

#screen-crm .pipeline-step {
  flex: 1;
}
