/* Центр уведомлений CRM */
.crm-notify-wrap {
  position: relative;
  flex-shrink: 0;
}
.crm-notify-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 18px;
  cursor: pointer;
  touch-action: manipulation;
}
.crm-notify-btn:hover { background: #fffbeb; border-color: #fcd34d; }
.crm-notify-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  pointer-events: none;
}
.crm-notify-panel-fixed {
  position: fixed;
  z-index: 10050;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 22px 56px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}
.crm-notify-panel[hidden] { display: none !important; }
.crm-notify-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(90deg, #fffbeb, #fff);
  flex-shrink: 0;
}
.crm-notify-panel-head strong { font-size: 14px; }
.crm-notify-panel-head button {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 8px;
}
.crm-notify-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
}
.crm-notify-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .12s;
}
.crm-notify-item:hover { background: #f8fafc; }
.crm-notify-item.unread { background: #fffdf4; }
.crm-notify-item.unread:hover { background: #fffbeb; }
.crm-notify-item-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 2px;
}
.crm-notify-item-body {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
  word-break: break-word;
}
.crm-notify-item-meta {
  margin-top: 4px;
  font-size: 11px;
  color: #94a3b8;
}
.crm-notify-empty {
  padding: 28px 16px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

/* Теги лидов */
.lead-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 4px;
  min-width: 0;
}
.lead-name-text {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.25;
  min-width: 0;
  flex: 0 1 auto;
  word-break: break-word;
}
.lead-tags-inline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
}
.lead-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--tag-border, #e2e8f0);
  border-radius: 999px;
  padding: 2px 8px 2px 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--tag-color, #475569);
  background: var(--tag-bg, #f8fafc);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  line-height: 1.2;
  white-space: nowrap;
}
.lead-tag-chip-compact {
  padding: 2px 7px 2px 5px;
  font-size: 10px;
}
.lead-tag-chip-icononly {
  padding: 2px 5px;
  min-width: 22px;
  justify-content: center;
}
.lead-tags-readonly {
  pointer-events: none;
  user-select: none;
}
.chat-item .lead-tags-inline {
  flex-shrink: 0;
}
.tg-thread-head .lead-tags-inline {
  flex-shrink: 0;
}
.tg-thread-title-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: 0;
}
.tg-thread-title-row .thread-title-lead {
  min-width: 0;
  flex: 0 1 auto;
}
.lead-tag-icon {
  font-size: 11px;
  line-height: 1;
}
.lead-tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 4px;
}
.lead-tag-quick {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity .12s, transform .12s, background .12s, border-color .12s, box-shadow .12s;
}
.lead .lead-tag-quick { opacity: 0.72; }
.lead-tag-quick.active { opacity: 1 !important; }
.lead:hover .lead-tag-quick,
.lead-m:hover .lead-tag-quick { opacity: 1; }
.lead-tag-quick.active {
  color: var(--tag-color, #475569);
  background: var(--tag-bg, #fffbeb);
  border-color: var(--tag-border, #fcd34d);
  box-shadow: 0 0 0 1px var(--tag-border, #fcd34d);
}
.lead-tag-quick:hover {
  transform: translateY(-1px);
  opacity: 1;
}
@media (max-width: 900px) {
  .lead-tag-quick { opacity: 0.92; }
}
.lead-tag-picker-hint {
  margin: 0 0 8px;
  font-size: 12px;
}
.lead-tag-picker-group {
  margin-bottom: 10px;
}
.lead-tag-picker-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.lead-tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lead-tag-toggle {
  border: 1px solid var(--tag-border, #e2e8f0);
  background: #fff;
  color: var(--tag-color, #475569);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .12s, box-shadow .12s, transform .12s;
}
.lead-tag-toggle:hover {
  background: var(--tag-bg, #f8fafc);
  transform: translateY(-1px);
}
.lead-tag-toggle.active {
  background: var(--tag-bg, #fffbeb);
  border-color: var(--tag-border, #fcd34d);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tag-border, #fcd34d) 35%, transparent);
}
.lead-tag-chip-negative {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tag-border, #ef4444) 25%, transparent);
}
.lead-tag-quick.negative.active {
  box-shadow: 0 0 0 1px var(--tag-border, #ef4444), 0 0 8px color-mix(in srgb, #ef4444 25%, transparent);
}
.lead-tags-drawer-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lead-tags-drawer-preview {
  min-height: 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #fafbfc 0%, #f8fafc 100%);
}
.lead-tags-preview-empty {
  font-size: 13px;
}
.lead-tags-open-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  color: #0f172a;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.lead-tags-open-btn:hover {
  transform: translateY(-1px);
  border-color: #94a3b8;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
.lead-head-board {
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.lead-head-board .lead-name-text {
  flex: 0 1 auto;
  min-width: 0;
}
.lead-tags-board {
  flex: 0 1 auto;
}
.lead-tag-bar-board {
  margin: 4px 0 6px;
}
.lead-tags-board-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 10px 4px 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
  color: #475569;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0.82;
  transition: opacity .12s, transform .12s, border-color .12s, box-shadow .12s;
}
.lead-tags-board-btn-icon {
  font-size: 14px;
  line-height: 1;
}
.lead-tags-board-btn-text {
  letter-spacing: 0.01em;
}
.lead:hover .lead-tags-board-btn,
.lead-m:hover .lead-tags-board-btn {
  opacity: 1;
}
.lead-tags-board-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.lead-tags-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}
.lead-tags-modal-overlay[hidden] {
  display: none !important;
}
body.lead-tags-modal-open {
  overflow: hidden;
}
.lead-tags-modal {
  width: min(520px, 100%);
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}
.lead-tags-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 10px;
  border-bottom: 1px solid #eef2f7;
}
.lead-tags-modal-head h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}
.lead-tags-modal-sub {
  margin: 4px 0 0;
  font-size: 12px;
}
.lead-tags-modal-close {
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 10px;
}
.lead-tags-modal-body {
  padding: 14px 18px 8px;
  overflow: auto;
}
.lead-tags-modal-section-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 10px;
}
.lead-tags-modal-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.lead-tags-modal-divider::before,
.lead-tags-modal-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
}
.lead-tags-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}
.lead-tag-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 88px;
  padding: 12px 10px;
  border-radius: 14px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: var(--tag-color, #334155);
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, border-color .12s, background .12s;
}
.lead-tag-tile:hover {
  transform: translateY(-2px);
  border-color: var(--tag-border, #cbd5e1);
  background: var(--tag-bg, #f8fafc);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.lead-tag-tile.active {
  border-color: var(--tag-border, #f59e0b);
  background: var(--tag-bg, #fffbeb);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tag-border, #f59e0b) 28%, transparent);
}
.lead-tag-tile.negative.active {
  box-shadow: 0 0 0 2px color-mix(in srgb, #ef4444 30%, transparent);
}
.lead-tag-tile-icon {
  font-size: 24px;
  line-height: 1;
}
.lead-tag-tile-label {
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
}
.lead-tag-tile-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: #fff;
  background: var(--tag-border, #f59e0b);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity .12s, transform .12s;
}
.lead-tag-tile.active .lead-tag-tile-check {
  opacity: 1;
  transform: scale(1);
}
.lead-tags-modal-foot {
  padding: 12px 18px 18px;
  border-top: 1px solid #eef2f7;
}
.lead-tags-modal-foot .primary {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  font-weight: 800;
}
.tag-filter-top {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  min-width: 120px;
  max-width: 160px;
}

.crm-notify-btn { text-decoration: none; color: inherit; }
.crm-notify-page-list { display: grid; gap: 10px; }
.crm-notify-page-item[data-has-href="1"] {
  cursor: pointer;
}
.crm-notify-page-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.crm-notify-page-item .crm-notify-item-body {
  margin: 0;
  line-height: 1.45;
  word-break: break-word;
}
.crm-notify-page-item .crm-notify-item-meta {
  margin: 0;
}
.crm-notify-ack-warn { color: #b91c1c; }
.crm-notify-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
  padding-top: 4px;
}
.crm-notify-page-actions .btn,
.crm-notify-page-actions a.btn {
  margin: 0;
  flex-shrink: 0;
}
.crm-notify-page-item.unread { border-color: #fcd34d; background: #fffdf5; }
.crm-notify-page-item.needs-ack {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.12);
}
.crm-notify-empty-page { padding: 28px; text-align: center; color: #64748b; }

body.crm-ack-lock { overflow: hidden; }
.crm-ack-overlay {
  position: fixed;
  inset: 0;
  z-index: 100200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
}
.crm-ack-overlay[hidden] {
  display: none !important;
  pointer-events: none;
  backdrop-filter: none;
}
.crm-ack-card {
  width: min(560px, 100%);
  max-height: min(90vh, 720px);
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}
.crm-ack-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 4px 10px;
  margin-bottom: 10px;
}
.crm-ack-card h2 { margin: 0 0 10px; font-size: 20px; line-height: 1.3; }
.crm-ack-meta {
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
  margin: 0 0 12px;
}
.crm-ack-meta a { color: #4f46e5; }
.crm-ack-details {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  font-size: 14px;
}
.crm-ack-details--empty { font-style: italic; }
.crm-ack-actions { margin: 0 0 10px; }
.crm-ack-open-link { width: 100%; text-align: center; justify-content: center; }
.crm-ack-body { margin: 0 0 12px; line-height: 1.5; }
.crm-ack-hint { margin: 0 0 12px; font-size: 12px; line-height: 1.45; }
.crm-ack-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0;
  font-weight: 600;
  cursor: pointer;
}
.crm-ack-btn { width: 100%; min-height: 44px; }
.crm-ack-queue { font-size: 12px; margin: 10px 0 0; text-align: center; }
